# align diffrent modalities based on metadata

**URL:** <https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100>\
**Category:** Uncategorized\
**Created:** [July 27, 2023, 7:41am UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100 "2023-07-27T07:41:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)\
**Post date:** [July 27, 2023, 7:41am UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/1 "2023-07-27T07:41:11Z")

</div>

Hello I have multiple studies of the same patient they have different spacing and size (range). When I display them in a slicer they are coregistered - patient did not moved between studies  
Hovewer I do not know how to get different modalities to the same grid.

I tried to use 1 epoch registration by elastix but it leads sometimes to erroneous translation comparing to slicer display.

Thanks for any suggestions!

---

<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 27, 2023, 12:52pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/2 "2023-07-27T12:52:59Z")

</div>

Hello @Jakub_Mitura,

Based on the description, the images are already aligned. What you need to do is resample one of them onto the other’s grid using the identity transformation ([ITK example](https://examples.itk.org/src/filtering/imagegrid/resampleanimage/documentation), [SimpleITK notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/21_Transforms_and_Resampling.ipynb)).

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)\
**Post date:** [July 27, 2023, 2:11pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/3 "2023-07-27T14:11:44Z")

</div>

Thanks @zivy ! still just to be sure one image is bigger than the other meaning that for example one starts from top of the head and the other from the neck hence one needs padding to accommodate for it - it is not a problem here?

---

<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 27, 2023, 2:39pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/4 "2023-07-27T14:39:51Z")

</div>

Hello @Jakub_Mitura,

Please take a look at the **Resampling after registration** section in the notebook referenced above. It discusses the exact issue you are raising. You can run it using the “launch binder” button, top right.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)\
**Post date:** [July 27, 2023, 4:13pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/5 "2023-07-27T16:13:49Z")

</div>

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:** [July 27, 2023, 5:18pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/6 "2023-07-27T17:18:37Z")

</div>

Since @Jakub_Mitura wrote that “I do not know how to get different modalities to the same grid”, I think he needs not just resampling, but also registration, because the image origin is usually differs between two acquisitions on different imaging (unless it is an integrated system, like a PET/CT).

For a successful intensity-based automatic image registration, you typically need to crop the input images to the overlapping region. For example, if one image contains the neck and up and the other image contains the neck and down, then you need to crop both images to the neck and register those. You can then use the computed transform to align the original non-cropped image.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)\
**Post date:** [July 27, 2023, 6:39pm UTC](https://discourse.itk.org/t/align-diffrent-modalities-based-on-metadata/6100/7 "2023-07-27T18:39:47Z")

</div>

Thanks!! to be more precise I have a t2w image with some prostate segmentation and the adc image  
When I open slicer and get the annotations made on t2w and display them on adc it displays in correct spot. Hence Slicer without registration based just on metadata is able to locate it well. I tried to use elastix for registration but it is generally inferior to what the slicer do without any registration
