⇤ ← Revision 1 as of 2019-03-11 17:50:58
Size: 8812
Comment:
|
Size: 9285
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
Line 6: | Line 7: |
Target Outcome | = Target Outcome = |
Line 10: | Line 11: |
Input | === Input === * Indentation and force data from in vitro experiments. * Completed leg or arm assembly, with each individual tissue layered modeled separately. === Procedures === |
Line 12: | Line 16: |
Indentation and force data from in vitro experiments. Completed leg or arm assembly, with each individual tissue layered modeled separately. Procedures |
==== Creation of Model Assembly ==== ===== Creating Surface Representations ===== This process is overall similar to [[Specifications/FullySpecificModeling | development of lumped tissue models]], but has more steps given the relative increase in model complexity. |
Line 16: | Line 20: |
Creation of Model Assembly | Starting with [[Specifications/ImageSegmentation|Image Segmentation]] of separate tissues, generate 4 different stl files. The 3 key files are the bone by itself, the bone merged with the muscle, and finally the bone merged with the muscle and fat. The fourth file includes the merged skin layer, and is only used to test the assumption that extruding a constant thickness is a reasonable assumption. The final stl consisting of the bone_muscle_fat should be cut ~5 slices on both ends relative to the muscle_fat layer. This procedure can be done by joining the individual layers into a single block, which can be done in Slicer by using the Editor. Within the Editor, the Change Label Effect makes one color of label change to another. This way different tissue layers can be joined together to create multiple "lumped" portions of the leg. Joining the bone to the lumped portions is also recommended. Use the Model Maker to [[Specifications/ImageSegmentation|generate the surface]], and save all 3 parts as separate stl files. |
Line 18: | Line 22: |
Creating Surface Representations This process is overall similar to development of lumped tissue models, but has more steps given the relative increase in model complexity. Starting with Image Segmentation of separate tissues, generate 4 different stl files. The 3 key files are the bone by itself, the bone merged with the muscle, and finally the bone merged with the muscle and fat. The fourth file includes the merged skin layer, and is only used to test the assumption that extruding a constant thickness is a reasonable assumption. The final stl consisting of the bone_muscle_fat should be cut ~5 slices on both ends relative to the muscle_fat layer. This procedure can be done by joining the individual layers into a single block, which can be done in Slicer by using the Editor. Within the Editor, the Change Label Effect makes one color of label change to another. This way different tissue layers can be joined together to create multiple "lumped" portions of the leg. Joining the bone to the lumped portions is also recommended. Use the Model Maker to generate the surface, and save all 3 parts as separate stl files. Remeshing the Surface |
===== Remeshing the Surface ===== |
Line 28: | Line 25: |
First use Poisson Reconstruction. This does not produce the even triangle size that is desired, but the resulting surface can then be isoparameterized itself. Sometimes this reconstruction may produce undesirable results. Switching the octree depth and solver divide to 7 tends to give better results over the default settings. Detailed instructions on Poisson Reconstruction can be found here. | First use `Poisson Reconstruction`. This does not produce the even triangle size that is desired, but the resulting surface can then be isoparameterized itself. Sometimes this reconstruction may produce undesirable results. Switching the octree depth and solver divide to 7 tends to give better results over the default settings. [[Specifications/GeometryGeneration/PoissonReconstruction|Detailed instructions on Poisson Reconstruction can be found here.]] |
Line 30: | Line 27: |
!MeshLab's Iso Parameterization does an excellent job of remeshing, but it is very fickle and may crash !MeshLab. It is recommended to save before attempting. Increasing the convergence precision (to 3 or 5) and toggling the double step parameter can sometimes fix crashing. Different poisson reconstruction settings might also fix crashes. Detailed instructions on Iso Parameterizing can be found here. | !MeshLab's `Iso Parameterization` does an excellent job of remeshing, but it is very fickle and may crash !MeshLab. It is recommended to save before attempting. Increasing the convergence precision (to 3 or 5) and toggling the double step parameter can sometimes fix crashing. Different poisson reconstruction settings might also fix crashes. [[Specifications/GeometryGeneration/Isoparameterization|Detailed instructions on Iso Parameterizing can be found here.]] |
Line 32: | Line 30: |
The next step is to remesh the iso parameterized model. A sample rate of 5 was primarily used for quad models as per our mesh convergence study. The bone model is meshed at a sample rate (i.e. 8) typically. | The next step is to remesh the iso parameterized model. A sample rate of 5 was primarily used for quad models as per our [[Specifications/MeshConvergence|mesh convergence study]]. The bone model is meshed at a sample rate (i.e. 8) typically. |
Line 36: | Line 34: |
Creating the Skin Layer | ===== Creating the Skin Layer ===== The skin layer was not generated originally because its small thickness would often result in the fat layer cutting through it. As such, the skin is generated by extruding the fat stl with a series of python scripts. Starting with your meshed bone_muscle_fat stl file, first run the python script !SliceStl.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/Meshes/SliceStl.py|found here]]. This might be better with my blender script (!!!). This script removes the ends of the fat stl file. To get around Febio compatibility issues, open the newly created file in Meshlab and force flip all the face normals, so that all normals now point inward. The file is then extruded a negative distance with !ExtrudeMesh.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/Salome/ExtrudeMesh.py|found here]]. A constant extrusion length can be considered a reasonable assumption after viewing the distribution of skin thickness for each model with the script !SkinThickness.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/vtk/SkinThickness.py|found here]]. Note that in order to run this you will have to run !SliceStl.py on your bone_muscle_fat raw stl and on the bone_muscle_fat_skin raw stl. |
Line 38: | Line 38: |
The skin layer was not generated originally because its small thickness would often result in the fat layer cutting through it. As such, the skin is generated by extruding the fat stl with a series of python scripts. Starting with your meshed bone_muscle_fat stl file, first run the python script !SliceStl.py found here. This might be better with my blender script (!!!). This script removes the ends of the fat stl file. To get around Febio compatibility issues, open the newly created file in Meshlab and force flip all the face normals, so that all normals now point inward. The file is then extruded a negative distance with !ExtrudeMesh.py found here. A constant extrusion length can be considered a reasonable assumption after viewing the distribution of skin thickness for each model with the script !SkinThickness.py found here. Note that in order to run this you will have to run !SliceStl.py on your bone_muscle_fat raw stl and on the bone_muscle_fat_skin raw stl. | |
Line 40: | Line 39: |
Cutting the Mesh | ===== Cutting the Mesh ===== When the surfaces were created, every internal layer was included for each part. This was to allow the internal layer to be cut from the subsequent external layer, ensuring a perfect fit at each interface. If this was not done the remeshing and smoothing steps will have created a small, but noticeable amount of overlap. Cutting the bone_muscle file with the bone stl file and cutting the bone_muscle_fat file with the bone_muscle file will prevent this issue. |
Line 42: | Line 42: |
When the surfaces were created, every internal layer was included for each part. This was to allow the internal layer to be cut from the subsequent external layer, ensuring a perfect fit at each interface. If this was not done the remeshing and smoothing steps will have created a small, but noticeable amount of overlap. Cutting the bone_muscle file with the bone stl file and cutting the bone_muscle_fat file with the bone_muscle file will prevent this issue. | This step can be accomplished with either of 2 scripts. The best option is to use the Python script bpy_!CutStlWithStl.py [[https://simtk.org/svn/multis/studies/LumpedModels/src/Python3.4/|found here]]. If blender or python3 are not readily available, this can also be accomplished by using the Python script !CutStlWithStl.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/vtk/CutStlWithStl.py|found here]]. The blender script is preferable because it is better at mesh generation at the cut site, as the vtk script will sometimes generate intersecting triangles that need to be manually fixed. Use Meshlabs Filter>Selection>Select Self Intersecting Faces to visualize and fix them. Note that this filter frequently reports false positives, so only spend time fixing triangles that actually are problematic. After this step, you should have meshed surface representations of the bone, muscle and fat layers that fit perfectly with each other, as well as a skin mesh of wedge elements. |
Line 44: | Line 44: |
This step can be accomplished with either of 2 scripts. The best option is to use the Python script bpy_!CutStlWithStl.py found here. If blender or python3 are not readily available, this can also be accomplished by using the Python script !CutStlWithStl.py found here. The blender script is preferable because it is better at mesh generation at the cut site, as the vtk script will sometimes generate intersecting triangles that need to be manually fixed. Use Meshlabs Filter>Selection>Select Self Intersecting Faces to visualize and fix them. Note that this filter frequently reports false positives, so only spend time fixing triangles that actually are problematic. After this step, you should have meshed surface representations of the bone, muscle and fat layers that fit perfectly with each other, as well as a skin mesh of wedge elements. Placement of the ultrasound probe |
===== Placement of the ultrasound probe ===== |
Line 50: | Line 47: |
Once you have a local copy you can use the script initial_probe_positions.py found here. | Once you have a local copy you can use the script initial_probe_positions.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/Salome/initial_probe_position.py |found here.]] |
Line 52: | Line 49: |
In addition to the stl you will need the registration xml for the model you are using, it will be named something like CMULTIS008-1_UL_US_CT.xml for the upperleg of specimen 008. | In addition to the stl you will need the registration xml for the model you are using, it will be named something like CMULTIS008-1_UL_US_CT.xml for the upperleg of specimen 008. |
Line 54: | Line 51: |
The probe often overlaps too much with the model, so it can be manually moved in meshlab, or with the Python script Probe_Overlap_Transform.py found here if you are trying to replicate the experimental data. | The probe often overlaps too much with the model, so it can be manually moved in meshlab, or with the Python script Probe_Overlap_Transform.py [[https://simtk.org/svn/multis/utl/SimulationWork/Python/Registration/Probe_Overlap_Transform.py|found here]] if you are trying to replicate the experimental data. |
Line 56: | Line 53: |
Model Assembly | ===== Model Assembly ===== Once all surface meshes have been created and the probe is properly positioned, it is time to make the Connectivity xml document that the model assembly script will use to prepare the model. Here is a sample xml file. Multiplier values may need to be changed based on your model. The skin ties especially should be examined, as the skin is composed of both tri6 and quad8 elements. Febio does not support having different element types in one surface definition, so make sure the contact surface only includes tri6 elements. This also means the current All_Skin_Faces definition in the geometry file is invalid (!!!). {{{ <Assembly> <Bone> <file>bone.stl</file> <material>rigid</material> <Tie> <Muscle type="proximity" multiplier=".2"/> </Tie> </Bone> <Muscle> <file>bone_muscle_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Fat type="proximity" multiplier=".2"/> <Bone type="proximity" multiplier=".2"/> </Tie> </Muscle> <Fat> <file>/bone_muscle_fat_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Muscle type="proximity" multiplier=".2"/> <Skin type="proximity" multiplier=".2"/> </Tie> </Fat> <Skin> <file>/skin.med</file> <quad/> <material>elastic</material> <Contact> <Probe type="normals" multiplier="20"/> </Contact> <Tie> <Fat type="proximity" multiplier=".2"/> </Tie> </Skin> <Probe> <file>/oriented_probe.stl</file> <material>rigid</material> <Contact> <Skin type="normals" multiplier="20"/> </Contact> </Probe> </Assembly> }}} |
Line 58: | Line 103: |
Once all surface meshes have been created and the probe is properly positioned, it is time to make the Connectivity xml document that the model assembly script will use to prepare the model. Here is a sample xml file. Multiplier values may need to be changed based on your model. The skin ties especially should be examined, as the skin is composed of both tri6 and quad8 elements. Febio does not support having different element types in one surface definition, so make sure the contact surface only includes tri6 elements. This also means the current All_Skin_Faces definition in the geometry file is invalid (!!!). | |
Line 60: | Line 104: |
<Assembly> <Bone> <file>bone.stl</file> <material>rigid</material> <Tie> <Muscle type="proximity" multiplier=".2"/> </Tie> </Bone> <Muscle> <file>bone_muscle_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Fat type="proximity" multiplier=".2"/> <Bone type="proximity" multiplier=".2"/> </Tie> </Muscle> <Fat> <file>/bone_muscle_fat_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Muscle type="proximity" multiplier=".2"/> <Skin type="proximity" multiplier=".2"/> </Tie> </Fat> <Skin> <file>/skin.med</file> <quad/> <material>elastic</material> <Contact> <Probe type="normals" multiplier="20"/> </Contact> <Tie> <Fat type="proximity" multiplier=".2"/> </Tie> </Skin> <Probe> <file>/oriented_probe.stl</file> <material>rigid</material> <Contact> <Skin type="normals" multiplier="20"/> </Contact> </Probe> </Assembly> Converting To Febio |
==== Converting To Febio ==== Running !StlToMed.py, followed by MedToFebio.py, both of which are [[https://simtk.org/svn/multis/utl/SimulationWork/Python/Salome/|found here]], using your connectivity xml will result in generation of a febio input file and an accompanied geometry file. The input file is where simulation parameters can be edited, while the geometry file contains element and surface definitions as a separate file given the length of this file. In order to fix bad wedge elements, run BadFebioWedges.py (!!!). Note the models generated will be rather large in size, so high performance computing may be a necessity to run these files. |
Line 107: | Line 107: |
Running !StlToMed.py, followed by MedToFebio.py, both of which are found here, using your connectivity xml will result in generation of a febio input file and an accompanied geometry file. The input file is where simulation parameters can be edited, while the geometry file contains element and surface definitions as a separate file given the length of this file. In order to fix bad wedge elements, run BadFebioWedges.py (!!!). Note the models generated will be rather large in size, so high performance computing may be a necessity to run these files. Output Febio input file Febio geometry file |
=== Output === * Febio input file * Febio geometry file |
Contents
Target Outcome
Complete outline of model development process for mutli-layer tissue models for input into Febio.
Input
- Indentation and force data from in vitro experiments.
- Completed leg or arm assembly, with each individual tissue layered modeled separately.
Procedures
Creation of Model Assembly
Creating Surface Representations
This process is overall similar to development of lumped tissue models, but has more steps given the relative increase in model complexity.
Starting with Image Segmentation of separate tissues, generate 4 different stl files. The 3 key files are the bone by itself, the bone merged with the muscle, and finally the bone merged with the muscle and fat. The fourth file includes the merged skin layer, and is only used to test the assumption that extruding a constant thickness is a reasonable assumption. The final stl consisting of the bone_muscle_fat should be cut ~5 slices on both ends relative to the muscle_fat layer. This procedure can be done by joining the individual layers into a single block, which can be done in Slicer by using the Editor. Within the Editor, the Change Label Effect makes one color of label change to another. This way different tissue layers can be joined together to create multiple "lumped" portions of the leg. Joining the bone to the lumped portions is also recommended. Use the Model Maker to generate the surface, and save all 3 parts as separate stl files.
Remeshing the Surface
Using MeshLab, individually open the stls that were generated. The goal is to remesh the surface with triangles that are approximately similar in size at the desired mesh density. This process should be done for each of the stls.
First use Poisson Reconstruction. This does not produce the even triangle size that is desired, but the resulting surface can then be isoparameterized itself. Sometimes this reconstruction may produce undesirable results. Switching the octree depth and solver divide to 7 tends to give better results over the default settings. Detailed instructions on Poisson Reconstruction can be found here.
MeshLab's Iso Parameterization does an excellent job of remeshing, but it is very fickle and may crash MeshLab. It is recommended to save before attempting. Increasing the convergence precision (to 3 or 5) and toggling the double step parameter can sometimes fix crashing. Different poisson reconstruction settings might also fix crashes. Detailed instructions on Iso Parameterizing can be found here.
The next step is to remesh the iso parameterized model. A sample rate of 5 was primarily used for quad models as per our mesh convergence study. The bone model is meshed at a sample rate (i.e. 8) typically.
When isoparmeterization has been completed, it is often useful to use Taubin Smoothing before saving the reconstructed mesh. Default parameters are usually employed for this. Ensure the mesh is manifold.
Creating the Skin Layer
The skin layer was not generated originally because its small thickness would often result in the fat layer cutting through it. As such, the skin is generated by extruding the fat stl with a series of python scripts. Starting with your meshed bone_muscle_fat stl file, first run the python script SliceStl.py found here. This might be better with my blender script (!!!). This script removes the ends of the fat stl file. To get around Febio compatibility issues, open the newly created file in Meshlab and force flip all the face normals, so that all normals now point inward. The file is then extruded a negative distance with ExtrudeMesh.py found here. A constant extrusion length can be considered a reasonable assumption after viewing the distribution of skin thickness for each model with the script SkinThickness.py found here. Note that in order to run this you will have to run SliceStl.py on your bone_muscle_fat raw stl and on the bone_muscle_fat_skin raw stl.
Cutting the Mesh
When the surfaces were created, every internal layer was included for each part. This was to allow the internal layer to be cut from the subsequent external layer, ensuring a perfect fit at each interface. If this was not done the remeshing and smoothing steps will have created a small, but noticeable amount of overlap. Cutting the bone_muscle file with the bone stl file and cutting the bone_muscle_fat file with the bone_muscle file will prevent this issue.
This step can be accomplished with either of 2 scripts. The best option is to use the Python script bpy_CutStlWithStl.py found here. If blender or python3 are not readily available, this can also be accomplished by using the Python script CutStlWithStl.py found here. The blender script is preferable because it is better at mesh generation at the cut site, as the vtk script will sometimes generate intersecting triangles that need to be manually fixed. Use Meshlabs Filter>Selection>Select Self Intersecting Faces to visualize and fix them. Note that this filter frequently reports false positives, so only spend time fixing triangles that actually are problematic. After this step, you should have meshed surface representations of the bone, muscle and fat layers that fit perfectly with each other, as well as a skin mesh of wedge elements.
Placement of the ultrasound probe
The probe Stls can be found at https://simtk.org/svn/multis/app/Registration/Probe%20STLS/
Once you have a local copy you can use the script initial_probe_positions.py found here.
In addition to the stl you will need the registration xml for the model you are using, it will be named something like CMULTIS008-1_UL_US_CT.xml for the upperleg of specimen 008.
The probe often overlaps too much with the model, so it can be manually moved in meshlab, or with the Python script Probe_Overlap_Transform.py found here if you are trying to replicate the experimental data.
Model Assembly
Once all surface meshes have been created and the probe is properly positioned, it is time to make the Connectivity xml document that the model assembly script will use to prepare the model. Here is a sample xml file. Multiplier values may need to be changed based on your model. The skin ties especially should be examined, as the skin is composed of both tri6 and quad8 elements. Febio does not support having different element types in one surface definition, so make sure the contact surface only includes tri6 elements. This also means the current All_Skin_Faces definition in the geometry file is invalid (!!!).
<Assembly> <Bone> <file>bone.stl</file> <material>rigid</material> <Tie> <Muscle type="proximity" multiplier=".2"/> </Tie> </Bone> <Muscle> <file>bone_muscle_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Fat type="proximity" multiplier=".2"/> <Bone type="proximity" multiplier=".2"/> </Tie> </Muscle> <Fat> <file>/bone_muscle_fat_Blender_Cut.stl</file> <quad/> <material>elastic</material> <Tie> <Muscle type="proximity" multiplier=".2"/> <Skin type="proximity" multiplier=".2"/> </Tie> </Fat> <Skin> <file>/skin.med</file> <quad/> <material>elastic</material> <Contact> <Probe type="normals" multiplier="20"/> </Contact> <Tie> <Fat type="proximity" multiplier=".2"/> </Tie> </Skin> <Probe> <file>/oriented_probe.stl</file> <material>rigid</material> <Contact> <Skin type="normals" multiplier="20"/> </Contact> </Probe> </Assembly>
Converting To Febio
Running StlToMed.py, followed by MedToFebio.py, both of which are found here, using your connectivity xml will result in generation of a febio input file and an accompanied geometry file. The input file is where simulation parameters can be edited, while the geometry file contains element and surface definitions as a separate file given the length of this file. In order to fix bad wedge elements, run BadFebioWedges.py (!!!). Note the models generated will be rather large in size, so high performance computing may be a necessity to run these files.
Output
- Febio input file
- Febio geometry file