# Slicer Transform vs elastix Transform

**URL:** <https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507>\
**Category:** Development\
**Created:** [April 3, 2018, 8:41pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507 "2018-04-03T20:41:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [April 3, 2018, 8:41pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/1 "2018-04-03T20:41:54Z")

</div>

It is not clear the relation between them, here is what I did:

- Transform manually an image imgf using Slicer Transforms module, only one translation t\_x in LR and one rotation θ\_x in LR
  - t\_x=10 mm , θ\_x= 45 degrees
  - the rotation matrix mSlicer= [[1,0,0,0],[0,.71,-.71,0],[0,.71,71,0],[0,0,0,1]]
  - save the transformed image as imgm

- Use elastix to register imgm to imgf again using rigid transform parameters, ensure the are aligned
  - (TransformParameters θ\_x , θ\_y , θ\_z , t\_x , t\_y , t\_z)
  - get the matrix from the angles (I used an external script).
  - mE= [[1.,-0.,0.,t\_x],[0.,0.71,0.71,t\_y],[-0.,-0.71,0.71,t\_z],[0.,0.,0.,1.]]

- mE is not similar to mS, there is problem of the sign as well.

What I am missing?

---

<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:** [April 3, 2018, 10:02pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/2 "2018-04-03T22:02:16Z")

</div>

Elastix can only return the transform as a displacement field. It does not return parameters such as translation or rotation.

We plan to work with Elastix developers to add the possibility to retrieve linear or bspline transforms, but it is not available yet.

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [April 4, 2018, 8:42am UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/3 "2018-04-04T08:42:23Z")

</div>

Thanks Andras for your concern,

still not clear, what do you mean by transform as displacement field?

This is what elastix returns:  
`(TransformParameters θ_x , θ_y , θ_z , t_x , t_y , t_z)`  
3 angles in radians and 3 translations in mm.  
Aren’t these the 3D rigid transform 6 parameters?  
Please correct me if I am wrong, in your extension, you saved the result of elastix registration transform as a big hdf5 transform file, which includes each point in the moving image and its displacement  
`point_0, dis_x0, dis_y0, dis_z0, point_1, dis_x1, dis_y1, dis_z1, ..., point_n, dis_xn, dis_yn,dis_zn`  
How did you compute the displacement field from the above 6 parameters?

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [October 15, 2018, 3:57pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/4 "2018-10-15T15:57:35Z")

</div>

> We plan to work with Elastix developers to add the possibility to retrieve linear or bspline transforms, but it is not available yet.

@lassoan its been a while, any update on this?

---

<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:** [October 16, 2018, 2:32pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/5 "2018-10-16T14:32:30Z")

</div>

We have not yet started the project that requires this feature, so there is no updates so far.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [February 25, 2019, 1:49pm UTC](https://discourse.slicer.org/t/slicer-transform-vs-elastix-transform/2507/6 "2019-02-25T13:49:15Z")

</div>

Again, We need this feature, any update on this? I cant use elastix the way it is now without this feature.  
Actually is the input transformation what I am missing. I need that the Moving volume may have already associated a transformation, So I will just modify it.  
Hmm, I realize this is a whole new request, I will make the new thread.
