Operating system:Windows10
Slicer version:4.11.20200930
Expected behavior:
Actual behavior:
I want to do some functions similar to fiducial registeration wizard in SlicerIGT by my own python module.
Now I can retrieve the transform matrix, but I don’t know how to get the new fiducial position of f1 node after transform.
Thanks!
Here is my code:
transformNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLLinearTransformNode")
transformNode.SetName("Registration Transform")
parameters = {}
f1 = slicer.util.getNode("Fiducials")
f2 = slicer.util.getNode("Fiducials2")
parameters["saveTransform"] = transformNode.GetID()
parameters["movingLandmarks"] = f1.GetID() # fiducial points
parameters["fixedLandmarks"] = f2.GetID() # fiducial points
fiduciaReg = slicer.modules.fiducialregistration
slicer.cli.runSync(fiduciaReg, None, parameters)
tmatrix = vtk.vtkMatrix4x4()
t1 = slicer.util.getNode(parameters["saveTransform"])
t2 = slicer.util.getNode(parameters["movingLandmarks"])
t1.GetMatrixTransformToParent(tmatrix)
transformMatrix = slicer.util.arrayFromVTKMatrix(tmatrix)