I have three separate images with corresponding segmentations and colour tables. I want to make three viewers, viewing the image in an axial direction.
Until now, I’m able to get one image in each viewer, but the image+segmentation in each viewer has been unsuccessful, also in axial orientation. Can anyone help?
I looked into that but for some reason all my segmentations are still visibly in each viewer. I tried to do something like this but it didnt work:
#put one of the volumes into each view, or none if it should be blank
sliceNodesByViewName = {}
layoutManager = slicer.app.layoutManager()
for index in range(len(actualViewNames)):
viewName = actualViewNames[index]
try:
volumeNodeID = volumeNodes[index].GetID()
segNodeID = label[index].GetID()
except IndexError:
volumeNodeID = ""
sliceWidget = layoutManager.sliceWidget(viewName)
compositeNode = sliceWidget.mrmlSliceCompositeNode()
if label:
compositeNode.SetBackgroundVolumeID(volumeNodeID)
compositeNode.SetLabelVolumeID(segNodeID)
else:
compositeNode.SetBackgroundVolumeID(volumeNodeID)
sliceNode = sliceWidget.mrmlSliceNode()
sliceNode.SetOrientation(orientation)
sliceNodesByViewName[viewName] = sliceNode
Segmentations aren’t managed by the vtkMRMLSliceCompositeNode so you need to manage their visibility using the list of view node ids in their display nodes, something like this.