[Insight-users] Optimizer's Exception in Mattes Mutual Information Implementation

Luis Ibanez luis.ibanez at kitware.com
Tue Aug 3 00:32:27 EDT 2004


Hi Thomas,


It is unlikely for optimizers to throw exceptions. If you are getting
some, chances are that they are comming from the ImageMetrics.

The typical case is when the transform is so far off the mark that
the two image are not overlapped at all, or overlap in a very small
region. In those circumstances the metric is not able to compute
meaninful values and derivatives.


NOTE you will understand better the process if you print out the
description returned by the exception when you are inside the
catch block.  It will look like

 > try
 >     {
 >     // do the optimization
 >     m_Optimizer->StartOptimization();
 >     }
 >   catch( ExceptionObject& err )
 >     {
 >     // An error has occurred in the optimization.
 >     // Update the parameters
 >     m_LastTransformParameters = m_Optimizer->GetCurrentPosition();

       // PLEASE ADD THIS LINE
       std::cerr << err << std::endl;

 >
 >     // Pass exception to caller
 >     throw err;
 >     }
 >


The problem itself is not in the size of the histograms used
for estimating mutual information, but in the initialization
of the transform and the step size used by the optimizers.

If your transform is going off the overlapping regions,
it is likely that your optimization steps are too large,
and/or your initial transform is quite a bad initial position.



Regards,



     Luis


----------------------------
Thomas - Kuiran Chen wrote:

> Hi Luis,
> 
> I am running into another interesting problem while using the Mattes' mutual information implementation with ultrasound images in ITK.  :-)
> 
> My question is: in which circumtances, will the optimizer throw an exception?  
> 
> In particular, for the Mattes implementation, the only change I made is I switched from one set of input images to another set of input images, while both sets are ultrasound images.  For one set of the inputs, the optimizer throwed the exception in the following position (with err = 0):
> 
> itkImageRegistrationMethod.txx:
> 
> try
>     {
>     // do the optimization
>     m_Optimizer->StartOptimization();
>     }
>   catch( ExceptionObject& err )
>     {
>     // An error has occurred in the optimization.
>     // Update the parameters
>     m_LastTransformParameters = m_Optimizer->GetCurrentPosition();
> 
>     // Pass exception to caller
>     throw err;
>     }
> 
> The details symptoms are:
> 
> 1. When I used 1st set of ultrasound images (2000 of them, each of 381x343 pixels), histogram bin size = 50, sampling rate = 1%, the Mattes mutual information implementation ran properly, without any programatic or runtime errors;
> 
> 2. Then I used 2nd set of ultrasound images (2000 of them, each of 191x341 pixels), histogram bin size = 50, sampling rate = 1% or 10%
> -  if I just use 200 images out of the 2000, the Mattes implementation worked with no problems (just as  in 1);
> - if I choose to use more than 300 images out of the 2000, the above exception was thrown, with err = 0;  I even increased the sampling rate to 30%, but the problem persisted.
> 
> The two sets ultrasound images were captured using the same machine and same settings, but on different subjects: one with the soft tissues and one without.  The problem occured when I used the images of soft tissues.  But the only difference that I can tell between these two image sets are: 
> - image size, and 
> - different histogram distribution (images of soft tissue have more histogram variance).
> 
> What confused me is all of my 2000 ultrasound are basically similar in either intensity distribution or noise levels, but in some case (like few images through the loop) the program worked, but it didn't whe I increased the number of input images through the loop.
> 
> Kindly please enlighten me, :-).
> 
> Thanks very much!
> 
> Thomas Kuiran Chen
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 






More information about the Insight-users mailing list