How can I volume render a segment ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How can I volume render a segment ?

tarun14110
This post has NOT been accepted by the mailing list yet.
Instead of creating surface, I just want to directly render the segmented volume. I am using segment editor in my module for segment. I want to display 3d volume(using volume rendering) of segment.
I tried below code.

        `logic = slicer.modules.volumerendering.logic()
        segmentationNode = getNode('Segmentation')
        displayNode = segmentationNode.GetDisplayNode()
        displayNode.SetAllSegmentsVisibility3D(False)
        segmentID = segmentationNode.GetSegmentation().GetNthSegmentID(0)
        displayNode.SetSegmentVisibility3D(segmentID, True)
        displayNode.SetSegmentOpacity3D(segmentID, 0.2)
        slicer.mrmlScene.AddNode(displayNode)
        displayNode.UnRegister(logic)
        logic.UpdateDisplayNodeFromVolumeNode(displayNode, segmentationNode)
        segmentationNode.AddAndObserveDisplayNodeID(displayNode.GetID())
`

But getting error

`Warning: In /home/kitware/Dashboards/Nightly/Slicer-0/Libs/MRML/Core/vtkMRMLSegmentationDisplayNode.cxx, line 297
vtkMRMLSegmentationDisplayNode (0x6dcdee0): vtkMRMLSegmentationDisplayNode::GetSegmentDisplayProperties: no display properties are found for segment ID=Segment_2, return default


Traceback (most recent call last):
  File "/home/mafia/Desktop/InteractiveSegment/InteractiveSegmentation/InteractiveSegmentation.py", line 1253, in display3dview
    logic.UpdateDisplayNodeFromVolumeNode(displayNode, segmentationNode)
TypeError: UpdateDisplayNodeFromVolumeNode argument 1: method requires a vtkMRMLVolumeRenderingDisplayNode, a vtkMRMLSegmentationDisplayNode was provided.

`