How to access child node

how can i access child node by code.
for example :
the Segmentation node
has child nodes:

Hello @aldoSanchez

There are python snippets that you can use to do this in the Script repository

If you need to manipulate segments in the segmentation container, you can do something like the following

 segmentNames = ["Prostate", "Urethra"]
 segmentIds = vtk.vtkStringArray()
 for segmentName in segmentNames:
     segmentId = 
 slicer.vtkSlicerSegmentationsModuleLogic.ExportSegmentsToLabelmapNode(segmentationNode, segmentIds, labelmapVolumeNode, referenceVolumeNode)


1 Like

Please note that in the case of segmentations, the segments are not actual nodes, but part of the segmentation node. So instead of using subject hierarchy functions for getting the children, you need to access the segments within the segmentations as @Andinet_Enquobahrie suggests.

what i did was to export the segmentation to modules
and now I want to manipulate the colors and the visibility of the modules.