[Insight-developers] Re: itk optimizers : VNL optimizers & Iteration updates

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 26 14:39:27 EST 2005



Hi Stefan,

Thanks for your interest in these modifications.

Your question is right on the point. In fact it seems that I forgot
to introduce the call for ReportIteration() in the f() method of the
Vnl cost function adaptor.  I just fixed this in the cvs repository.

Note that this is still somehow a hack, since we are going to get
Events per *evaluation* of the metric instead of *per iteration of
the optimizer*. For example, an optimizer that computes derivatives
by using finite differences in an Affintransform in 3D will report
something like 30 Evaluations of the Metric per Iteration of the
optimizer. It also has the drawback that you will not know for certain
which one of those evaluation is the one that the optimizer is taking
to the next step.  So any plotting of these metric values is going
to be noiser than what you will get if we had the option of reporting
iterations directly from the VNL optimizers.

Your suggestion of caching the Value and Derivatives of the Metric
so it can be read by the IterationCommand is excellent. I added
therefore the methods

     GetCachedValue()
     GetCachedDerivative()
     GetCachedCurrentPosition()

to the optmizer adaptor.

and the methods

     GetCachedValue()
     GetCachedDerivative()
     GetCachedCurrentParameters()

to the cost function adaptor. Note the use of "Position" versus
"Parameters" this is for maintaining consistency with the existing
method "GetCurrentPosition()" in the optimizers.

The Examples ImageRegistration10 and ImageRegistration16 were modified
in order to take advantage of this new iteration updates.


If you have a chance, please update your CVS checkout, and let me
know if the current implementation works fine or whether it requires
some modifications.


   Thanks a lot for your feedback,


      Luis




--------------------
Stefan Klein wrote:

> Hi Luis,
> 
> Watching the itk-cvs repository changes I noticed that you are currently 
> working on iteration reports in the vnl-based ITK-optimizers. This is 
> good news, since I just was thinking of hacking them myselves, in order 
> to make them produce IterationEvents! For sure my hacks would have been 
> ugly, since I want to avoid changing the ITK-classes directly. So, your 
> timing is perfect! :)
> 
> My first question is: when and from where will the ReportIteration 
> method be called? Will it be called after every evaluation of the 
> function value or its derivative (or both)? Or do i miss something, and 
> is the ReportIteration method already invoked somewhere? I couldn't find 
> in the code where that would be.
> 
> Then, my next question is: will it be possible to read the current 
> position, function value and, if computed, the derivative? In my 
> IterationCommand I would like to store the intermediate positions and 
> give feedback about the function value.
> 
> Last question: When will this be implemented completely? (not meant to 
> hurry you, just to know if I should make a fast workaround for my self, 
> or if I'd better wait for your implementation)
> 
> Sorry for bothering you with these questions!
> 
> Stefan.
> 
> 
> 





More information about the Insight-developers mailing list