Difference between revisions of "Documentation/Nightly/Modules/Models"

From Slicer Wiki
Jump to: navigation, search
m (Text replacement - "\[http:\/\/wiki\.slicer\.org\/slicerWiki\/index\.php\/([^ ]+) ([^]]+)]" to "$2")
(moved to readthedocs)
Tags: 2017 source edit, Replaced
 
Line 1: Line 1:
 
<noinclude>{{documentation/versioncheck}}</noinclude>
 
<noinclude>{{documentation/versioncheck}}</noinclude>
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-header}}
 
<!-- ---------------------------- -->
 
  
<!-- ---------------------------- -->
+
{{documentation/banner
{{documentation/{{documentation/version}}/module-section|Introduction and Acknowledgements}}
+
| text  = [https://slicer.readthedocs.io/en/latest/user_guide/modules/models.html This page has been moved to read-the-docs.]
{{documentation/{{documentation/version}}/module-introduction-start|{{documentation/modulename}} }}
+
| background-color = 8FBC8F }}
{{documentation/{{documentation/version}}/module-introduction-row}}
 
{{documentation/{{documentation/version}}/module-acknowledgements}}
 
:'''Contact:''' Julien Finet, <email>julien.finet@kitware.com</email><br>
 
{{documentation/{{documentation/version}}/module-introduction-row}}
 
{{documentation/{{documentation/version}}/module-introduction-logo-gallery
 
|{{collaborator|logo|spl}}|{{collaborator|longname|spl}}
 
|{{collaborator|logo|kitware}}|{{collaborator|longname|kitware}}
 
|{{collaborator|logo|namic}}|{{collaborator|longname|namic}}
 
|{{collaborator|logo|nac}}|{{collaborator|longname|nac}}
 
}}
 
{{documentation/{{documentation/version}}/module-introduction-end}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Module Description}}
 
{{documentation/{{documentation/version}}/module-description}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Use Cases}}
 
{|
 
[[File:Slicer43-Models-KneeAtlas.jpeg|right|300px|Knee Atlas Models]]
 
* Manipulating the appearance of the surface models that are part of anatomical atlases, for example one found in the [http://www.slicer.org/pages/Special:PubDB_View?dspaceid=1265 SPL/PNL Brain Atlas] or the [http://www.slicer.org/publications/item/view/1953 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.
 
* Adjusting the appearance of surface models generated from the ModelMaker module
 
|}
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Tutorials}}
 
 
 
* Tutorial about [[Documentation/4.5/Training#Slicer4_Data_Loading_and_3D_Visualization|loading and viewing data]].  
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Panels and their use}}
 
 
 
A list of all the panels in the interface, their features, what they mean, and how to use them.
 
{|
 
|-
 
| [[File:Slicer43-Models-GUI.jpeg|thumb|200px]]
 
| [[File:Slicer43-Models-SceneHierarchy.jpeg|thumb|200px|Model Hierarchy]]
 
| [[File:Slicer43-Models-Information.jpeg|thumb|200px|Model Information]]
 
| [[File:QSlicerModelsModuleWidget-Display.png|thumb|200px|Model Display Properties]]
 
| [[File:Slicer4-Models-Clipping.jpeg|thumb|200px|Model Clipping Properties]]
 
|}
 
 
 
{|
 
|valign="top"|{{documentation/{{documentation/version}}/module-parametersdescription}}
 
|valign="top"|[[File:Slicer43-Models-GUI.jpeg|thumb|550px|[[Documentation/{{documentation/version}}/Modules/Models|Models]] module GUI]]
 
|}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Similar Modules}}
 
* The [[Documentation/{{documentation/version}}/Modules/Annotations|Annotations]] module uses geometry to mark locations and so has similar functionality to the models module.
 
* The [[Documentation/{{documentation/version}}/Modules/ProbeVolumeWithModel|Probe Volume With Model]] module allows a user to apply a scalar overlay to a model by sampling a volume.
 
* The [[Documentation/{{documentation/version}}/Modules/MergeModels|Merge Models]] module will allow you to create a single model from two models
 
* The [[Documentation/{{documentation/version}}/Modules/ModelMaker|Model Maker]] module will allow you to create model(s) from a labelmap
 
* The [[Documentation/{{documentation/version}}/Modules/GrayscaleModelMaker|Grayscale Model Maker]] module will allow you to create a model from an image
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|References}}
 
N/A
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Information for Developers}}
 
{{documentation/{{documentation/version}}/module-developerinfo}}
 
 
 
===Create a model node with a polydata===
 
This solution works when you have a polydata that you want to render in the 3D view (and potentially in the 2D views by representing the intersection between the polydata and the view slice).
 
 
 
{|
 
! Recommended: Using Models [[Documentation/{{documentation/version}}/Developers/Tutorials/CreateLoadableModule#Dependency_between_modules|module dependency]]
 
! Advanced: Prone to obsolescence, errors and memory leaks
 
|-
 
|valign="top"|
 
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());
 
|}
 
 
 
===How to display a model node into a specific view ?===
 
See [http://slicer.org/doc/html/classvtkMRMLDisplayNode.html#a0540629027a1d1e5a1a8ce50d2f5b7b4 vtkMRMLDisplayNode::ViewNodeIDs]
 
 
 
===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 [http://slicer-users.65878.n3.nabble.com/saving-multiple-colors-Models-within-one-STL-or-VTK-tp3974004p3974701.html 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 [http://dl.dropbox.com/u/1528749/SlicerHelp/merge.pvsm 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.
 
 
 
===Missing model hierarchies in a loaded scene===
 
 
 
There was a change made in how the Models GUI displays model hierarchies, moving to respecting a hide flag on the nodes. If you have an older scene (written before 2013) loaded into a newer Slicer and the Models GUI isn't showing the model hierarchy that you know is in the scene, you can use this code snippet in the Python Interactor to update the flags. You may need to save the scene and reopen it in order for the GUI to show the updated view.
 
 
 
numNodes = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLModelHierarchyNode")
 
for h in range(numNodes):
 
  mh = slicer.mrmlScene.GetNthNodeByClass(h, "vtkMRMLModelHierarchyNode")
 
  if mh.GetNumberOfChildrenNodes() > 0:
 
  print "Showing", mh.GetName()
 
  mh.SetHideFromEditors(0)
 
  if mh.GetNumberOfChildrenNodes() == 0 and mh.GetAssociatedNodeID() != None:
 
  print "Hiding", mh.GetName()
 
  mh.SetHideFromEditors(1)
 
 
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-footer}}
 
<!-- ---------------------------- -->
 

Latest revision as of 18:25, 3 April 2022

Home < Documentation < Nightly < Modules < Models