Documentation/4.2/Modules/Models

From SlicerWiki
Jump to: navigation, search
Home < Documentation < 4.2 < Modules < Models

For the latest Slicer documentation, visit the 4.6 page.


Introduction and Acknowledgements


Information on NA-MIC can be obtained from the NA-MIC website.
Author: Nicole Aucoin, SPL
Contact: Contact: Nicole Aucoin,

Surgical Planning Laboratory (SPL)  
National Alliance for Medical Image Computing (NA-MIC)  
Neuroimage Analysis Center (NAC)  

Module Description

This module is used for changing the appearance of and organizing 3d surface models.


Use Cases

Examples:
  • Use Case 1: Manipulating the appearance of the surface models that are part of anatomical atlases, for example one found in the SPL/PNL Brain Atlas or the SPL Knee Atlas.
    • turning visibility on or off for individual structure (e.g. turn the skin off)
    • change the color, opacity, and "shininess" of a structure (e.g. make the skin appear semitransparent)
    • drag and drop interface to organize models into hierarchical groups (e.g. lateral ventricles, third and fourth ventricles of the brain under the name ventricles of the brain). These groups can be turned on and off by manipulating the parent.
  • Use Case 2: Adjusting the appearance of surface models generated from the Model Maker module
Knee Atlas Models

Tutorials

Panels and their use

A list of all the panels in the interface, their features, what they mean, and how to use them.

ModelsModule-2011-11-25.png
Model Hierarchy
Model Information
Model Display Properties
Model Clipping Properties

Parameters:

  • Scene
    • Scene tree view: The tree view of all models and model hierarchies in the current MRML scene. You can right click on the Scene element to add hierarchies and drag and drop models into them. Control the Visible property of the model via the eye icon (open/close to show/hide the models). The model color and opacity are also displayed on the same line as the model name. Model hierarchies allow you to group together models. When using the ModelMaker module, multiple models created from one label map are grouped under a model hierarchy node.
  • Information Panel
    • Information: Information about this surface model
    • Surface Area: The calculated surface area of the model, in square millimetres
    • Volume: The volume inside the surface model, in cubed millimetres
    • Number of Points: Number of vertices in the surface model
    • Number of Cells: Number of cells in the surface model
    • Number of Point Scalars: Shows how many arrays of scalars are associated with the points of the surface model.
    • Number of Cell Scalars: Shows how many arrays of scalars are associated with the cells of the surface model.
    • Filename: Path to the file which this surface model was loaded from/saved to
  • Display
    • Visible: Is this surface model visible in the 3D view?
    • Selected: If this model is selected, it's visual appearance will change.
    • Clip: Is clipping (using the slice planes) enabled for this model? Once it is on, go to the Clipping pane to set the options.
    • Slice Intersections Visible: If this flag is set, the intersections of the model with the slices will be computed and shown as an outline on the slice planes.
    • Material Properties: Material properties of the currently selected model
    • Scalars: Scalar overlay properties
    • Clipping: Control the clipping properties for this surface model
  • Material Properties Panel
    • Material Properties: Material properties of the currently selected model
    • Color: The RGBA color of this model
    • Opacity: The object's opacity. 1.0 is totally opaque and 0.0 is completely transparent. Note: only one model at a time can be correctly rendered with less than 100% opacity. This is a not a Slicer limitation, it's a property hardware accelerated 3D graphics.
    • Ambient: Controls the base lighting for the model.
    • Diffuse: Controls the amount of light scattered from the model.
    • Specular: Controls the highlights on the model.
    • Power: The specular power.
    • Backface Culling: Backface culling is turned on by default. This means that all the faces pointing away from the view point of the camera, are not rendered. This feature needs to be turned off if the inside of a model is viewed, either when clipping or when moving the camera inside an object.
    • Preview: A rendering of a sphere using the current material properties, useful if the surface model isn't regular.
    • Presets: A set of buttons allowing the user to select a new material properties from a set of defaults.
  • Scalars
    • Scalars panel: Scalar overlay properties
    • Visible: Are the scalars visible on the surface model?
    • Active Scalar: A drop down menu listing the current scalar overlays associated with this model and shows which one is currently active. Most models will have normals, Freesurfer surface models can have multiple scalar overlay files associated with them (e.g. lh.sulc, lh.curv).
    • Color Table: Select a color look up table used to map the scalar overlay's values (usually in the range of 0.0 to 1.0) to colors. There are built in color maps that can be browsed in the Colors module. The most commonly used color map for FreeSurfer scalar overlays is the GreenRed one. Legacy color maps from Slicer2 include Grey, Iron, Rainbow, etc. Those color maps with "labels" in their names are usually discrete and don't work well for the continuous scalar overlay ranges.
  • Clipping Panel
    • Clipping: Control the clipping properties for this surface model
    • Clipping Type: When more than one slice plane is used, this option controls if it's the union or intersection of the positive and/or negative spaces that is used to clip the model.
    • Red Slice Clipping: Control on which side of the red slice plane is clipped on the model
    • Yellow Slice Clipping: Control on which side of the yellow slice plane is clipped on the model
    • Green Slice Clipping: Control on which side of the green slice plane is clipped on the model


Similar Modules

  • The Annotations module uses geometry to mark locations and so has similar functionality to the models module.
  • The Probe Volume With Model module allows a user to apply a scalar overlay to a model by sampling a volume.
  • The Merge Models module will allow you to create a single model from two models

References

N/A

Information for Developers


Create a model node with a polydata

Recommended: Using Models module dependency Advanced: Prone to obsolescence, errors and memory leaks
vtkSlicerModelsLogic* modelsLogic = 
  vtkSlicerModelsLogic::SafeDownCast(modelsModule->logic());
vtkMRMLModelNode* modelNode =
  modelsLogic->AddModel(polyData /*or polyDataAlgorithm->GetOutput()*/);
vtkNew<vtkMRMLModelNode> modelNode;
modelNode->SetAndObservePolyData(polyData /*or polyDataAlgorithm->GetOutput()*/);
mrmlScene->AddNode(modelNode.GetPointer());

vtkNew<vtkMRMLModelDisplayNode> modelDisplayNode;
mrmlScene->AddNode(modelDisplayNode.GetPointer());
modelNode->SetAndObserveDisplayNodeID(modelDisplayNode->GetID());

Multiple models

It's possible to have multiple models combined into one model and have each shape assigned different color values, but it requires either using Merge Models to merge the shapes into one file and using python to create a scalar overlay to assign values to each vertex (assuming the user can determine which vertex belongs to which shape), or using Paraview, as per Andras Lasso:

Merge multiple STL files into a single colored VTK file in Paraview:

  • Load all the models
  • Assign a constant scalar to the points by using the Calculator filter (use a different constant for each model, e.g., 1, 2, 3, 4, ...)
  • Merge the Calculator outputs with the Append Geometry filter
  • Save the Append Geometry filter output with File / Save Data / File type VTK or VTP (download the sample ParaView state file from here)

Then in Slicer you can load the model, open the Models module, open Scalars, enable "Visible", select "Result" as active scalar, select a color table.