vtkMRMLMarkupsCurveNode.GetBounds() : how should we understand it?

I expected the bounds from vtkMRMLMarkupsCurveNode.GetBounds() to stop at the extreme XYZ values in both directions on each axis. It seems that the returned bounds exceed these values, with greater excess as the length is on an axis.

This code creates an annotation ROI, positioned at the center of the returned bounds, and extending the ROI as per the computed length on each axis.

bounds = numpy.zeros(6)
inputCurve.GetRASBounds(bounds)
roi=slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLAnnotationROINode”)
box = vtk.vtkBoundingBox(bounds)
center = [0.0, 0.0, 0.0]
box.GetCenter(center)
roi.SetXYZ(center)
roi.SetRadiusXYZ(box.GetLength(0), box.GetLength(1), box.GetLength(2))

The result is as shown below.

boundsByCode

The expected result would be as below.

boundsIdealized

How should we then expect, intreprete and use the returned value of GetBounds()? Is there a way to calculate the excess margins on each axis ?

Thank you.

roi.SetRadiusXYZ(box.GetLength(0), box.GetLength(1), box.GetLength(2))

SetRadiusXYZ method expects radius. Divide box side length by 2.0 to get the radius.

Yes… radius… the function name was clear enough ! Thanks.

1 Like