Almost all registration methods check if they've been halted/aborted after every iteration and then return with the last computed parameters.<br><br>The base class itk::FiniteDifferenceImageFilter 's GenerateData() method looks like this :
<br><br>while (!this->Halt())<br>{<br> // Do interation<br>}<br><br>You will just need to override this method in your registration method to check for some flag, just like PDEDeformableRegistration::StopRegistration() does .
<br><br><br>-- <br>Karthik Krishnan<br>R&D Engineer,<br>Kitware Inc.<br><br><div><span class="gmail_quote">On 11/11/07, <b class="gmail_sendername">Monica Hernandez</b> <<a href="mailto:mhg@unizar.es">mhg@unizar.es
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Dear ITK users,<br><br>I am working with a child class of a PDEDeformableRegistrationFilter
<br>that uses a sum of squared differences of the images for the energy<br>metric. I would like to stop registration when some condition on the<br>energy curve is hold. In order to do that, my idea was to create a<br>Command Observer in order to track the energy values and see if my
<br>condition holds and stop registration by invoking stopping registration<br>methods. The code would look like something like this<br><br>void Execute(const itk::Object * object, const itk::EventObject & event)<br> {
<br> const MyPDERegistrationFilterType * filter = dynamic_cast<<br>const MyPDERegistrationFilterType * >( object ) ;<br><br> if( cond )<br> {<br> cout << "Stopping algorithm at iteration " <<
<br>filter->GetElapsedIterations() - 1 << ". Condition holds." <<endl;<br><br> // Here I would like to invoke to a method stopping registration<br> }<br> }<br><br>Can registration classes at ITK be "externally" stopped?
<br>If so, what is the correct way of doing that?<br>If not, what could be an alternative way?<br><br>Thank you very much in advance.<br>Monica Hernandez.<br><br>_______________________________________________<br>Insight-users mailing list
<br><a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div>