# Get parent of segmentation Node

**URL:** <https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [February 16, 2021, 3:00pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010 "2021-02-16T15:00:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurennLam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/laurennlam/32/16833_2.png) [@LaurennLam](https://discourse.slicer.org/u/LaurennLam)\
**Post date:** [February 16, 2021, 3:00pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010/1 "2021-02-16T15:00:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 16, 2021, 3:16pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010/2 "2021-02-16T15:16:55Z")

</div>

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](http://apidocs.slicer.org/master/classvtkMRMLSegmentEditorNode.html#ae7dbe89f755f115624dc1c701e9dcf80) 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):

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

```

---

<div class="post-metadata">

**Author:** ![LaurennLam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/laurennlam/32/16833_2.png) [@LaurennLam](https://discourse.slicer.org/u/LaurennLam)\
**Post date:** [February 16, 2021, 3:29pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010/3 "2021-02-16T15:29:07Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![LaurennLam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/laurennlam/32/16833_2.png) [@LaurennLam](https://discourse.slicer.org/u/LaurennLam)\
**Post date:** [February 16, 2021, 3:31pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010/4 "2021-02-16T15:31:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 16, 2021, 4:58pm UTC](https://discourse.slicer.org/t/get-parent-of-segmentation-node/16010/5 "2021-02-16T16:58:21Z")

</div>

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.
