Could not find nodes in the scene by name or id 'R'

Operarting system: Macos Sonoma 14.1
Slicer version: 5.6.1
Expected behaviour Bounding box.

Hello,

I am trying to extract the bounding box from slicer. I am running in the python terminal all steps as previously mentioned in other topics. Namely

import numpy as np
bounds = np.zeros(6)
getNode("R").GetBounds(bounds)

where i receive the error.

raise MRMLNodeNotFoundException("could not find nodes in the scene by name or id '%s'" % (pattern if (isinstance(pattern, str)) else ""))

slicer.util.MRMLNodeNotFoundException: could not find nodes in the scene by name or id 'R'

(as seen in the Screenshot)

I can not figure out what I am doing wrong. How can i prevent this error?

Best regards,

Luca

As you can see in your screenshot, the name of the node is “Volume rendering ROI”, not “R”.

If you wan to get the list of ROI markups in the scene, you can call:

roiNodes = getNodesByClass("vtkMRMLMarkupsROINode")
1 Like

Thank you. A silly oversight by me