How to obtain x,y,z points from fiducial points and insert them into vtkPoints


I am trying to get the point values of fiducial points and put them into a vtkPoints.

The end goal is to create a tps transformation using these fiducial points.

tps = vtk.vtkThinPlateSplineTransform()

I was using this function and it requires me to input a vtkPoints.

I would appreciate it if you can help me.

Thank you

n = slicer.util.getNode('F')

points = vtk.vtkPoints()

for i in range(0, n.GetNumberOfFiducials()):
  point = [0,0,0]
  points.InsertNextPoint(point[0], point[1], point[2])


Thank you! That is exactly what I needed!

SlicerIGT extension’s Fiducial Registration wizard module does exactly this and much more. It offers a nice GUI, allows preview of results, real-time updates, helps collection of landmarks, can automatically match landmarks (even if their order is mixed up or the number of source and landmarks is not the same), compute residual error, etc.

Hi Andras

Thank you, I tried it out and it gives me the result I need. Is there a place where I can find more information on how to use the functions in a script?

Thank you

Chad Paik

See documentation in header files:

See examples of manipulating MRML nodes and using various module logics from Python in script repository:

Let us know if you have any specific questions.

Hi Andras

Is there any code that used the Fiducial Registration Wizard in their script? I could not find one in the repository.

I am just having trouble getting started in how to use the module. I want to to go through multiple fiducial mark up sets and find warping transform from one to another. How would I get started?

Thank you

Chad Paik

All you need to do is to add a fiducial registration wizard node to the scene and set its input markup nodes and output transform nodes, registration mode, etc. Output is automatically updated if yiy enable autó-update or call the module logic’s Update Calibration method.