# Similarity3DTransform like transform with 3 independent scales

**URL:** https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171
**Category:** Engineering
**Created:** [July 31, 2018, 2:14pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171 "2018-07-31T14:14:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)
#### Post date: [July 31, 2018, 2:14pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/1 "2018-07-31T14:14:04Z")

</div>

A recent publication comparing registration methods ([https://doi.org/10.1016/j.neuroimage.2018.03.025](https://doi.org/10.1016/j.neuroimage.2018.03.025)) come up with the MINC based bestlinreg from CIVET2.1 as being the most robust and reliable. There are obviously many differences in implementation comparing the ITK registration methods (as implemented in ANTs for example) and bestlinreg/minctracc, but a big omission in ITK is the “lsq9” transform, that is, a transform with 3 rotations, 3 translations and 3 scales.

Based on my reading of antsRegistration, I could probably fake a lsq9 transform by using the restrict-deformation feature on an Affine transform, but I’d like to propose the addition of a new transform type of lsq9 type.

Would this be an acceptable addition? I’m thinking I can either adapt the existing Similarity3DTransform or perhaps the AffineTransform.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 31, 2018, 2:56pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/2 "2018-07-31T14:56:42Z")

</div>

Doesn’t [ScaleVersor3DTransform](https://itk.org/Doxygen/html/classitk_1_1ScaleVersor3DTransform.html) already do that? You can find all transforms in ITK [on this list](https://itk.org/Doxygen/html/group__ITKTransform.html).

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [July 31, 2018, 3:05pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/3 "2018-07-31T15:05:09Z")

</div>

Nope.

ScaleVersor3DTransform is one of the ITK gotcha’s, you think it is transformation composition based on the name but the documentation says otherwise (the rotation and scale matrices are added, not multiplied).

---

<div class="post-metadata">

### Author: ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)
#### Post date: [July 31, 2018, 3:15pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/4 "2018-07-31T15:15:34Z")

</div>

Looks like all the Versor transforms have this property of composition by addition, so I think its a very different beast than the base affine type.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [July 31, 2018, 7:59pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/5 "2018-07-31T19:59:29Z")

</div>

The ITK affine transforms all use analytic derivatives from computing the different Jacobins. I recall looking into having the ScaleVersor3DTransfrom be multiplied instead of added, and the derivative were not pretty as I recalled. It also was not clear to me if it actually would make a difference.

I suppose one could implement a scale Euler 3D with the derivative computed from finite differences, but that would be different than the existing affine transforms.

---

<div class="post-metadata">

### Author: ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)
#### Post date: [July 31, 2018, 8:03pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/6 "2018-07-31T20:03:33Z")

</div>

Thanks @blowekamp I’m not particularly interested in the Versor transforms, I’ll look into whether I can generalize the Similarity transform to do 3 independent scales.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [July 31, 2018, 8:13pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/7 "2018-07-31T20:13:51Z")

</div>

The [Similarity3DTransform](https://itk.org/Doxygen/html/classitk_1_1Similarity3DTransform.html)’s parent is [VersorRigid3DTransform.html](https://itk.org/Doxygen/html/classitk_1_1VersorRigid3DTransform.html).

You’ll want to look at[Euler3DTransform](https://itk.org/Doxygen/html/classitk_1_1Euler3DTransform.html), but that is only rigid, so not scales.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [August 23, 2018, 3:36pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/8 "2018-08-23T15:36:12Z")

</div>

I just wanted to follow up. I have been working on the CompositeTransform class. It is theoretically possible to create a composite transform with a Euler3D and a Scale transform and enable **both** transforms to be optimized. The CompositeTransfrom::ComputeJacobianWithRespectToParameters should properly compute the required derivatives! That is some serious smarts that have been put into the ITKv4 registration framework with composite transforms 🤔

---

<div class="post-metadata">

### Author: ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)
#### Post date: [August 23, 2018, 4:16pm UTC](https://discourse.itk.org/t/similarity3dtransform-like-transform-with-3-independent-scales/1171/9 "2018-08-23T16:16:57Z")

</div>

Oh wow, that’s pretty amazing. So, rather than banging my head against the wall on implementing a new transform, I’ll see if I can grok the ANTs/ITK registration code enough to add this composite transform type into the registration framework!
