I want to create another 3 clone fiducials close to these fiducials( same identical to original fiducials) then I want to transform my original fiducials to the clone fiducials. This is how I’m transforming using a matrix transform. This code only gets 1 markup fiducials after I name that to F, but not the randomized 3 fiducials point.
basically, I want is slicer.util.getNode() will get the fiducial point I created randomly using code slicer.modules.markups.logic().AddFiducial()
F1 = slicer.util.getNode('F')
transformMatrixNP = np.array(
[[1, 0, 0, 10],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]])
transformMatrixVTK = vtk.vtkMatrix4x4()
for row in range(4):
for col in range(4):
transformMatrixVTK.SetElement(row, col, transformMatrixNP[row, col])
F1.ApplyTransformMatrix(transformMatrixVTK)
It is not completely clear what you would like to achieve but if you use a recent Slicer Preview version then this example should help you get started:
The example script does this or something very similar. If you want to compute the transform automatically then you can use Fiducial registration wizard module in SlicerIGT extension.
Most probably python scripting. I’m adding python codes in the dicom python file .
Right now i know how to create randomly Fiducials and Matrix transformation of that fiducials.
So now , i will do registration of a fiducials onto another fiducials.
so , lets say ,i created 2 fiducial side by side and now i want 1 of the fiducial to be transformed onto another fiducial. can u please explain me how should i approach this situation?
To perform landmark registration from Python, add a vtkMRMLFiducialRegistrationWizardNode node to the scene, set input markup fiducial nodes (SetAndObserveFromFiducialListNodeId and SetAndObserveToFiducialListNodeId), output transform node (SetOutputTransformNodeId), and optionally other registration parameters, then call SetUpdateModeToAuto() to enable computation of the output transform automatically. You can verify if you have set all parameters correctly in the Fiducial registration wizard module GUI.
sir , after a create a node using this code slicer.modules.markups.logic().AddFiducial(4.0, 7.0, 10.0) , how can i get this node or call this node to use it again?
I’ve described above what exact method you need to call. Transform is computed (and recomputed if any of the inputs change) automatically if UpdateMode is set to Auto.