Get parent of segmentation Node

Hi there,
I’d like to k now how I can get the parent of a segmentation.
I have a vtkMRMLScalarVolumeNode and created a Segmentation for this scalarVolume (With the user interface). But I’d like to know how I can get the vtkMRMLScalarVolumeNode from the vtkMRMLSegmentationNode programatically ?
I thought it was the storageNode but it doesn’t seem to be this.

Thanks in advance.

You can use many scalar volumes to create a segmentation, so there is no strict correspondence between segmentation and one scalar volume.

You can get the current master volume that is selected in the segment editor node.

You can also get the volume node that was used to initialize geometry of the segmentation (typically the first volume you selected as master volume):

referenceVolumeNode = segmentationNode.GetNodeReferenceID(
  slicer.vtkMRMLSegmentationNode.GetReferenceImageGeometryReferenceRole())

I just tried the second solution but it returns an empty node.
I don’t want to use the segment editor node as I can have the situation where I load a mrmlScene with segmentation.
But when we are in the data panel and you click on a segmentation, it highlights the volume used to create the segmentation. Is it what the second solution should do ?

My bad! I used bad data to test it. It perfectly works and does what I want. Thanks !

2 Likes

We should consider tracking all the volumes that were used as master volumes during creation of a segmentation so that all could be listed in a dicom export.

1 Like