Hi Motes,<br><br>Why are you introducing the following code ?<br><br><br> OptimizerScalesType optimizerScales(transform-&gt;<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
GetNumberOfParameters() );</blockquote>  const double translationScale = 1.0 / 1000.0;<br>  optimizerScales[0] = 1.0;<br>  optimizerScales[1] = 1.0;<br>  optimizerScales[2] = 1.0;<br>  optimizerScales[3] = translationScale;<br>
  optimizerScales[4] = translationScale;<br>
  optimizerScales[5] = translationScale;<br>  optimizer-&gt;SetScales( optimizerScales );<br><br><br>You don&#39;t need this at all, because the Transform<br>is a BSpline transform. All parameters should have<br>about the same dynamic range.<br>
<br><br>Please remove those lines.<br><br><br>   Thanks<br><br><br>       Luis<br><br><br><br>-----------------------------------------------------------------<br><div class="gmail_quote">On Sun, Jul 12, 2009 at 4:07 AM, motes motes <span dir="ltr">&lt;<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I get an error when I run DeformableRegistration4.c++ related to the  itk::LBFGSOptimizer optimizer.<br>
<br>As Luis recommended I have therefore changed the optimizer to itk::RegularStepGradientDescentOptimizer. I have only changed the following optimizer related code in the example:<br>
<br>From:<br><br>// Old  itk::LBFGSOptimizer settings<br>// optimizer-&gt;SetGradientConvergenceTolerance( 0.05 );<br>// optimizer-&gt;SetLineSearchAccuracy( 0.9 );<br>// optimizer-&gt;SetDefaultStepLength( 1.5 );<br>// optimizer-&gt;TraceOn();<br>

// optimizer-&gt;SetMaximumNumberOfFunctionEvaluations( 1000 );<br><br>To (based on the settings to the  itk::RegularStepGradientDescentOptimizer from DeformableRegistration15.c++ ):<br><br>  OptimizerScalesType optimizerScales(transform-&gt;GetNumberOfParameters() );<br>

  const double translationScale = 1.0 / 1000.0;<br>  optimizerScales[0] = 1.0;<br>  optimizerScales[1] = 1.0;<br>  optimizerScales[2] = 1.0;<br>  optimizerScales[3] = translationScale;<br>  optimizerScales[4] = translationScale;<br>

  optimizerScales[5] = translationScale;<br>  optimizer-&gt;SetScales( optimizerScales );<br>  optimizer-&gt;SetMaximumStepLength( 0.2000  ); <br>  optimizer-&gt;SetMinimumStepLength( 0.0001 );<br>  optimizer-&gt;SetNumberOfIterations( 200 );<br>

  <br><br>But when I run it on the following fixed and moving images:<br><br>Fixed: <a href="http://img15.imageshack.us/img15/4683/lenad.jpg" target="_blank">http://img15.imageshack.us/img15/4683/lenad.jpg</a><br><br>Moving: <a href="http://img15.imageshack.us/img15/4364/lenadeform1.jpg" target="_blank">http://img15.imageshack.us/img15/4364/lenadeform1.jpg</a><br>

<br>the result is completely identical to the moving image:<br><br>Result (registered image): <a href="http://img189.imageshack.us/img189/3148/lenaout.png" target="_blank">http://img189.imageshack.us/img189/3148/lenaout.png</a><br>
<br>Any ideas on what goes wrong? Is it related to the input images or do I need to tweak the new optimizer further?<br>
<br><br>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>