Displayed transform vs .tfm content

Hi,
I created a transform in slicer. The information part of the Transform modules shows it like this;

Transform to parent:
Linear
-0.12 -0.96 0.26 **710** 
0.99 -0.1 0.1 **19** 
-0.07 0.27 0.96 -**58** 
0 0 0 1 

When I save this as a .tfm, the resultant file contains this transformation:

#Insight Transform File V1.0
#Transform 0
Transform: AffineTransform_double_3_3
Parameters: -0.12281062601468536 0.9902729990354874 0.06989222618721933 -0.9559259621663395 -0.0968506562880039 -0.26898522478338405 -0.2598992353790456 -0.09944665326067206 0.9609182640368552 **-64.32660836989362 -696.1487386450094 -130.6846842169375**
FixedParameters: 0 0 0

While I worked out the sign changes and transposition of the matrix, I don’t know why my translations changed so much? I need to this outside of the Slicer and save each transform as a .tfm. Is there a formula I can follow?
Thanks,
M

It’s a base transform between RAS/LPS and an inversion (rendering vs. resampling transform), as described in the Transform module documentation.

1 Like

I know this thread is old, but it’s what came up when I searched. @lassoan I think the python code in your link is misleading as it’s only valid for rigid transforms, where the transpose of the 3x3 rotation matrix is its inverse. If there is scaling (or, I assume, shear) this condition will not be met and the answer will be wrong. For anyone else looking at this, know that the line mt[:3,3] = mt[:3,:3] @ mt[:3,3] is incorrect for non-rigid transforms, and a full inverse needs to be calculated.