# Incorrect registered image

**URL:** <https://discourse.itk.org/t/incorrect-registered-image/6243>\
**Category:** Beginner Questions\
**Tags:** template\
**Created:** [October 5, 2023, 4:08am UTC](https://discourse.itk.org/t/incorrect-registered-image/6243 "2023-10-05T04:08:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pratibha](https://discourse.itk.org/user_avatar/discourse.itk.org/pratibha/32/3706_2.png) [@pratibha](https://discourse.itk.org/u/pratibha)\
**Post date:** [October 5, 2023, 4:08am UTC](https://discourse.itk.org/t/incorrect-registered-image/6243/1 "2023-10-05T04:08:20Z")

</div>

I have moving image of size 256x256x11 and fixed image of 512x512x512 which is the template image. I just want to register the moving to fixed space. I am getting improper registered image. The sample of the output is given below.  
 ![query](https://discourse.itk.org/uploads/default/original/2X/9/952479c30e5a33eaa0622d5bd2e398c3adfd85d9.png)

I also did the down sampling of the template to match size of moving image using c3d but still got the same result.

For reference. template image  
 ![template](https://discourse.itk.org/uploads/default/original/2X/a/a20bac034e65b34cfb191a17e27e827c9ca11b8c.png)  
fixed image  
 ![fixed](https://discourse.itk.org/uploads/default/original/2X/0/0cf29fc85fc366219b3d2832b19f730223d5b52c.png)

How could I get properly registered moving image to template. I need to transform the mask of fixed image using the result transformation of this registration.

All the help and suggestions are greatly appreciated!

---

<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:** [October 5, 2023, 12:32pm UTC](https://discourse.itk.org/t/incorrect-registered-image/6243/2 "2023-10-05T12:32:51Z")

</div>

Hello @pratibha,

Before you try to register the images **programmatically** , please read about the ITK registration framework, see the [itk book](https://itk.org/ItkSoftwareGuide.pdf). If using SimpleITK, go over the [online tutorial](https://simpleitk.org/TUTORIAL/) and [fundamental concepts](https://simpleitk.readthedocs.io/en/master/fundamentalConcepts.html), [conventions](https://simpleitk.readthedocs.io/en/master/conventions.html) and [registration overview](https://simpleitk.readthedocs.io/en/master/registrationOverview.html). In any case, there is no need to resample the volumes prior to registration.

Another much easier, non programmatic, solution is to use [Slicer](https://www.slicer.org/) and its [general registration](https://slicer.readthedocs.io/en/latest/user_guide/modules/brainsfit.html).

---

<div class="post-metadata">

**Author:** ![pratibha](https://discourse.itk.org/user_avatar/discourse.itk.org/pratibha/32/3706_2.png) [@pratibha](https://discourse.itk.org/u/pratibha)\
**Post date:** [October 5, 2023, 12:57pm UTC](https://discourse.itk.org/t/incorrect-registered-image/6243/3 "2023-10-05T12:57:51Z")

</div>

Thank you for the resources, I’ll look into them. Just an additional question, Is the result image image due to bad parameters initialization? I just used the default affine in itk-elastix.

---

<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:** [October 5, 2023, 1:07pm UTC](https://discourse.itk.org/t/incorrect-registered-image/6243/4 "2023-10-05T13:07:17Z")

</div>

Your images seem to require non-linear deformation, which means you should try BSpline, and more likely, two-stage registration with affine followed by BSpline.
