<html><body>Hi Jose,<br><p><br></p><p>(2) is one of the ways to compute mutual information, you get it from the definition by using the properties of log function and marginalization in the summands you get.<br></p><p><br></p><p>However, I think the class you want to create already exists, I havent used ITK for some time, but it should be called NormalizedMutualInformationHistogramImageToImageMetric.</p><p><br></p><p>Best,</p><p>T.<br></p><p><br>---------- Původní zpráva ----------<br>Od: Josem <jose@apollomit.com><br>Datum: 26. 11. 2012<br>Předmět: [Insight-users] Modifying Mattes MI to provide a Normalized MI</p><blockquote>Hello, <br>I have searched around the web for answers but i am still stuck with this<br>issue:<br>I am trying to modify the itkMattesMutualInformationImageToImageMetric.hxx<br>file to provide the Normalized Mutual Information.<br>I found this post:<br><a href="http://public.kitware.com/pipermail/insight-users/2006-May/017911.html">http://public.kitware.com/pipermail/insight-users/2006-May/017911.html</a><br>Where they say that I should modify the lines 815-832, but i think the post<br>is outdated.<br><br>I also checked the GetValue() Method, and i think that's the method i have<br>to modify. But i can't figure it out.<br>Here are the lines where i think i should modify the code:<br><br> /**<br> * Compute the metric by double sumdation over histogram.<br> */<br><br> // Setup pointer to point to the first bin<br> JointPDFValueType *jointPDFPtr =<br>this->m_ThreaderJointPDF[0]->GetBufferPointer();<br><br> PDFValueType sum = 0.0;<br> for( unsigned int fixedIndex = 0;<br> fixedIndex < this->m_NumberOfHistogramBins;<br> ++fixedIndex )<br> {<br> const PDFValueType fixedImagePDFValue =<br>this->m_ThreaderFixedImageMarginalPDF[0][fixedIndex];<br> for( unsigned int movingIndex = 0;<br> movingIndex < this->m_NumberOfHistogramBins;<br> ++movingIndex, jointPDFPtr++ )<br> {<br> const PDFValueType movingImagePDFValue =<br>this->m_MovingImageMarginalPDF[movingIndex];<br> const PDFValueType jointPDFValue = *( jointPDFPtr );<br><br> // check for non-zero bin contribution<br> static const PDFValueType closeToZero =<br>vcl_numeric_limits<PDFValueType>::epsilon();<br> if( jointPDFValue > closeToZero && movingImagePDFValue > closeToZero<br>)<br> {<br> const PDFValueType pRatio = vcl_log(jointPDFValue /<br>movingImagePDFValue);<br> if( fixedImagePDFValue > closeToZero )<br> {<br> sum += jointPDFValue * ( pRatio - vcl_log(fixedImagePDFValue) );<br> }<br> } // end if-block to check non-zero bin contribution<br> } // end for-loop over moving index<br> } <br><br><br>But i don't know where should i modify the computation to do this:<br>(1) NMI = ( Ha + Hb ) / Hab<br>instead of this computation:<br>(2) MI = Ha + Hb - Hab<br><br>Basically i don't get where computation (2) is going on.<br><br>thanks in advance,<br>Jose<br><br><br><br><br><br>--<br>View this message in context: <a href="http://itk-users.7.n7.nabble.com/Modifying-Mattes-MI-to-provide-a-Normalized-MI-tp30155.html">http://itk-users.7.n7.nabble.com/Modifying-Mattes-MI-to-provide-a-Normalized-MI-tp30155.html</a><br>Sent from the ITK - Users mailing list archive at Nabble.com.<br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a></blockquote></body></html>