Marc-3d
(MarcP)
May 3, 2022, 9:37am
1
Hi everyone,
I am trying write a Python script that accesses the “volume” node and “ROI” nodes that the user has manually selected in the “Volume Rendering” module.
Does anyone have any clues on how to access this information from Python?
Thank you in advance
cpinter
(Csaba Pinter)
May 3, 2022, 9:57am
2
This should help:
volRenLogic = slicer.modules.volumerendering.logic()
displayNode = volRenLogic.GetFirstVolumeRenderingDisplayNode(volumeNode)
roiNode = displayNode.GetROINode()
1 Like
Marc-3d
(MarcP)
May 3, 2022, 11:30am
3
Thank for the answer, but what is “volumeNode” in your example? An empty “vtkMRMLScalarVolumeNode”?
mau_igna_06
(Mauro I. Dominguez)
May 3, 2022, 12:48pm
4
volumeNode = getNode("nodeNameInTheDataModule")
1 Like
Marc-3d
(MarcP)
May 11, 2022, 4:02pm
5
The problem is that I don’t know the name of the volumeNode in advance, or it’s ID.
I ended up figuring out how to access the GUI element that holds the list of volumes. Maybe it helps someone else in the future
vol_node = slicer.modules.volumerendering.widgetRepresentation().findChild(slicer.qMRMLNodeComboBox(), "VolumeNodeComboBox").currentNode();