One last (and kind of dumb) question : If I want to transform my fiducials points to my image space, (rather than rotating my slice view), can I do that by using this transform matrix ? I have some other models, which I don’t know how to rotate. Therefore I don’t want to rotate my image(s), but just adjust fiducial RAS’s, so that they are not cut through multiple slices. Is this doable ?
You can find complete examples of transforming between world (RAS) and voxel (IJK) coordinates (even if the volume and fiducials are under arbitrary, even warping transforms) in the script repository:
If I understand correctly, I need the following step to solve my problem (the rest is for mapping from RAS to IJK). However, when I applied the following code to my fiducials, their coordinates do not change (i.e., point_VolumeRas = point_Ras) . Why would that be ? Should I change the first argument of GetTransformBetweenNodes from None to something else ?
# If volume node is transformed, apply that transform to get volume's RAS coordinates
transformRasToVolumeRas = vtk.vtkGeneralTransform()
slicer.vtkMRMLTransformNode.GetTransformBetweenNodes(None, volumeNode.GetParentTransformNode(), transformRasToVolumeRas)
point_VolumeRas = transformRasToVolumeRas.TransformPoint(point_Ras[0:3])