# Displayed transform vs .tfm content

**URL:** <https://discourse.slicer.org/t/displayed-transform-vs-tfm-content/270>\
**Category:** Support\
**Created:** [May 4, 2017, 10:16pm UTC](https://discourse.slicer.org/t/displayed-transform-vs-tfm-content/270 "2017-05-04T22:16:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 4, 2017, 10:16pm UTC](https://discourse.slicer.org/t/displayed-transform-vs-tfm-content/270/1 "2017-05-04T22:16:00Z")

</div>

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

```auto
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:

```auto
#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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 4, 2017, 11:25pm UTC](https://discourse.slicer.org/t/displayed-transform-vs-tfm-content/270/2 "2017-05-04T23:25:45Z")

</div>

It’s a base transform between RAS/LPS and an inversion (rendering vs. resampling transform), as [described in the Transform module documentation](https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Transform_files).

---

<div class="post-metadata">

**Author:** ![hbraunDSP](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hbraundsp/32/4574_2.png) [@hbraunDSP](https://discourse.slicer.org/u/hbraunDSP)\
**Post date:** [September 30, 2020, 10:15pm UTC](https://discourse.slicer.org/t/displayed-transform-vs-tfm-content/270/3 "2020-09-30T22:15:15Z")

</div>

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.
