# Exporting Rigid Registration result as Transform results in strange errors

**URL:** <https://discourse.slicer.org/t/exporting-rigid-registration-result-as-transform-results-in-strange-errors/12830>\
**Category:** Support\
**Tags:** registration, file-export\
**Created:** [August 3, 2020, 2:36pm UTC](https://discourse.slicer.org/t/exporting-rigid-registration-result-as-transform-results-in-strange-errors/12830 "2020-08-03T14:36:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PfeifferMIcha](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@PfeifferMIcha](https://discourse.slicer.org/u/PfeifferMIcha)\
**Post date:** [August 3, 2020, 2:36pm UTC](https://discourse.slicer.org/t/exporting-rigid-registration-result-as-transform-results-in-strange-errors/12830/1 "2020-08-03T14:36:19Z")

</div>

Hi,

I rigidly registered two images using the Landmark-Based registration. I chose “Affine Registration” as the Registration Type and “Rigid” as Registration Mode. The resulting registration looks good, so I tried to export the transform for usage in other programs by choosing “save”.  
However, the resulting files (I tested both .txt and .mat) have a slightly different transformation matrix than what I get when I look at the transform in slicer (Right click on the transformation-\>Edit properties).

Slicer’s GUI shows:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/6/56d96c6ec0ec006974989492ab938ef6517676ad.png)

In the text file, I have:

> #Insight Transform File V1.0  
> #transform 0  
> Transform: AffineTransform\_double\_3\_3  
> Parameters: 0.9989776251379424 0.04090843080016693 -0.01924070589205142 -0.04089969593416781 0.9991628979972874 0.0008474303244814285 0.01925926650340259 -0.00005962491247667927 0.9998145213481452 -4.374452815811267 -95.00156325189849 424.48027296194584  
> FixedParameters: 0 0 0

I expect the first 9 parameters to be the rotation and the last three to be the translation. Some values are not the same (see for example the x-value of the translation which changes from -7 mm to -4 mm)

When applying the exported transform in blender or paraview (to the segmented meshes which I get from the original images) I thus get a small offset in position and rotation.

Tested with Slicer Version 4.8.0 r26489. Is this a bug, or am I interpreting the transform wrong in the other programs?

---

<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:** [August 3, 2020, 2:41pm UTC](https://discourse.slicer.org/t/exporting-rigid-registration-result-as-transform-results-in-strange-errors/12830/2 "2020-08-03T14:41:06Z")

</div>

What you describe is the correct behavior. The difference that you see compared to the transform in Slicer GUI is due to ITK storing resampling transform (“from parent” direction) between data sets are defined in LPS coordinate system. See explanation and conversions between different coordinate systems and directions here: [https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Transform\_files](https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Transform_files)

---

<div class="post-metadata">

**Author:** ![PfeifferMIcha](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@PfeifferMIcha](https://discourse.slicer.org/u/PfeifferMIcha)\
**Post date:** [August 11, 2020, 3:25pm UTC](https://discourse.slicer.org/t/exporting-rigid-registration-result-as-transform-results-in-strange-errors/12830/3 "2020-08-11T15:25:42Z")

</div>

Thank you, that was the issue! I was able to get the correct transformation into another program by loading the saved transform and using the python script under the link you posted to convert it.

Thanks a lot for the quick reply as well!
