<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Obtain material properties from material database]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">When using the GUI, drag and dropping a ViP model to the material settings automatically creates the tissue properties and assigns entities of the ViP model to each tissue property.</p>
<p dir="auto">I am trying to perform the same task through the python API.<br />
Assuming that I obtained all ViP model entity names, how can we assign automatically the tissue property from the database ?</p>
<p dir="auto">thanks<br />
redi</p>
]]></description><link>https://forum.zmt.swiss/topic/359/obtain-material-properties-from-material-database</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 04:43:55 GMT</lastBuildDate><atom:link href="https://forum.zmt.swiss/topic/359.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Aug 2021 15:51:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Obtain material properties from material database on Mon, 16 Aug 2021 11:48:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi Haza,</p>
<p dir="auto">yes, i managed to get the corresponding material with :<br />
tissue_X_entity.MaterialName<br />
Each entity of the anatomical model has this attribute which is visible also through the GUI.<br />
thanks</p>
]]></description><link>https://forum.zmt.swiss/post/1039</link><guid isPermaLink="true">https://forum.zmt.swiss/post/1039</guid><dc:creator><![CDATA[rediponi]]></dc:creator><pubDate>Mon, 16 Aug 2021 11:48:51 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain material properties from material database on Mon, 16 Aug 2021 10:16:15 GMT]]></title><description><![CDATA[<p dir="auto">Redi! Have you tried doing exactly that through the GUI and then right clicking the simulation and selecting 'To Python..' if I remember correctly that shows you how to assign materials to the database.</p>
<p dir="auto">Just tried it and I get something like this:</p>
<pre><code>import s4l_v1.materials.database as database

# Adding a new MaterialSettings
material_settings = acoustic.MaterialSettings()
components = [entity__block1]
mat = database["IT'IS 4.0"]["Brain (Grey Matter)"]
if mat is not None:
	simulation.LinkMaterialWithDatabase(material_settings, mat)
else:
	# Fallback if material is not found
	material_settings.Name = "Brain (Grey Matter)"
	material_settings.MassDensity = 1044.5, Unit("kg/m^3")
	material_settings.AttenuationCoefficient = 1.2, Unit("Np/m")
simulation.Add(material_settings, components)
</code></pre>
<p dir="auto">Never tried it with the ViP model but should work.</p>
]]></description><link>https://forum.zmt.swiss/post/1038</link><guid isPermaLink="true">https://forum.zmt.swiss/post/1038</guid><dc:creator><![CDATA[montanaro]]></dc:creator><pubDate>Mon, 16 Aug 2021 10:16:15 GMT</pubDate></item></channel></rss>