Documentation/4.4/Modules/VolumeRendering

From Slicer Wiki
Jump to: navigation, search
Home < 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: 
 


Contact: Julien Finet, <email>julien.finet@kitware.com</email>
Kitware, Inc.  
Isomics, Inc.  
Surgical Planning Laboratory (SPL)  
National Alliance for Medical Image Computing (NA-MIC)  

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

Modules-VolumeRendering-LabelMap.png

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.

  1. First you need to load your labelmap.
    1. Make sure you check the "Labelmap" check box at load time.
    2. 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.
  2. Open the Volume Rendering module
    1. As usual, click on the eye to start the Volume Rendering.
  3. To turn off shading:
    1. go to Advanced../Volume Properties/Advanced group box and uncheck the "Shade" checkbox
  4. To turn on/off a specific label:
    1. Go to the Advanced.../Volume Properties/Scalar Opacity Mapping group box
    2. Toggle down the '>>' button to show the Opacity controls.
    3. Browse each label with the "Point:" spinbox. When the spinbox shows the current label value,
    4. Set the Opacity spinbox value to 0.0/1.0 to hide/show the label.

Render 2 volumes in 2 views

DualVR.png
  1. Change layout into "Dual 3D"
  2. Load your 2 volumes
  3. Open Volume Rendering module
  4. For the first volume:
    1. Open the "Inputs" section
    2. Uncheck "View2" -> only "View1" is checked
    3. Don't click the "eye" icon yet.
  5. Select the 2nd volume
    1. Check "View2"
    2. Uncheck "View1" -> only "View2" is checked
    3. Click the eye icon for the VR to show up in View2
  6. Select the 1st volume
    1. Click the eye icon for the VR to show up in View1

Panels and their use

VolumeRenderingPanel.png

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

Volumes

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

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()