Finite element model from another modelΒΆ

Sometimes, it is interesting to compare several geometries for the same subject. Since the geometry has a big impact on the solution of the problems, it is interesting to start by creating the most complex model to, then, create simpler models by merging some tissues. In this example, we use the model previously generated for Suzanne.


This process does not keep the fields included into tissues involved in the merges.

As for the generation from labels, we start by declaring the model and giving it a name.

[ ]:
from shamo import FEM

model = FEM("fem_from_fem", "../../derivatives")

Next, we must define the merge operations that must be performed. This dictionary must contain, as keys, the names of the resulting tissues and, as values, the list of names of the tissues that must be merged.

[ ]:
merges = {"soft": ["wm", "scalp"]}

Finally, we can generate the mesh by specifying the original model to base the new one on and the merge dictionary using the mesh_from_fem() method.

[ ]:
model.mesh_from_fem("../../derivatives/suzanne/suzanne.json", merges)