[Insight-users] Modifying Mattes MI to provide a Normalized MI

Josem jose at apollomit.com
Sun Nov 25 19:31:06 EST 2012


Hello, 
I have searched around the web for answers but i am still stuck with this
issue:
I am trying to modify the itkMattesMutualInformationImageToImageMetric.hxx
file to provide the Normalized Mutual Information.
I found this post:
http://public.kitware.com/pipermail/insight-users/2006-May/017911.html
Where they say that I should modify the lines 815-832, but i think the post
is outdated.

I also checked the GetValue() Method, and i think that's the method i have
to modify. But i can't figure it out.
Here are the lines where i think i should modify the code:

 /**
   * Compute the metric by double sumdation over histogram.
   */

  // Setup pointer to point to the first bin
  JointPDFValueType *jointPDFPtr =
this->m_ThreaderJointPDF[0]->GetBufferPointer();

  PDFValueType sum = 0.0;
  for( unsigned int fixedIndex = 0;
       fixedIndex < this->m_NumberOfHistogramBins;
       ++fixedIndex )
    {
    const PDFValueType fixedImagePDFValue =
this->m_ThreaderFixedImageMarginalPDF[0][fixedIndex];
    for( unsigned int movingIndex = 0;
         movingIndex < this->m_NumberOfHistogramBins;
         ++movingIndex, jointPDFPtr++ )
      {
      const PDFValueType movingImagePDFValue =
this->m_MovingImageMarginalPDF[movingIndex];
      const PDFValueType jointPDFValue = *( jointPDFPtr );

      // check for non-zero bin contribution
      static const PDFValueType closeToZero =
vcl_numeric_limits<PDFValueType>::epsilon();
      if( jointPDFValue > closeToZero &&  movingImagePDFValue > closeToZero
)
        {
        const PDFValueType pRatio = vcl_log(jointPDFValue /
movingImagePDFValue);
        if( fixedImagePDFValue > closeToZero )
          {
          sum += jointPDFValue * ( pRatio - vcl_log(fixedImagePDFValue) );
          }
        } // end if-block to check non-zero bin contribution
      }   // end for-loop over moving index
    }    


But i don't know where should i modify the computation to do this:
(1) NMI = ( Ha + Hb ) / Hab
instead of this computation:
(2) MI = Ha + Hb - Hab

Basically  i don't get where computation (2) is going on.

thanks in advance,
Jose





--
View this message in context: http://itk-users.7.n7.nabble.com/Modifying-Mattes-MI-to-provide-a-Normalized-MI-tp30155.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list