# Incompatible Elastix transformation parameters with Transforms module

**URL:** <https://discourse.slicer.org/t/incompatible-elastix-transformation-parameters-with-transforms-module/18151>\
**Category:** Support\
**Tags:** registration, transforms, elastix\
**Created:** [June 15, 2021, 9:22pm UTC](https://discourse.slicer.org/t/incompatible-elastix-transformation-parameters-with-transforms-module/18151 "2021-06-15T21:22:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HodaGH](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@HodaGH](https://discourse.slicer.org/u/HodaGH)\
**Post date:** [June 15, 2021, 9:22pm UTC](https://discourse.slicer.org/t/incompatible-elastix-transformation-parameters-with-transforms-module/18151/1 "2021-06-15T21:22:59Z")

</div>

Hi,

The resulting transform parameters from parameters file or elastix log are different from what I see in the transforms module and this is happening for all my registrations.  
For example this is in the transform parameter file  
(TransformParameters -0.03651878797625225 0.003033123843879148 -0.0006397282655260022 9.21029262141312 -27.286980280721142 252.7584809282367)  
And this is what I see in the Transform Module:

 ![Screen Shot 2021-06-15 at 5.20.29 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/9/e9dc182e9711dfef781cf1c98bf5368b544ad952.png)

Which is the correct one?

Thank you.

---

<div class="post-metadata">

**Author:** ![HodaGH](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@HodaGH](https://discourse.slicer.org/u/HodaGH)\
**Post date:** [June 16, 2021, 12:25am UTC](https://discourse.slicer.org/t/incompatible-elastix-transformation-parameters-with-transforms-module/18151/2 "2021-06-16T00:25:54Z")

</div>

here is another example with more difference

(TransformParameters -0.10761595892949985 0.034073286732973586 -0.00008801191874278422 12.692584965893245 -31.151640872040343 145.8404685931222)

but this in the Transforms module

 ![Screen Shot 2021-06-15 at 8.24.37 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/e/2ec0f369cbde36b72e2bb95ba2cc5791e2856ce9.png)

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [June 16, 2021, 6:03pm UTC](https://discourse.slicer.org/t/incompatible-elastix-transformation-parameters-with-transforms-module/18151/3 "2021-06-16T18:03:09Z")

</div>

Elastix and Slicer represent the transformation differently. You might notice that there are only 6 numbers in the Elastix representation of the transform, whereas there are 12 in the Slicer representation. The Elastix representation parameters are 3 rotation and 3 translation parameters. The Slicer representation is a 4x4 homogeneous affine transformation matrix. The translation parts might differ either because

- the order of translation vs rotation may differ between the two representations,
- because a “CenterOfRotationPoint” was specified in the Elastix file, or
- because Slicer is representing the “fixed to moving” transform and Elastix is representing the “moving to fixed” transform (these are inverses of each other).

I think it is likely the last one (moving to fixed vs fixed to moving), but I would need to take a closer look and do some testing to be 100% sure.

The following code shows exactly how Slicer converts from the Elastix version to the matrix version.

> <https://github.com/lassoan/SlicerElastix/blob/master/Elastix/Elastix.py#L537-L619>
