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">http://img15.imageshack.us/img15/4683/lenad.jpg</a><br><br>Moving: <a href="http://img15.imageshack.us/img15/4364/lenadeform1.jpg">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">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>