[Insight-users] mutual information measure

Luis Ibanez luis.ibanez@kitware.com
Fri, 03 Jan 2003 17:27:15 -0500


Hi Jorn,


You can find information about the optimizers on the
manual pages generated by Doxygen:


For example:

http://public.kitware.com/Insight/Doxygen/html/classitk_1_1GradientDescentOptimizer.html
http://public.kitware.com/Insight/Doxygen/html/classitk_1_1RegularStepGradientDescentBaseOptimizer.html


GetValue() returns the content of the member
variable: "m_Value".

In the case of itk::GradientDescentOptimizer, this
variable is computed in the "ResumeOptimization()"
method.  You can find the method on the file:

Insight/Code/Numerics/itkGradientDescentOptimizer.cxx

on line:  92.

The optimizer asks the Costfunction to return by reference
its value and the value of its derivative. This is done
with the "GetValueAndDerivative()" method of the costfunction.
(in this case, the ImageMetric).




In the case of the itk::RegularStepGradientDescentOptimizer
the content of m_Value is computed on the "ResumeOptimization()"
method on line 82 of

Insight/Code/Numerics/itkRegularStepGradientDescentOptimizer.cxx

The value is obtained from the cost function (line 96) using the
method "GetValue()" of the cost function (in this case, the Metric).


So, optimizer->GetValue() will return the most recent evaluation
of the ImageMetric in the current set of parameters.

You can get this value at every iteration of the Optimizer.
In between iteration the value is probably not valid.

If you want to track iterations of the optimizer you may want to
create an Observer and connect it to the Optimizer.

An example on how to do this can be found in any of the
following files in

Insight/Testing/Code/Algorithms


itkImageRegistrationMethodTest_10.cxx
itkImageRegistrationMethodTest_12.cxx
itkImageRegistrationMethodTest_13.cxx
itkImageRegistrationMethodTest_14.cxx
itkImageRegistrationMethodTest_15.cxx
itkImageRegistrationMethodTest_1.cxx
itkImageRegistrationMethodTest_2.cxx
itkImageRegistrationMethodTest_3.cxx
itkImageRegistrationMethodTest_4.cxx
itkImageRegistrationMethodTest_5.cxx
itkImageRegistrationMethodTest_6.cxx
itkImageRegistrationMethodTest_7.cxx
itkImageRegistrationMethodTest_8.cxx
itkImageRegistrationMethodTest_9.cxx
itkMultiResolutionImageRegistrationMethodTest_1.cxx
itkMultiResolutionImageRegistrationMethodTest_2.cxx
itkMultiResolutionPDEDeformableRegistrationTest.cxx



Optimizers invoke an "IterationEvent" at each iteration.

By creating an Observer and connecting it to the optimizer
you may arrange for a function in your observer to be
executed at each iteration of the Optimizer.

Typically this function in the observer will query
the Optimizer for its current parameters and the value
of GetValue() and print them out or save them to a
file.

This is the typical way of tracing the evolution
of an registration process.

This is also the expected mechanism to be used in
order to communicate with a GUI.

Details about the interpretation of the Value returned
by image metrics can be found in the document


    InsighDocuments/Web/HTML/SoftwareGuide.pdf


Please let us know if you have further questions.


   Thanks


    Luis


----------------------

J. Van Dalen wrote:

> THANKS!!! That helps a lot!!!
> 
> I tried to find some information on GetValue(), but without success. Can
> you tell me how optimizer->GetValue() is computed. What is the "exact"
> meaning of it. It is not the value of the cost function, nor the value of
> its derivative (wrt some transformation parameter)... 
> 
> Moreover, can I just get this value after applying the registration? Doing
> some simple tests it seems that - in general - the higher this value, the
> better the registration.
> 
> Thanks again,
> Jorn.
> 
> 
>