# Is there a method to stop the registration process early?

**URL:** <https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791>\
**Category:** Engineering\
**Tags:** registration\
**Created:** [March 10, 2023, 6:57am UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791 "2023-03-10T06:57:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ma1282029525](https://discourse.itk.org/user_avatar/discourse.itk.org/ma1282029525/32/3084_2.png) [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Post date:** [March 10, 2023, 6:57am UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791/1 "2023-03-10T06:57:46Z")

</div>

I want to stop the registration process early,but I’m not sure how.

---

<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 10, 2023, 2:26pm UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791/2 "2023-03-10T14:26:26Z")

</div>

Maybe observe iteration steps and try to invoke abort? Starting [example](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/RegistrationITKv4/ImageRegistration3.cxx).

---

<div class="post-metadata">

**Author:** ![ma1282029525](https://discourse.itk.org/user_avatar/discourse.itk.org/ma1282029525/32/3084_2.png) [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Post date:** [March 13, 2023, 3:42am UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791/3 "2023-03-13T03:42:46Z")

</div>

Abort interface not found. Perhaps I can observe the current number of iterations, and then change the number of iterations to terminate the registration in advance?

---

<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 13, 2023, 2:43pm UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791/4 "2023-03-13T14:43:03Z")

</div>

Worth a try. Also try `optimizer->Stop()`, similarly to this:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/v5.3.0/Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration3.cxx#L209-L211>

---

<div class="post-metadata">

**Author:** ![ma1282029525](https://discourse.itk.org/user_avatar/discourse.itk.org/ma1282029525/32/3084_2.png) [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Post date:** [March 14, 2023, 1:01am UTC](https://discourse.itk.org/t/is-there-a-method-to-stop-the-registration-process-early/5791/5 "2023-03-14T01:01:02Z")

</div>

thank you very much
