MITK - GEnerate Models

MITK-GEM is a free open-source software pipeline to generate finite element models from image data. MITK-GEM is built on top of the Medical Imaging Interaction Toolkit (MITK) Workbench.

Features

MITK-GEM implements all its features as plugins for the Medical Imaging Interaction Toolkit (MITK) Workbench. It expands the MITK Workbench by offering a finite element model generation workflow with the following steps:

The complete workflow going from MITK-GEM to Ansys is demonstrated by extracting the proximal femur from a CT image and simulating a sideways fall.

Application overview

Workbench overview

  1. The Data ManagerIcon DataManager Plugincontains all loaded data (images, surfaces, meshes) as well as the results produced by the plugins. You can save your results from here by right clicking on them and selecting save.
  2. The toolbar containing all available plugins. Open a plugin by clicking on it.
  3. The view of the currently opened plugin.

Tutorials

MITK-GEM to Ansys

This clip illustrates the generation of a Finite Element Model of a proximal human femur based on a CT image data. To re-create these results you need:

  1. CT image input_cropped.nrrd.
  2. MITK-GEM to generate a volumetric mesh with material properties from a CT image.
  3. Matlab conversion script WriteAnsysInput.m to convert volumetric mesh to Ansys input files.
  4. Ansys to run the FE analysis.

All outputs generated are available here.

The CT dataset does not contain a calibration phantom. Hounsfield unit values for different mgHA/cm3 densities entered are estimates and provide an approximate apparent bone density calibration only.

The clip demonstrates a method for assessing whole bone femoral strength in a sideways fall loading configuration based on linear elastic analysis and principal strain thresholds inspired by Bayraktar et al., JBM 37:27-35, 2004 and Schileo et al., JBM 47:3531-3538, 2014. It lacks validation, both against in-vitro strength measurements and cohort databases.

RESULTS FROM THIS MODEL CANNOT BE USED FOR DIAGNOSING, PREVENTING OR TREATING DISEASE.

Graphcut segmentation

  1. Open the image you want to segment.
  2. Switch to the Segmentation PluginIcon Segmentation Pluginand create a new mask for the background.
  3. Pick the Paint Tool and set a brush size.
  4. Mark the area that you consider background. Doing this on one slice should be sufficient.
  5. Repeat for foreground.
  6. Switch to the GraphCut3D PluginIcon GraphCut Plugin.
  7. Check that all images are set correctly and adjust the parameters to your needs.
  8. Click the 'Start' button and wait for it to finish.
  9. Once finished, a new segmentation called 'graphcut segmentation' will appear in the Data ManagerIcon DataManager Plugin. You can right click it to save it on your disk or proceed with the surface mesh generation.

Surface mesh generation

The Surface Mesher allows the conversion of binary masks to surface meshes using a marching cubes algorithm. A binary mask is an image with background values of 0 and foreground values of 255.

Screenshot surface mesh plugin
  1. Select a mask in the Data ManagerIcon DataManager Plugin.
  2. The mask will get passed down through all the steps represented by the group boxes: Median filter -> Gaussian smoothing -> Marching cubes -> Polygon smoothing. You can enable or disable a step by clicking the checkbox next to its title.
  3. Adjust the settings to match your requirements. The default settings should give accurate results in most cases.
  4. After pressing the "Generate surface" button, the mask will get processed and the resulting surface will be added to your Data ManagerIcon DataManager Plugin.

Note: To generate a closed surface, make sure the mask does not extend to the border of the image. You can use the padding pluginIcon Padding Pluginto add empty slices.

Tetrahedral mesh generation

Using the Volume Mesher plugin, you can create volumetric (10-node tetrahedral) meshes from surfaces. The meshing is done by either tetgen or CGAL. The results are represented as unstructured grids (.vtu).

Visualization of unstructured grids is currently disabled. To inspect the results, you can enable visualization with the UG Visualization PluginIcon UG Visualization Plugin or use a tool such as paraview.

Screenshot volume mesh generation with tetgen Screenshot volume mesh generation with CGAL

  1. Load a surface mesh and select it with the drop down box. Make sure the surface is closed.
  2. Since the volume mesher is a front end to either tetgen or CGAL, the settings directly correspond to the ones available in tetgen.
  3. Press "Generate tetrahedral mesh" to start the process. The resulting unstructured grid will be stored in the Data ManagerIcon DataManager Plugin.

Material mapping

The material mapping plugin is used to assign material properties to a volume mesh from image voxel values. The plugin determines for each node in a volumetric mesh the corresponding gray scale value in the image. Through a series of conversion steps, gray scale values in Hounsfield units are converted to bone density and finally to elastic modulus using a power law. The plugin supports this workflow and produces a volumetric mesh represented as an unstructured grid (.vtu) with elastic modulus assigned to each node and element. The unstructured grid can subsequently be converted to FE solver compatible formats using conversion scripts (examples provided). For more information refer to our paper.

Screenshot bone density calibration
  1. Load an unstructured grid and a grayscale image and select them with the drop down boxes.
  2. Enter the bone density calibration values for your phantom into the table. The calibration unit can be set using the dropdown box.
    To obtain calibrator values, use the Measurement PluginIcon Measurement Plugin to select a 2D region with in the calibrator and the Statistics Plugin Icon Statistics Plugin to determine the corresponding average value. Repeat for multiple slices along the calibrator and calculate average. Alternatively, a full segmentation in 3D of the calibrator with the can be obtained with the Segmentation Plugin Icon Segmentation Plugin and the average value can be obtained by selecting image and calibrator mask and enabling the Statistics plugin.
    If you already know your equation for Bone density ρ, you can disable the calibration using the "Phantom calibration for ρ_ct" checkbox and enter it directly below.
  3. Note that after the calibration all steps will use gHA/cm³ regardless of your chosen calibration unit! Conversion happens automatically if necessary.
Screenshot bone density calibration 2
  1. A linear equation for bone mineral density ρ_ct will get fitted to your calibration using a least squares fitting technique.
  2. The final bone density value ρ_app used for further steps is obtained in 3 steps as reported in the literature: (1) HU -> ρ_ct (2) ρ_ct -> ρ_ash (3) ρ_ash -> ρ_app.
Screenshot bone density calibration 3
  1. Specify the power laws that should be applied to your bone density.
  2. Using the "add" button, you can add additional power laws with a corresponding interval.
  3. Press the "Start" button to start the material mapping. The resulting unstructured grid will have an additional point and cell array containing the material properties.
  4. Save the unstructured grid as .txt or .vtu (right click in data manager -> save as).
  5. Convert the unstructured grid (.txt) to the FE model format of your choice. Some converter scripts are provided here.

Frequently Asked Questions

No, MITK-GEM is for research only.

Yes, MITK-GEM is released under the GPLv3 license and you may use it under these terms. If you do use it, please cite the paper.

MITK-GEM as a tool is released under the GPLv3 license. However, the plugins are individually licensed and may be used under these conditions separately:

  • Material Mapping: BSD 3-Clause License.
  • Surface Mesher: BSD 3-Clause License
  • Resample Plugin: BSD 3-Clause License
  • Padding Plugin: BSD 3-Clause License
  • GraphCut3D: GPLv3 because of the used library maxflow.
  • Volume Mesher: GPLv3 beaucse of the used library tetgen.
For more details, see the LICENSE.txt in the respective plugins source code folder.

On linux, the enviroment variable QT_PLUGIN_PATH has to be set to point to the Qt5 plugins directory in order to start MITK-GEM. Example:

bash:~/$ export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins
                                

The material mapping plugin allows you to export the current parametrization to a .matmap file. The file uses the XML markup language and can be opened with any text editor. An example of a .matmap file is given below.

<?xml version="1.0" encoding="utf-8" ?>
<MaterialMapping Version="2016.2">
    <Calibration unit="mgHA/cm³">
        <DataPoint HU="1.79" rho="0" />
        <DataPoint HU="88.200000000000003" rho="75" />
        <DataPoint HU="174.360000000000014" rho="150" />
    </Calibration>
    <BoneDensityParameters>
        <RhoCT AutomaticFit="1" slope="0" offset="0" />
        <RhoAsh enabled="1" offset="0" divisor="1" />
        <RhoApp enabled="1" divisor="0" />
    </BoneDensityParameters>
    <PowerLaws>
        <PowerLawParameters factor="1" exponent="1" offset="0" rangeMin="-3.40282346638529e+38" rangeMax="0" />
        <PowerLawParameters factor="6850" exponent="1.49" offset="0" rangeMin="0" rangeMax="-3.40282346638529e+38" />
    </PowerLaws>
    <Options doPeel="1" numberOfExtends="3" minValue="0" />
</MaterialMapping>
                                

Yes, you can provide a partially defined .matmap file including only the calibration element:

<?xml version="1.0" encoding="utf-8" ?>
<MaterialMapping Version="2016.2">
    <Calibration unit="mgHA/cm³">
        <DataPoint HU="1.79" rho="0" />
        <DataPoint HU="88.200000000000003" rho="75" />
        <DataPoint HU="174.360000000000014" rho="150" />
    </Calibration>
</MaterialMapping>
                                

The graphcut algorithm requires large amounts of memory to build the necessary graph. This field tells you exactly how much memory the graph and the image data will allocate. It is highly recommended that you have at least this much free memory before starting the computation. If you do not have enough memory, see FAQ Section "I have less memory than 'Required memory'" for workarounds.

Not having enough memory will increase the computation time drastically and can even result in a crash of the application. Options at this point are:

  • Crop the image to only contain the region of interest with the included image cropper pluginIcon Crop Plugin.
  • Downsample the image using the included resample pluginIcon Resample Plugin.
  • Create all the masks in the MITK Workbench and save them to your harddisk, then use the Command Line Segmentation Tool to do the computation. The CLI Tool is more memory efficient and is able to complete computations that the plugin can not. However, the computation times will still be very long.

The 'estimated time' is based on test results on one of our machines. Depending on your hardware, your results may vary. Especially if your machine is not able to store the complete graph in memory, the computation time will increase dramatically.

This is a problem when the plugin tries to allocate more memory than your machine can handle. Please refer to the FAQ section "I have less memory than 'Required memory'" for information on how to decrease the memory usage.

The standalone application uses a command line interface (CLI) instead of a graphical user interface. Usage requires basic knowledge of your operating systems terminal enviroment.

  1. Download the Segmentation Tool
  2. Unzip the downloaded archive into a folder
  3. Start a terminal and navigate to the unziped folder
  4. Perform a graph-cut segmentation on the included data:
$ ./GraphCutSegmentation data/input.mhd data/foreground.mhd data/background.mhd data/output.mhd 50 0 1 
You can get additional information about the usage of the program by typing:
$ ./GraphCutSegmentation --help

Required: image foreground background output sigma boundaryDirection
image:               3D image in Hounsfield Units -1024 to 3071
foreground:          3D image non-zero pixels indicating foreground and 0 elsewhere
background:          3D image non-zero pixels indicating background and 0 elsewhere
output:              3D image resulting segmentation
sigma:               estimated noise in boundary term, try 50.0
boundaryDirection:   0->bidirectional; 1->bright to dark; 2->dark to bright

There's a seperate FAQ for building over here.

This error occurs on systems with a installed QT version older than 4.8. Please update your QT version.

You have to open the plugins by clicking on their icons: Icon GraphCut Plugin and Icon Segmentation Plugin.

Workbench overview

Because the surface mesher pluginIcon SurfaceMesh Plugin uses the marching cubes algorithm, it produces open meshes when the mask extends to the border of the image. One way to work around this is to add an empty slice using the padding pluginIcon Padding Plugin.

About

For further information and contact details please refer to our simtk project.