Distance from fiducial to a plane

  1. I have a CBCT data, and I want to measure distance from a given fiducial to a plane. I tried extension of “Angle Planes”, but I could not add scene before continuing to manage planes.
  2. Is there any extension for measuring the distance between a given fiducial to a plane?

Thank you in advance.

You can write a script easily that gets distances of points F from a plane P (by transforming the points to the plane’s coordinate system and get the third coordinate value):

planeNode = getNode('P')
fiducialNode = getNode('F')

planeToWorld = vtk.vtkMatrix4x4()
planeNode.GetObjectToWorldMatrix(planeToWorld)
points_World = arrayFromMarkupsControlPoints(fiducialNode)
points_Plane = np.dot(np.linalg.inv(arrayFromVTKMatrix(planeToWorld)), np.append(points_World, np.ones([4,1]), axis=1).T)
distances = points_Plane[2]
print(distances)
1 Like

Hello Prof Lasso, I am interested in finding perpendicular distance from point F to plane P as well and unfortunately that bit of code did not work. Dan

I am using Slicer 5.2.1

After entering the code:
import numpy as np
planeNode = getNode(‘P’)
fiducialNode = getNode(‘F’)
planeToWorld = vtk.vtkMatrix4x4()
planeNode.GetObjectToWorldMatrix(planeToWorld)
points_World = arrayFromMarkupsControlPoints(fiducialNode)
points_Plane = np.dot(np.linalg.inv(arrayFromVTKMatrix(planeToWorld)), np.append(points_World, np.ones([4,1]), axis=1).T)
distances = points_Plane[2]
print(distances)

I get the following error:
File “”, line 7, in
File “<array_function internals>”, line 180, in append
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/numpy/lib/function_base.py”, line 5444, in append
return concatenate((arr, values), axis=axis)
File “<array_function internals>”, line 180, in concatenate
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 1 and the array at index 1 has size 4

How can this be fixed?