# Co-registration of more than two images

**URL:** <https://discourse.itk.org/t/co-registration-of-more-than-two-images/5836>\
**Category:** Beginner Questions\
**Created:** [March 28, 2023, 8:59pm UTC](https://discourse.itk.org/t/co-registration-of-more-than-two-images/5836 "2023-03-28T20:59:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avigotsky](https://discourse.itk.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@avigotsky](https://discourse.itk.org/u/avigotsky)\
**Post date:** [March 28, 2023, 8:59pm UTC](https://discourse.itk.org/t/co-registration-of-more-than-two-images/5836/1 "2023-03-28T20:59:53Z")

</div>

Hi, all,

This this may a better question for #algorithms, but since I am new to ITK/SimpleITK, I will ask it here.

Suppose I have three images—_X_, _Y_, and _Z_—that I want to register into the same space. I do not have a template or standard space to which I wish I register them, nor is there any reason to prefer the space of any single image (e.g., there is no reason to register _X_ and _Y_ to _Z_’s space, _Y_ and _Z_ to _X_’s space, etc.). Is there a standard way to co-register images (e.g., assume affine transformations) to the same space? For instance, are there any registration functions with cost functions that take into account the distance between the registered images _in addition to_ the total distortion applied, which will allow me to pass 3+ images through them?

Happy to clarify any details if necessary. Many thanks!

---

<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:** [March 28, 2023, 11:24pm UTC](https://discourse.itk.org/t/co-registration-of-more-than-two-images/5836/2 "2023-03-28T23:24:43Z")

</div>

Hello @avigotsky,

**Theory** :  
Generally speaking, in the registration nomenclature you are asking about “groupwise registration”.  
An older reference [Groupwise Registration with Sharp Mean (2010)](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3018690/) and a newer one [X-Metric: An N-Dimensional Information-Theoretic Framework for Groupwise Registration and Deep Combined Computing (2022)](https://arxiv.org/pdf/2211.01631.pdf). A related approach, template building [The optimal template effect in hippocampus studies of diseased populations (2010)](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2818274/).

**Practice** :  
You can role your own, something along the lines of sharp mean can be implemented in ITK/SimpleITK.

SimpleElastix [supports groupwise registration](https://simpleelastix.readthedocs.io/GroupwiseRegistration.html) and was recently integrated into SimpleITK, but it requires that you [build SimpleITK from source](https://simpleitk.readthedocs.io/en/master/building.html) and set the SimpleITK\_USE\_ELASTIX flag to on.  
The code for X-metric is [available online](https://github.com/xzluo97/X-metric).

---

<div class="post-metadata">

**Author:** ![avigotsky](https://discourse.itk.org/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@avigotsky](https://discourse.itk.org/u/avigotsky)\
**Post date:** [March 28, 2023, 11:34pm UTC](https://discourse.itk.org/t/co-registration-of-more-than-two-images/5836/3 "2023-03-28T23:34:12Z")

</div>

This is extraordinarily helpful. Sometimes, just learning the correct nomenclature makes all the difference. Thank you!
