[Insight-users] RE: potential problem with itkMattesMutualInformationImageToImageMetric when used with fixed image mask

Alex Lisovich alex.lisovich at gmail.com
Tue Apr 24 15:03:43 EDT 2007


Hi All,

  It looks like there is a problem with
itkMattesMutualInformationImageToImageMetric class I've observed while
using it with the fixed image mask, namely:
In case the area/volume of none-zero pixels in the mask image is less
than ¼ of the fixed image itself, the ::GetValueAndDerivative() method
of this class is bound to fail the first time it's called. The reason:

  There is a loop in this method
(for ( fiter = m_FixedImageSamples.begin(); fiter != fend; ++fiter ) {…},
which among other things checks if each pixel in fixed image pixel set
(m_FixedImageSamples)  falls into the moving image through the spatial
transform and counts the number of such valid pixels (nSamples). After
the end of the loop there is a check (if( nSamples <
m_NumberOfSpatialSamples / 4 )) {...} which throws an exception if the
number of such valid pixels is less than ¼ of total number of pixels
(m_NumberOfSpatialSamples).
  The problem here seems to be the following: the
m_NumberOfSpatialSamples is either set to some predefined value
programmatically or equal to the total number of pixels in image. At
the same time, the size if m_FixedImageSamples container gets filled
in the ::SampleFixedImageDomain() method which does random sampling of
image m_NumberOfSpatialSamples times and puts pixels into the
container only when they fall inside the fixed image mask (in case the
mask is used).
  For example, if m_NumberOfSpatialSamples=1000000 and area/volume of
fixed mask is 1/10, then the size of m_FixedImageSamples will be
100000 and the check at the end of the loop mentioned above will
ultimately fail.

  From the other hand, if the mask non-zero area is large enough the
method will never fail and will pass the test.

Please let me know if  this is really a bug or I am getting it wrong

Thank you,

Alex Lisovich


More information about the Insight-users mailing list