[Insight-users] iteration number and optimizer values

Luis Ibanez luis . ibanez at kitware . com
Fri, 22 Aug 2003 12:58:05 -0400


Hi Michael,

Thanks for your detailed analysis.

Following your suggestion, the order of the methods

     InvokeEvent()     and     SetCurrentPosition()

has now been reversed in the file
itkQuaternionRigidTransformGradientDescentOptimizer.cxx



You may have to CVS update in order to get this fix.

Please let us know if you find any further problems,


   Thanks


     Luis


-----------------------
Michael Kuhn wrote:
> Hi Luis,
> 
> I've again had a look at the values obtained by my observer (an 
> itk::Command object) that is observing a 
> QuaternionRigidTransformGradientDescentOptimizer. I believe to have 
> noticed the follwing things:
> 
> 1. ) At iteration n, the metric value does not correspond to the current 
> position. The event is only triggered after the new position is set to 
> the optimizer (in QuaternionRigidTransformGradientDescentOptimizer):
> 
>  this->SetCurrentPosition( newPosition );
>  this->InvokeEvent( IterationEvent() );
> 
> Therefore, the optimizer already returns the position based on which the 
> metric value is calculated in iteration n + 1. Thus, the position 
> obtained from the optimizer by calling optimizer->GetCurrentPosition() 
> in iteration n corresponds to the metric value obtained by calling 
> optimizer->GetValue() in iteration n + 1. (compare the "pseudo output" 
> below)
> 
> 
> 2. ) The iteration number obtained by optimizer->GetCurrentIteration() 
> (say, n) is increased by 1 compared to the iteration number of the last 
> iteration event (n - 1). The transform is the "new position" set before 
> invoking the last iteration event (n - 1) and would thus corresponds to 
> the metric value in iteration n (that is not executed, since we are at 
> the end of the optimization process). However, there is no new metric 
> value computed, therefore the metric value is the same as the one 
> obtained during the last iteration event (n - 1). Therefore, the metric 
> value now differs by two steps from the position. (compare the "pseudo 
> output" below)
> 
> I think, for debugging purposes it would be helpful if the three values 
> would correspond with respect to their index in every event.
> 
> Thanks,
> 
> Michael
> 
> 
> pseudo output of an observer:
> ====================
> ---typeid(event): start--------
> current iteration 0
> current position: p0 (= initial guess)
> metric value: 0
> ------------------------------
> 
> ---typeid(event): iteration-----
> current iteration: 0
> current position p1
> metric value: m0
> ------------------------------
> 
> ---typeid(event): iteration-----
> current iteration: 1
> current position p2
> metric value: m1
> ------------------------------
> 
> ---typeid(event): iteration-----
> current iteration: 2
> current position p3
> metric value: m2
> ------------------------------
> 
> ---typeid(event):end---------
> current iteration: 3
> current position p4
> metric value: m2
> ------------------------------
> 
> 
> 
> 
> <http://www . itk . org/Insight/Doxygen/html/classitk_1_1QuaternionRigidTransformGradientDescentOptimizer . html> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>