# Speed up ITK Registration Pipeline

**URL:** https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941
**Category:** Algorithms
**Created:** [March 8, 2021, 8:51pm UTC](https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941 "2021-03-08T20:51:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![PauloFavero](https://discourse.itk.org/user_avatar/discourse.itk.org/paulofavero/32/1907_2.png) [@PauloFavero](https://discourse.itk.org/u/PauloFavero)
#### Post date: [March 8, 2021, 8:51pm UTC](https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941/1 "2021-03-08T20:51:12Z")

</div>

Hello Everyone,

I implemented a registration pipeline using MattesMutualInformation as the metric algorithm.  
I am reaching convergence around 50 iterations but these iterations are taking nearly 4 minutes. My computer has an i7-9750, 16GB RAM, and an Nvidia RTX 2060 6GB.

I tried setting up the WorkUnits but no improvement was noticed. I looked into some questions on the forum regarding the GPU implementation and, as far as I understood, there isn’t a current implementation of the registration framework on the GPU.

The moving image is 640x402 and the fixed image is 640x480. Is processing time normal? Is there a way in which I can use the GPU or use more threads?

Thanks

---

<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 8, 2021, 9:45pm UTC](https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941/2 "2021-03-08T21:45:10Z")

</div>

If that is a 2D image, registration should be done in seconds. Debug can be 100x slower than release.

---

<div class="post-metadata">

### Author: ![pip010](https://discourse.itk.org/user_avatar/discourse.itk.org/pip010/32/1363_2.png) [@pip010](https://discourse.itk.org/u/pip010)
#### Post date: [March 9, 2021, 12:52pm UTC](https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941/3 "2021-03-09T12:52:58Z")

</div>

MattesMutualInformation really works different than the rest and in fact does not fit conceptually the ITK framework, the transformation is non-linear so the cost per iteration is higher than the rest of the co-reg algorithms. Several things you can try: (1) relax the criteria for convergence (2) do provide better initial transform. Also, as @dzenanz suggested try not to use debug but instead use release with debug symbols.

---

<div class="post-metadata">

### Author: ![PauloFavero](https://discourse.itk.org/user_avatar/discourse.itk.org/paulofavero/32/1907_2.png) [@PauloFavero](https://discourse.itk.org/u/PauloFavero)
#### Post date: [March 9, 2021, 1:54pm UTC](https://discourse.itk.org/t/speed-up-itk-registration-pipeline/3941/4 "2021-03-09T13:54:37Z")

</div>

Thanks everyone.  
I was sure to be running on release mode. Later on, I found an error on my CMake file that was making it to always build on debug.

Now, the registration task is running on 2 seconds 🙂
