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

Thomas - Kuiran Chen chent at cs.queensu.ca
Wed Aug 4 00:10:25 EDT 2004


Hi Luis,

Thanks for the message.

I did catch and print out the error message coming out of the optimizer:

ITK ExceptionObject caught !
itk::ExceptionObject (0105F1F0)
Location: "Unknown"
File: c:\thomas_k_chen\data_research\projects\thirdparty\itk-1.6.0\code\algorithms\itkMattesMutualInformationImageToImageMetric.txx  
Line: 546
Description: itk::ERROR: MattesMutualInformationImageToImageMetric(0180FEA0): Too many samples map outside moving image buffer: 1535 / 6581

What confused me is, if I test individual two images to perform the registration using Mattes mutual information, there is no exception at all.  But when I used a for-loop to compare images pair by pair, I got exceptions thrown randomly (sometimes happened to this pair of images, sometimes the other):

e.g.:

for(counter)
{
	// 2000 pairs of images to compare
	mattes mutual information registration wrapper.
}

Now I bypassed this problem by using:

for(counter)
{
	// 2000 pairs of images to compare
	try
	{
	  	mattes mutual information registration wrapper.
	}
	catch(e)
	{
		reduce the counter;
		continue; 
	}
}

This way I was able to complete the loop, but still what caused the exception remains a mystery to me.

The initial transform shouldn't be the culprit because it starts with identiy transform (zero translations).

What I suspect is that the sampling points (for both images) are generated on a random base, and in some case, the picked points are not overlapping each other enough.

Thanks a lot,
Thomas



---------------------- Original Message ------------------------
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Thomas - Kuiran Chen <chent at cs.queensu.ca>
Sent: 2004-08-03 00:32:27
Subject: Re: [Insight-users] Optimizer's Exception in Mattes Mutual InformationImplementation

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