# Image Registration using BSplines with order greater than 3

**URL:** https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955
**Category:** Engineering
**Created:** [March 12, 2021, 9:22pm UTC](https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955 "2021-03-12T21:22:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Felippe\_Trigueiro\_An](https://discourse.itk.org/user_avatar/discourse.itk.org/felippe_trigueiro_an/32/1015_2.png) [@Felippe\_Trigueiro\_An](https://discourse.itk.org/u/Felippe_Trigueiro_An)
#### Post date: [March 12, 2021, 9:22pm UTC](https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955/1 "2021-03-12T21:22:48Z")

</div>

Hi, I’m trying to do a registration using BSplines of order 4. However, when I set 4 to the parameter ‘order’ in the BSplineTransformInitializer constructor, I got the following message: “sitk::ERROR: Invalid Order: 4 only orders 0, 1, 2, and 3 supported!”.

So, Is There a way to do this registration using SimpleITK? And using ITK?

Thanks.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [March 14, 2021, 4:17am UTC](https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955/2 "2021-03-14T04:17:26Z")

</div>

Most likely you can achieve sufficiently smooth displacement field with 3rd order spline and appropriately dense grid of control points. But if you really want to have higher-order spline then most likely you just need to add 2 lines of code to sitkBSplineTransformInitializerFilter.cxx in SimpleITK.

---

<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: [March 15, 2021, 12:57pm UTC](https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955/3 "2021-03-15T12:57:15Z")

</div>

I suspect that ITK does not support 4th order b-splines. Maybe some filter’s or data representations do, but likely not enough for a complete workflow. SimpleITK supports 1, 2, and 3 order b-splines. Likely higher orders did not compile when this feature is added.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [March 15, 2021, 2:46pm UTC](https://discourse.itk.org/t/image-registration-using-bsplines-with-order-greater-than-3/3955/4 "2021-03-15T14:46:38Z")

</div>

The fourth order b-spline can be enabled by adding a `4` for the `VSplineOrder` when building an [`itk::BSplineTransform`](https://itk.org/Doxygen/html/classitk_1_1BSplineTransform.html), and this can be supplied to the `itk::BSplineTransformInitializer`. The ITK Python wrapping provides 3rd order transform support out of the box. In general, if the goal is to increase transform flexibility, it is better to use a denser bspline grid over a higher order transform.
