Differences between revisions 5 and 6
Revision 5 as of 2020-01-15 16:14:50
Size: 9496
Editor: ricimorrill1
Comment:
Revision 6 as of 2020-05-04 20:24:53
Size: 9927
Editor: ricimorrill1
Comment:
Deletions are marked like this. Additions are marked like this.
Line 90: Line 90:
    * The adaptive meshing scripts will run faster if cropped and re-sampled. Procedures can all be done in 3D Slicer (described below).
       * Crop Volume - create a new annotation ROI for each region (Upper and Lower) and un-check the interpolated cropping box
       * Resample Scalar Volume - use 0.45, 0.45, 5.0 for spacing with nearest neighbor interpolation.
       * Orient Scalar Volume - Select LPI orientation.

Target Outcome

Complete outline of model development process for multi-layer tissue models for input into Febio using the adaptive meshing strategy instead of the STL cutting strategy.

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

Starting with Image Segmentation of separate tissues, generate 2 different stl files. The first file is the bone merged with the muscle and fat. The second file is the bone merged with the muscle, fat, and skin layer, and is used to determine if constant skin thickness is a reasonable assumption, and then the distance to be extruded. The model consisting of the bone_muscle_fat and the bone_muscle_fat_skin should be cut at the location where segmentation of the muscle and fat ends. 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. Use the Model Maker to generate the surface, and save both parts as separate stl files.

Remeshing the Surface

Using MeshLab, open the bone_muscle_fat stl that was generated. The goal is to remesh the surface with triangles that are approximately similar in size at the desired mesh density.

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 without a dramatic increase in runtime. 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.

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 Plane_Cut_Mesh.py found here. This script removes the ends of the fat stl file. The cutting works best when the PlaneCut function is commented out, although this makes the skin volume not as smooth along the edges. The normals need to be flipped on the surface as well. 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 Plane_Cut_Mesh.py on your bone_muscle_fat raw stl and on the bone_muscle_fat_skin raw stl. The plane cut function should be uncommented, and the normal flipping should be cancelled.

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

Prior to using adaptive meshing, Surface groups must be made prior to meshing since groups will not be edited after the meshing script.

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>
        <Flesh>
                <file>/flesh.med</file>
                <quad/>
                <material>elastic</material>
                <Contact>
                        <Probe type="normals" multiplier="20"/>
                </Contact>
                <Tie>
                        <Skin type="proximity" multiplier=".2"/>
                </Tie>
        </Skin>
        <Skin>
                <file>/skin.med</file>
                <material>elastic</material>
                <Contact>
                        <Probe type="normals" multiplier="20"/>
                </Contact>
                <Tie>
                        <Flesh type="proximity" multiplier=".2"/>
                </Tie>
        </Skin>
        <Probe>
                <file>/oriented_probe.stl</file>
                <material>rigid</material>
                <Contact>
                        <Skin type="normals" multiplier="20"/>
                </Contact>
        </Probe>
</Assembly>

Creating the MED Flesh File

Running StlToMed.py. found here, using your connectivity xml will result in generation of a bone_muscle_fat (flesh) med file for the adaptive meshing script.

Running Adaptive Meshing Script

Input
  • Tetrahedral mesh of the desired segment region (includes fat, muscle, and bone) (.med format). Note: This is the MED flesh file from above.

  • Labeled (skin, fat, muscle, and bone) image from segmentation (.nii format). Use the methods explained in Image Segmentation to create the labeled image.

    • The adaptive meshing scripts will run faster if cropped and re-sampled. Procedures can all be done in 3D Slicer (described below).
      • Crop Volume - create a new annotation ROI for each region (Upper and Lower) and un-check the interpolated cropping box
      • Resample Scalar Volume - use 0.45, 0.45, 5.0 for spacing with nearest neighbor interpolation.
      • Orient Scalar Volume - Select LPI orientation.

Running the script

Note: The script is hard coded for now, but may be modified in the future once final specifications are set.

  • Script: define_groups.py (found here)

    • Usage: salome -t define_groups.py
    • Dependencies on other scripts:
      • adapt_mesh_from_image.py (found here)

    • Prior to running the script
      • Make sure your mesh has linear elements (you may convert quad elements to linear in Salome if needed)
      • Modify the directory where your mesh adaptation files are located - line 33
      • Modify the case name (this should be a directory name within the main adaptive meshing directory) - line 34
      • Modify imag_path name to reflect the labeled image (.nii) - line 41
      • Modify trgVolpath name to reflect the name of your initial mesh (.med) - line 42
        • Note that this name should end in _1.med

    • Outputs:
      • image_1.med - Med file of image mesh
      • leg_1.med - Initial med file with volume groups defined (fat, muscle, bone)
      • leg_2.med - Adapted mesh after 1 iteration with volume groups defined
      • leg_3.med - Adapted mesh after 2 iterations with volume groups defined
      • leg_4.med - Adapted mesh after 3 iterations with volume groups defined

Recreating the Skin Surface

Because the bone_muscle_fat surface triangulation changed during adaptive meshing, the skin needs to be recreated to realign the nodes of the skin and the bone_muscle_fat med file. This can be done by converting the bone_muscle_fat med file back to an stl, and doing the same procedure as detailed earlier on this file. Make sure the change the name of the skin file in the connectivity XML once generated.

Pushing to FEBio

Currently, MedtoFebio_Partition.py is used to convert the MED file into the FEBio format. The material groupings may be misnumbered and the input file needs to be edited.

Output

  • Febio input file
  • Febio geometry file

Specifications/LayeredModelDevelopment2 (last edited 2020-05-04 20:24:53 by ricimorrill1)