Documentation/4.4/Modules/VolumeRendering
For the latest Slicer documentation, visit the read-the-docs. |
Introduction and Acknowledgements
:Title: :Author(s)/Contributor(s): :License: :Acknowledgements:
| |||||||||
|
Module Description
Only UNSIGNED CHAR images are supported for now. You can convert your images into UCHAR by using the Cast Scalar Volume module.
Use Cases
Tutorials
Tutorial about using the volume rendering module.
Labelmap rendering
A labelmap is a volume, and as such it can be visualized using the Volume Rendering method. It can be an alternative from 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 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
- Change layout into "Dual 3D"
- Load your 2 volumes
- 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
Panels and their use
Parameters:
() * ': ** ': *** ':
List of parameters generated transforming this XML file using this XSL file. To update the URL of the XML file, edit this page.
Similar Modules
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
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 Cast Scalar Volume module.
Key nodes and classes
- vtkMRMLVolumeRenderingDisplayNode controls the volume rendering properties. Each volume rendering technique has its own subclass.
- vtkSlicerVolumeRenderingLogic contains utility functions
- vtkMRMLScalarVolumeNode contains the volume itself
- vtkMRMLVolumePropertyNode points to the transfer functions
- vtkMRMLAnnotationROINode controls the clipping planes
- vtkMRMLVolumeRenderingDisplayableManager adds the volume renderings into the views
How Tos
- How to programmatically volume render your volume node?
C++ | Python |
---|---|
qSlicerAbstractCoreModule* volumeRenderingModule = qSlicerCoreApplication::application()->moduleManager()->module("VolumeRendering"); vtkSlicerVolumeRenderingLogic* volumeRenderingLogic = volumeRenderingModule ? vtkSlicerVolumeRenderingLogic::SafeDownCast(volumeRenderingModule->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 here for more about volume dependency. |
>>> 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?
C++ | Python |
---|---|
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->SetWindowLevelToVolumeProp(...) volumeRenderingLogic->SetThresholdToVolumeProp(...) volumeRenderingLogic->SetLabelMapToVolumeProp(...) |
>>> propertyNode = displayNode.GetVolumePropertyNode() >>> ... |
- How to programmatically limit volume rendering to a subset of the volume?
C++ | Python |
---|---|
vtkMRMLAnnotationROINode* roiNode =... vtkMRMLVolumeRenderingDisplayNode* displayNode = ... displayNode->SetAndObserveROINodeID(roiNode->GetID()); displayNode->SetCroppingEnabled(1); |
>>> displayNode.SetAndObserveROINodeID(roiNode.GetID()) >>> displayNode.CroppingEnabled = 1 |
- How to register a new Volume Rendering mapper?
You need to derive from vtkMRMLVolumeRenderingDisplayNode and register your class within vtkSlicerVolumeRenderingLogic.
C++ | Python |
---|---|
void qSlicerMyABCVolumeRenderingModule::setup() { vtkMRMLThreeDViewDisplayableManagerFactory::GetInstance()-> RegisterDisplayableManager("vtkMRMLMyABCVolumeRenderingDisplayableManager"); this->Superclass::setup(); qSlicerAbstractCoreModule* volumeRenderingModule = qSlicerCoreApplication::application()->moduleManager()->module("VolumeRendering"); if (volumeRenderingModule) { vtkNew<vtkMRMLMyABCVolumeRenderingDisplayNode> displayNode; vtkSlicerVolumeRenderingLogic* volumeRenderingLogic = vtkSlicerVolumeRenderingLogic::SafeDownCast(volumeRenderingModule->logic()); volumeRenderingLogic->RegisterRenderingMethod( "My ABC Volume Rendering", displayNode->GetClassName()); } else { qWarning() << "Volume Rendering module is not found"; } } If you want to expose control widgets for your volume rendering method, then register your widget with addRenderingMethodWidget() |