# Deformable registration, but only allow deformation in one direction

**URL:** <https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789>\
**Category:** Algorithms\
**Created:** [January 21, 2021, 7:12pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789 "2021-01-21T19:12:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Rubert](https://discourse.itk.org/user_avatar/discourse.itk.org/nick_rubert/32/1759_2.png) [@Nick\_Rubert](https://discourse.itk.org/u/Nick_Rubert)\
**Post date:** [January 21, 2021, 7:12pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/1 "2021-01-21T19:12:23Z")

</div>

Hi message board,

I would like to implement the algorithm described in the first paragraph of section 2.3 of this paper:

> **[wu.pdf](https://www.nitrc.org/docman/view.php/6/878/wu.pdf)**

The algorithm performs deformable registration between two images but only allows for stretching/compressing of the moving image in one dimension. The deformation is otherwise rigid.

Is there an obvious or straight forward way to do that within creating any new ITK classes?

---

<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:** [January 21, 2021, 8:46pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/2 "2021-01-21T20:46:52Z")

</div>

I don’t see an obvious way. Have you contacted the author to check whether he is willing to share his implementation?

---

<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:** [January 21, 2021, 8:48pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/3 "2021-01-21T20:48:37Z")

</div>

Unless you count as obvious inheriting BSpline transform and modifying it to be constrained along one direction only.

---

<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:** [January 21, 2021, 9:17pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/4 "2021-01-21T21:17:21Z")

</div>

Hello @Nick_Rubert,

You can constrain the transformation via the weighting scheme (see [SetOptimizerWeights](https://itk.org/Doxygen/html/classitk_1_1ImageRegistrationMethodv4.html#a7be464b66c1158ac02251b0f87aab998)). For the BSpline transform the parameters are the translation deltas of the control points. For n control points you have dx\_0,dy\_0,dz\_0...dx\_n,dy\_n,dz\_n . If you set the weights to 0,0,1...0,0,1 you limit the control point motion to the z axis, which limits deformation to that direction.

Generally, you zero out the axes along which you want to limit the deformation. This is crude, as you are limited to the imaging axes which don’t necessarily correspond to the arbitrary direction you want.

---

<div class="post-metadata">

**Author:** ![Nick\_Rubert](https://discourse.itk.org/user_avatar/discourse.itk.org/nick_rubert/32/1759_2.png) [@Nick\_Rubert](https://discourse.itk.org/u/Nick_Rubert)\
**Post date:** [January 21, 2021, 10:11pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/5 "2021-01-21T22:11:57Z")

</div>

Thanks for the responses everyone. I’ll try out adjusting the optimizer weights. I’ll try to post a code solution if I get a good result.

---

<div class="post-metadata">

**Author:** ![Nick\_Rubert](https://discourse.itk.org/user_avatar/discourse.itk.org/nick_rubert/32/1759_2.png) [@Nick\_Rubert](https://discourse.itk.org/u/Nick_Rubert)\
**Post date:** [January 24, 2021, 11:09pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/6 "2021-01-24T23:09:09Z")

</div>

Hi @dzenanz

Is there any way to adjust the Optimizer Weights for the 5.x registration framework?

The method you suggest is actually perfect for the particular MRI application in this post. For the diffusion imaging application in question the image deformation will always align perfectly with one of the imaging axes.

---

<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:** [January 24, 2021, 11:28pm UTC](https://discourse.itk.org/t/deformable-registration-but-only-allow-deformation-in-one-direction/3789/7 "2021-01-24T23:28:53Z")

</div>

There is no v5 registration framework, only v4 and pre-4 (stuff without v4 extension in the name). So what Ziv pointed you to is the newer stuff.
