Documentation/4.5/FAQ/Models

From SlicerWiki
Jump to: navigation, search
Home < Documentation < 4.5 < FAQ < Models

For the latest Slicer documentation, visit the 4.10 page.

Models

How can I transform a model for output?

Slicer performs all operations in millimeters, and all anatomy is referenced to the patient space. When the data from from DICOM or other formats with well-defined geometry mappings, all the dimensions are handled automatically.

However some output formats, such as .stl format, do not have defined physical units, and some software will insist that data be saved with respect to units other than millimeters. In this case, you can pre-transform the data before saving using the following steps:

  1. Create a linear transform using the Transforms module
  2. Enter the conversion factor along the main diagonal of the transform matrix (i.e. if the export should be in meters rather than millimeters, then enter 0.001 in place of 1.0 along the three locations in the main diagonal).
  3. Apply the new transform to the model (it will appear much smaller now in slicer)
  4. Go to the Data module
    1. Right-click on the model
    2. Pick the Harden Transform menu item.

The model will not change size, but it will move out of the transform, meaning that the internal data points have been changed and is ready for saving.

How to create an .stl file from images?

Use the Editor module or other segmentation modules to create label maps on which you draw areas of interest on your image files. Then use the Model Maker module to create 3 dimensional geometry (models) from those label maps. When you save the models, you can change the file format to .stl. The Slicer training page has links to some tutorials that should help you get started: http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/Training

I used some other software to create .stl file and when I open it in Slicer it appears 180deg rotated / at incorrect position

Unfortunately, .stl files only store coordinate values and do not specify what coordinate system or unit is used. Applications can only make assumptions. Slicer assumes that .stl files use RAS coordinate system. Some other software (ITK, MITK, DICOM) usually stores everything in LPS coordinate system. Follow these steps to use an .stl file in Slicer that is saved in LPS coordinate sytem:

  1. Load your .stl files into Slicer => a model node will be created for each file
  2. In the Transforms module create a new transform with the name 'LpsToRas'
  3. In 'Rotation' section set 'IS' to 180 degrees - the resulting transformation matrix will be diag(-1, -1, 1, 1)
  4. Apply 'LpsToRas' transform to all loaded model nodes
  5. Harden the transform on all loaded model nodes (this actually changes the coordinate values so that if you save the model as .stl file, it will be in RAS coordinate system)