# Registration repeatability

**URL:** <https://discourse.itk.org/t/registration-repeatability/4883>\
**Category:** Algorithms\
**Created:** [March 24, 2022, 3:20pm UTC](https://discourse.itk.org/t/registration-repeatability/4883 "2022-03-24T15:20:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyoto\_Love](https://discourse.itk.org/user_avatar/discourse.itk.org/kyoto_love/32/2627_2.png) [@Kyoto\_Love](https://discourse.itk.org/u/Kyoto_Love)\
**Post date:** [March 24, 2022, 3:20pm UTC](https://discourse.itk.org/t/registration-repeatability/4883/1 "2022-03-24T15:20:09Z")

</div>

Hello everyone! I am stuck on one task, I need to register 2 identical images and do:

1.Write a loop for initializing the transformation with different parameters, and start the registration from different places.

2.Start the registration 10mm apart and then we run the registration and see if they get close to each other.

1. I need to calculate the error by the error using the Euclidean distance formula (i.e., L2 norm) → Can I do that by a code?

2. And repeat the process after point 2, but with different initial guesses. (For this, select one of the rotation parameters (e.g., Rx) and incrementally increase or decrease it.) Later run the registration and calculate the error.

I would be super happy if you suggest me a code or a tutorial on how to do that.

---

<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:** [March 24, 2022, 3:37pm UTC](https://discourse.itk.org/t/registration-repeatability/4883/2 "2022-03-24T15:37:13Z")

</div>

You could take a look at the [examples](https://itk.org/ITKExamples/src/Registration/Common/index.html), e.g. [this one](https://itk.org/ITKExamples/src/Registration/Common/GlobalRegistrationOfTwoImages/Documentation.html). You could modify [initial offsets](https://github.com/InsightSoftwareConsortium/ITKSphinxExamples/blob/v5.2.0/src/Registration/Common/GlobalRegistrationOfTwoImages/Code.cxx#L109-L110) (in a `for` loop). Euclidean distance is easy to compute using [final translation](https://github.com/InsightSoftwareConsortium/ITKSphinxExamples/blob/v5.2.0/src/Registration/Common/GlobalRegistrationOfTwoImages/Code.cxx#L145-L146) if your transform only allows translation. How do you transform rotation into Euclidean distance? The usual way is to have multiple points in the image, and evaluate discrepancy/distance between point pairs (corresponding points in fixed and moving images).

---

<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:** [March 24, 2022, 3:39pm UTC](https://discourse.itk.org/t/registration-repeatability/4883/3 "2022-03-24T15:39:22Z")

</div>

Also, you could look at “Resources” on [ITK home page](https://itk.org/) for more learning materials. Of particular interest might be [registration chapter](https://itk.org/ITKSoftwareGuide/html/Book2/ITKSoftwareGuide-Book2ch3.html) of the ITK software guide.

---

<div class="post-metadata">

**Author:** ![Kyoto\_Love](https://discourse.itk.org/user_avatar/discourse.itk.org/kyoto_love/32/2627_2.png) [@Kyoto\_Love](https://discourse.itk.org/u/Kyoto_Love)\
**Post date:** [March 26, 2022, 3:59pm UTC](https://discourse.itk.org/t/registration-repeatability/4883/4 "2022-03-26T15:59:27Z")

</div>

Thanks a lot, applying some of the suggestions now.
