[Insight-users] BUG in MattesMI (FixedImageMask, UseAllPixelsOn)

Luis Ibanez luis.ibanez at kitware.com
Mon Sep 4 15:13:58 EDT 2006


Hi Rakesh


Thanks for sharing with us the work around that you are using.


I should be missing something, because this still doesn't seem
to be a bug to me.



When "UseAllPixels" is ON, the MattesMI metric use the method
SampleFullFixedImageDomain() in order to collect the samples.

In this method, a standard ImageRegion iterator is used for
walking through the FixedImageRegion, by visiting all the
pixels.

If a particular pixel is outside of the FixedImageMask, then
the pixel is not included in the container of spatial samples.
(Line 529), and the iterator simply goes to the next pixel,
which is still inside the FixedImageRegion.

What may actually be a problem is that the code is not updating
the *actual* number of samples that did make it through the mask.

Therefore, the container that was expecting N samples may end up
being populated with only M (M<N) samples, because the others
fell outside the Fixed image mask.

This disagreement will be misleading in line 719 where the metric
verifies during the registration, whether enough samples fell
inside the overlap between the fixed image and the moving image.
In line 719 instead of using m_NumberOfSpatialSamples we should
be using m_FixedImageSamples.size() which is the effective number
of samples in the container.



----------



About your question:

Yes, you can set masks in the Moving image too.
Please look at the ITK Software Guide

    http://www.itk.org/ItkSoftwareGuide.pdf


Section 8.10, "Metrics", pdf-page 447.

and to the documentation of the ImageToImageMetric class:
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageToImageMetric.html



Please let me know if I'm missing the point with this
potential bug report.


    Thanks



       Luis



--------------------------------------
Mullick, Rakesh (GE, Research) wrote:
> Hi Luis,
> 
>  
> 
> Regarding point 3, the work-around we have put in place is as follows:
> 
>  
> 
> //  Recount of non-zero Voxels in mask to set # Samples in MI
> 
> //  Percentage Samples = 1.0 Translates to UseAllPixels in MI
> 
> //  ITK Modification to itkmattesmutualinformationimagetoimagemetric.txx
> 
> //  to only sample voxels in a mask (line 238): Added the condition
> 
> //  && !this->m_FixedImageMask
> 
>  
> 
> Since UseAllPixels is set, the Full Sampling option is chosen and as 
> soon as the correct number of samples is picked (through the raster 
> scan) and by the user setting that count for sampling, the loop 
> terminates giving good results.
> 
>  
> 
> Can a mask be set on the moving image?
> 
>  
> 
> regards,
> 
> rakesh
> 
> ______________________________________________________________________
> 
> Rakesh Mullick, Ph.D., Senior Scientist EMail: Rakesh.Mullick at ge.com
> 
> 
> -----Original Message-----
> Subject: Insight-users Digest, Vol 28, Issue 80
> 
> Today's Topics:
> 
>    3. BUG in MattesMI (FixedImageMask, UseAllPixelsOn)
> 
>       (Christoph Niedermayr)
> 



More information about the Insight-users mailing list