<div dir="ltr">Hi all,<br><div class="gmail_quote"><div dir="ltr"><div><br></div><div>Im printing out values of metric following Bspline registrations, using an observer connected to the optimizer.</div>
<div><br></div><div>However when using boptimizer->SetMaximumNumberOfIterations( 2 ); </div><div><br></div><div>I actually get 8 values printed out: see below. The command iteration update code is also attched. At first I thought it was because I use multiple observers during each multiresolution step but also removeallobservers() between each multi layer step. Any suggestions appreciated?</div>
<div><br></div><div><br></div><div><div>Starting Registration with Medium resolution transform</div><div>1.07399e+06 </div><div>bspline</div><div>1.06241e+06 </div><div>bspline</div><div>1.01962e+06 </div>
<div>bspline</div><div>1.01962e+06 </div><div>bspline</div><div>895448 </div><div>bspline</div><div>895448 </div><div>bspline</div><div>878673 </div><div>bspline</div><div>878673 </div><div>bspline</div><div><br>
</div></div><div><br></div><div><div> </div><div>//This is for B spline</div><div> </div><div> class BCommandIterationUpdate : public itk::Command</div><div>{</div><div>public:</div><div> typedef BCommandIterationUpdate Selfb;</div>
<div> typedef itk::Command Superclassb;</div><div> typedef itk::SmartPointer<Selfb> Pointerb;</div><div> itkNewMacro( Selfb );</div><div>protected:</div><div> BCommandIterationUpdate() {};</div><div>
public:</div><div> typedef itk::LBFGSBOptimizer bOptimizerType;</div><div> typedef const bOptimizerType * bOptimizerPointer;</div><div><br></div><div> void Execute(itk::Object *caller, const itk::EventObject & event)</div>
<div> {</div><div> Execute( (const itk::Object *)caller, event);</div><div> }</div><div><br></div><div> void Execute(const itk::Object * object, const itk::EventObject & event)</div><div> {</div><div> bOptimizerPointer boptimizer =</div>
<div> dynamic_cast< bOptimizerPointer >( object );</div><div> if( ! itk::IterationEvent().CheckEvent( &event ) )</div><div> {</div><div> return;</div><div> }</div><div> //std::cout << optimizer->GetCurrentIteration() << " ";</div>
<div> std::cout << boptimizer->GetValue() << " " <<std::endl;</div><div> std::cout << "bspline" <<std::endl;</div><div> //std::cout << optimizer->GetCurrentPosition() << std::endl;</div>
<div> }</div><div>};</div><div> </div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
</div><br></div>