In previous versions of Slicer, the length measurement was shown on the 3D view, but for some reason it doesn’t seem to be working for me now. I have a MarkupsLine node with two control points, but the length measurement is not being calculated
Any suggestions? Or is there a different way I need to trigger this? Obviously it’s trivial to do the calculation myself, but previously this “just worked” in Slicer, so this seems like a bug.
I’m using Slicer 5.2.1. I just verified that opening a new Slicer instance and a single volume and adding a single MarkupsLine still shows this behavior (meaning it’s probably not caused by something weird I did in my current Slicer session). I also copied and pasted this section from https://github.com/Slicer/Slicer/blob/a5f75351073ef62fd6198d9480d86c0009d70f9b/Modules/Loadable/Markups/Testing/Python/MarkupsMeasurementsTest.py
markupsNode = slicer.mrmlScene.AddNewNodeByClass(‘vtkMRMLMarkupsLineNode’)
length = 34.12
direction = np.array([0.3, -0.4, 0.8])
pos1 = np.array([20, -12.4, 3.8])
pos2 = pos1 + direction / np.linalg.norm(direction) * length
markupsNode.AddControlPoint(vtk.vtkVector3d(pos1))
markupsNode.AddControlPoint(vtk.vtkVector3d(pos2))measurement = markupsNode.GetMeasurement(“length”)
if abs(measurement.GetValue() - length) > 1e-4:
raise Exception("Unexpected length value: " + str(measurement.GetValue()))
This gives the error “Unexpected length value: 0.0”, so I think that means that this test should not have passed, and also it is not just my code or behavior which is leading to this.