Retrieving Transform Matrix From Transforms Module


I have 3D images that I need to rotate and to do this I am using the transforms module. I want to do the rotation in the gui with sliders and retrieve the transform matrix via python code to apply the transform with ITK later. However, in transform node I couldn’t find any function that returns this information. Is there any way to get the transform matrix?
Here is the code I use to create transform node and visualize the transform

        transformNode = slicer.vtkMRMLTransformNode()
        volumeNode = slicer.util.loadVolume(filePath)
        volRenLogic = slicer.modules.volumerendering.logic()
        #Display the volume
        displayNode = volRenLogic.CreateDefaultVolumeRenderingNodes(volumeNode)
        #Center 3d Volume
        layoutManager =
        threeDWidget = layoutManager.threeDWidget(0)
        threeDView = threeDWidget.threeDView()

Transform’s module developer documentation should answer all the above questions:

Let us know if you have any remaining questions.

1 Like