Hi Syed,<br><br>Yes, I posted it on the vxlusers list since several vxl optimizers don't support a callback method to stop optimization. <br><br>Your
method to terminate like that won't work for the amoeba. The point
being that the amoeba optimizer internally instantiates another amoeba class,
(by that I mean that the class is local in scope to the optimization function in the
amoeba class), called an "amoebaFit" that does the optimization for
you. You never really have access to this class and saying <br><br> terminator->set_max_interations(0); <br>isn't going to do anything once you've started optimization.<br><div id="mb_1"><br>What
I ended up doing was adding callback support to the class. You should find the modified files here itkAmoebaOptimzer2.* and the class it users vnl_amoeba2.* in kitware's ftp site (my previous mail bounced):<br><br> ftp
<a href="http://public.kitware.com">public.kitware.com</a> <br> (Username: ftpuser Password: public)<br> cd pub/itk/UsersITK/amoeba<br> <br>The callback is invoked at every iteration from the amoeba optimzier
and you can check whatever you need from the callback and abort if you
like. [The calldata is initiazed to that locally created amoebaFit
class, so you have access to it from the user callback].
<br><br>The way to use it is :<br><br>---------<br><br>void GUIClass::AmoebaIterationCallback( void *cd ) // declare as a static void method<br>{<br> if( !cd )<br> {<br> return;<br> }<br><br> vnl_amoeba2::IterationCallbackCallData *calldata =
<br> (vnl_amoeba2::IterationCallbackCallData*)(cd);<br><br> Self *client = (Self *)(calldata->client_calldata);<br><br> if( client->GetAbort()) // Abort this resolution<br> {<br> calldata->stop_optimization = true; // tells ameba opt to stop
<br> client->AbortOff(); // Reset the flag<br> }<br>}<br><br><br>//... Somewhere in the GUI-registration class before you start the optimization... <br>// .. pass yourself as calldata, so you have access to GUI methods from the
<br>// callback.<br><br>registrationMethod->GetOptimizer()->set_iteration_callback( AmoebaIterationCallback, (this) );<br><br> .. <br>// In your GUI class, when you need to abort<br>
this->SetAbort(true);<br>--------<br><br>HTH<br>-karthik</div><br><br><div><span class="gmail_quote">On 1/11/07, <b class="gmail_sendername">Syed Hassan Amin</b> <<a href="mailto:hassanamin_77@yahoo.com">hassanamin_77@yahoo.com
</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 Karthik,<br> I am a PhD student . The reason I am bothering you<br>
is that I want to terminate vnl_amoeba pre maturely. I<br>tried to change to the values of different parameters<br>such as :-<br>terminator->set_max_iterations(0);<br> terminator->set_x_tolerance(5);<br> terminator->set_f_tolerance(5);
<br>where terminator has a pointer to the calling<br>vnl_amoeba optimizer. But still optimizer goes on to<br>perform hundereds of iterations before terminating.<br>You once initiated a discussion along these lines . If<br>
you did implement solution for above mentioned problem<br>, could you please share it with me.<br><br>Regards,<br><br>Hassan Amin<br><br><br><br><br>____________________________________________________________________________________
<br>Need a quick answer? Get one in minutes from people who know.<br>Ask your question on <a href="http://www.Answers.yahoo.com">www.Answers.yahoo.com</a><br></blockquote></div>