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

From Slicer Wiki
Jump to: navigation, search
(Prepend documentation/versioncheck template. See http://na-mic.org/Mantis/view.php?id=2887)
(Replaced content with "<noinclude>{{documentation/versioncheck}} </noinclude> {{documentation/banner | text = [https://slicer.readthedocs.io/en/latest/user_guide/modules/volumerendering.html T...")
Tags: 2017 source edit, Replaced
 
(11 intermediate revisions by 4 users not shown)
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/volumerendering.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|kitware}}|{{collaborator|longname|kitware}}
 
|{{collaborator|logo|isomics}}|{{collaborator|longname|isomics}}
 
|{{collaborator|logo|spl}}|{{collaborator|longname|spl}}
 
|{{collaborator|logo|namic}}|{{collaborator|longname|namic}}
 
}}
 
{{documentation/{{documentation/version}}/module-introduction-end}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Module Description}}
 
{{documentation/{{documentation/version}}/module-description}}
 
Only UNSIGNED CHAR images are supported for now. You can convert your images into UCHAR by using the [[Documentation/{{documentation/version}}/Modules/CastScalarVolume|Cast Scalar Volume]] module.
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Use Cases}}
 
<gallery widths="200px" perrow="4">
 
Image:Tumor-Volume-Rendering-PostGad-2011.png|Tumor post pad <br><small>(preset: MR-Default)</small>
 
Image:Modules-VolumeRendering-LabelMap.png|Segmented (labelmap) knee<br><small>(interpolation: nearest neighbor, shading: off)</small>
 
Image:QSlicerVolumeRendering-default.png|Default view of the module.<br><small>Inputs and Advanced... are hidden by default</small>
 
Image:VolumeRenderingSettings.png|Volume Rendering settings<br><small>''Edit -> Application Settings -> Volume Rendering settings''</small>
 
</gallery>
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Tutorials}}
 
 
 
Tutorial about [http://www.slicer.org/slicerWiki/index.php/Slicer3:Volume_Rendering_Tutorials using the volume rendering module].
 
 
 
===Labelmap rendering===
 
[[File:Modules-VolumeRendering-LabelMap.png|right|500px]]
 
A labelmap is a volume, and as such it can be visualized using the Volume Rendering method. It can be an alternative from [[Documentation/{{documentation/version}}/Modules/ModelMaker|creating surface models]] from labelmap.
 
# First you need to load your labelmap.
 
## Make sure you check the "Labelmap" check box at load time.
 
## Make sure the labelmap is a Unsigned Char image, not Unsigned/Signed Short, Int or Long. If needed, you can [[Documentation/{{documentation/version}}/Modules/CastScalarVolume| cast]] the labelmap to UCHAR.
 
# Open the Volume Rendering module
 
## As usual, click on the eye to start the Volume Rendering.
 
# To turn off shading:
 
## go to Advanced../Volume Properties/Advanced group box and uncheck the "Shade" checkbox
 
# To turn on/off a specific label:
 
## Go to the Advanced.../Volume Properties/Scalar Opacity Mapping group box
 
## Toggle down the '>>' button to show the Opacity controls.
 
## Browse each label with the "Point:" spinbox. When the spinbox shows the current label value,
 
## Set the Opacity spinbox value to 0.0/1.0 to hide/show the label.
 
 
 
===Render 2 volumes in 2 views===
 
[[File:DualVR.png|right|500px]]
 
# [[Documentation/{{documentation/version}}/SlicerApplication/MainApplicationGUI#Layouts|Change layout]] into "Dual 3D"
 
# [[Documentation/{{documentation/version}}/SlicerApplication/LoadingData|Load]] your 2 volumes
 
# [[Documentation/{{documentation/version}}/SlicerApplication/MainApplicationGUI#Module_Selection_.26_Navigation|Open]] Volume Rendering module
 
# For the first volume:
 
## Open the "Inputs" section
 
## Uncheck "View2" -> only "View1" is checked
 
## Don't click the "eye" icon yet.
 
# Select the 2nd volume
 
## Check "View2"
 
## Uncheck "View1" -> only "View2" is checked
 
## Click the eye icon for the VR to show up in View2
 
# Select the 1st volume
 
## Click the eye icon for the VR to show up in View1
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Panels and their use}}
 
[[File:VolumeRenderingPanel.png|right|]]
 
{{documentation/{{documentation/version}}/module-parametersdescription}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Similar Modules}}
 
[[Documentation/{{documentation/version}}/Modules/Volumes|Volumes]]
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|References}}
 
Publications related to this module go here. Links to pdfs would be useful.
 
For extensions: link to the source code repository and additional documentation
 
 
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Information for Developers}}
 
===Limitations===
 
*To date, only 1 volume can be visible at a time. This happens because the current volume rendering displayable node is hidden when changing to a different volume node.
 
*Only UNSIGNED CHAR images are supported for now. You can convert your images into UCHAR by using the [[Documentation/{{documentation/version}}/Modules/CastScalarVolume|Cast Scalar Volume]] module.
 
 
 
===Key [[Documentation/{{documentation/version}}/Developers/MRML|nodes]] and classes===
 
* [http://slicer.org/doc/html/classvtkMRMLVolumeRenderingDisplayNode.html vtkMRMLVolumeRenderingDisplayNode] controls the volume rendering properties. Each volume rendering technique has its own subclass.
 
* [http://slicer.org/doc/html/classvtkSlicerVolumeRenderingLogic.html vtkSlicerVolumeRenderingLogic] contains utility functions
 
* [http://slicer.org/doc/html/classvtkMRMLScalarVolumeNode.html vtkMRMLScalarVolumeNode] contains the volume itself
 
* [http://slicer.org/doc/html/classvtkMRMLVolumePropertyNode.html vtkMRMLVolumePropertyNode] points to the transfer functions
 
* [http://slicer.org/doc/html/classvtkMRMLAnnotationROINode.html vtkMRMLAnnotationROINode] controls the clipping planes
 
* [http://slicer.org/doc/html/classvtkMRMLVolumeRenderingDisplayableManager.html vtkMRMLVolumeRenderingDisplayableManager] adds the volume renderings into the views
 
 
 
===How Tos===
 
*How to programmatically volume render your volume node?
 
{|width = "100%"
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|C++
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|Python
 
|-
 
| valign="top" |
 
qSlicerAbstractCoreModule* volumeRenderingModule =
 
  qSlicerCoreApplication::application()->moduleManager()->module("VolumeRendering");
 
vtkSlicerVolumesLogic* volumeRenderingLogic =
 
  volumeRenderingModule ? vtkSlicerVolumesLogic::SafeDownCast(volumesModule->logic()) : 0;
 
vtkMRMLVolumeNode* volumeNode = mrmlScene->GetNodeByID('vtkMRMLScalarVolumeNode1');
 
if (volumeRenderingLogic)
 
  {
 
  vtkMRMLVolumeRenderingDisplayNode* displayNode =
 
    volumeRenderingLogic->CreateVolumeRenderingDisplayNode();
 
  mrmlScene->AddNode(displayNode);
 
  displayNode->Delete();
 
  volumeRenderingLogic->UpdateDisplayNodeFromVolumeNode(displayNode, volumeNode);
 
  volumeNode->AddAndObserveDisplayNodeID(displayNode->GetID());
 
  }
 
See [[Documentation/{{documentation/version}}/Developers/Tutorials/CreateLoadableModule#Dependency_between_modules|here]] for more about volume dependency.
 
| valign="top" |
 
>>> logic = slicer.modules.volumerendering.logic()
 
>>> volumeNode = slicer.mrmlScene.GetNodeByID('vtkMRMLScalarVolumeNode1')
 
>>> displayNode = logic.CreateVolumeRenderingDisplayNode()
 
>>> slicer.mrmlScene.AddNode(displayNode)
 
>>> displayNode.UnRegister(logic)
 
>>> logic.UpdateDisplayNodeFromVolumeNode(displayNode, volumeNode)
 
>>> volumeNode.AddAndObserveDisplayNodeID(displayNode.GetID())
 
|}
 
 
 
*How to programmatically apply a custom color/opacity transfer function?
 
{|width = "100%"
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|C++
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|Python
 
|-
 
| valign="top" |
 
vtkColorTransferFunction* colors = ...
 
vtkPiecewiseFunction* opacities = ...
 
vtkMRMLVolumeRenderingDisplayNode* displayNode = ...
 
vtkMRMLVolumePropertyNode* propertyNode = displayNode->GetVolumePropertyNode();
 
propertyNode->SetColor(colorTransferFunction);
 
propertyNode->SetScalarOpacity(opacities);
 
// optionally set the gradients opacities with SetGradientOpacity
 
The logic has utility functions to help you create those transfer functions:
 
volumeRenderingLogic->[http://slicer.org/doc/html/classvtkSlicerVolumeRenderingLogic.html#ab8dbda38ad81b39b445b01e1bf8c7a86 SetWindowLevelToVolumeProp](...)
 
volumeRenderingLogic->[http://slicer.org/doc/html/classvtkSlicerVolumeRenderingLogic.html#a1dcbe614493f3cbb9aa50c68a64764ca SetThresholdToVolumeProp](...)
 
volumeRenderingLogic->[http://slicer.org/doc/html/classvtkSlicerVolumeRenderingLogic.html#a359314889c2b386fd4c3ffe5414522da SetLabelMapToVolumeProp](...)
 
| valign="top" |
 
>>> propertyNode = displayNode.GetVolumePropertyNode()
 
>>> ...
 
|}
 
 
 
*How to programmatically limit volume rendering to a subset of the volume?
 
{|width = "100%"
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|C++
 
! style="border-bottom: 1px solid darkgrey;font-size: 75%;"|Python
 
|-
 
| valign="top" |
 
[http://slicer.org/doc/html/classvtkMRMLAnnotationROINode.html vtkMRMLAnnotationROINode]* roiNode =...
 
vtkMRMLVolumeRenderingDisplayNode* displayNode = ...
 
displayNode->SetAndObserveROINodeID(roiNode->GetID());
 
displayNode->SetCroppingEnabled(1);
 
| valign="top" |
 
>>> displayNode.SetAndObserveROINodeID(roiNode.GetID())
 
>>> displayNode.CroppingEnabled = 1
 
|}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-footer}}
 
<!-- ---------------------------- -->
 

Latest revision as of 04:48, 19 August 2020

Home < Documentation < Nightly < Modules < VolumeRendering