Hi Syed,<br><br>Yes, I posted it on the vxlusers list since several vxl optimizers don&#39;t support a callback method to stop optimization. <br><br>Your
method to terminate like that won&#39;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 &quot;amoebaFit&quot; that does the optimization for
you. You never really have access to this class and saying <br><br>&nbsp; terminator-&gt;set_max_interations(0); <br>isn&#39;t going to do anything once you&#39;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&#39;s ftp site (my previous mail bounced):<br><br>&nbsp; ftp 
<a href="http://public.kitware.com">public.kitware.com</a>&nbsp; <br>&nbsp;&nbsp;&nbsp; (Username: ftpuser&nbsp;&nbsp;&nbsp; Password: public)<br>&nbsp; cd pub/itk/UsersITK/amoeba<br>&nbsp; <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.&nbsp;&nbsp; [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>&nbsp; if( !cd )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; vnl_amoeba2::IterationCallbackCallData *calldata = 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vnl_amoeba2::IterationCallbackCallData*)(cd);<br><br>&nbsp; Self *client = (Self *)(calldata-&gt;client_calldata);<br><br>&nbsp; if( client-&gt;GetAbort()) // Abort this resolution<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; calldata-&gt;stop_optimization = true; // tells ameba opt to stop
<br>&nbsp;&nbsp;&nbsp; client-&gt;AbortOff();&nbsp; // Reset the flag<br>&nbsp;&nbsp;&nbsp; }<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-&gt;GetOptimizer()-&gt;set_iteration_callback( AmoebaIterationCallback, (this) );<br><br>&nbsp;.. <br>// In your GUI class, when you need to abort<br>


this-&gt;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> &lt;<a href="mailto:hassanamin_77@yahoo.com">hassanamin_77@yahoo.com
</a>&gt; 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>&nbsp;&nbsp;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-&gt;set_max_iterations(0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;terminator-&gt;set_x_tolerance(5);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;terminator-&gt;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>