<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Dear Luis<br>Thank you for your reply. My question is that <br>In multivariate statisticsk, if it will be common to express a Gaussian density function as:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exp( - mahalanobisDistance ^ 2 )<br>In this way, using Gaussian Density Function with maximum decision rule or MahalanobisDistance distance with minimum decision rule will give the same classification result.<br>However, the true Gassian PDF is (1/det(covmatrix)^0.5)*  exp( - mahalanobisDistance ^ 2 ). So Gaussian Density Function with maximu decision rule or MahalanobisDistance distance with mimimum decision rule will give us difference result even the difference is minor.<br><br>So my understanding:<br>1: Since I use GassianMixture model in EM, the natual way
 should be used GassianDensity Function in MRFImageFilter. However, I do not know how to change MRRImageFilter class lessly to get this.<br>2: Does the itk new statistic framework surpport EM on the Image since I am thinking to do something similar with FSL(HMM sovled by EM), thus spatial prior need to be inserted into EM iteration. Can I do this in the new ITK framework? I think I may modify the itkMRFImageFilter to interated EM, that means I need to calculate the EM parameters and update them inside the MRFImageFilter since MRFImageFilterDoNeiborhood alreay provied me the spatial prio. Do you have any suggestions?<br>3: To be honest with you, I have compared the result I compose based on itkExpectationEstimator followed by MRFImageFilter with FSL result based on brainweb date with noise but without bias field. The result I obtained is comparable with FSL. My result underestimated the grey matter somehow, but FSL underestimate the white matter.
 Certainly the comparision is not completely, but I have a feeling the two solution may give similar results. But it looks to me theortically, FSL solution seems more reasonable or should be better since MRF interated in EM. Would you like to give any comments.<br>4: In my furture work, I will certainly like to have spatial prio obtained from atlas into EM.&nbsp; So I am seriously in using ITK to do the work. Any suggestions?<br>5: I knew slice implemented EM with MRF field. Can you tell me whether they do MRF followed EM or fully insert MRF spatial info into EM.<br><br>Thanks<br><br>Baoyun<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Luis Ibanez &lt;luis.ibanez@kitware.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Baoyun Li
 &lt;baoyun_li123@yahoo.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> insight-users@itk.org<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, March 31, 2009 5:26:14 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: is it limitation in itkMRFImageFilter class?<br></font><br>
Hi Baoyun,<br><br>There is an important difference between:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  A) Density functions, and<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  B) Distance functions<br><br><br>in particular,<br>Typically density functions decrease in value as you move away from the origin,<br>(or wherever they are centered), while distance functions increase when you<br>move away.<br><br>You seem to be confusing the use of a GaussianDensityFunction, with the<br>one of a MahalanobisDistance.<br><br>That is:<br><br>&nbsp; &nbsp; &nbsp; 1) Gaussian&nbsp; &nbsp; exp( - ( x / sigma )^2 )<br><br>&nbsp; &nbsp; &nbsp; 2) Mahalanobis distance =&nbsp; &nbsp; sqrt(&nbsp;  X . E . X^t&nbsp;  )<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  where E is the covariance matrix of the distribution<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and X is an N-dimensional array with coordinates&nbsp; in this space.<br><br>You may want to take a look at:<br><br><br><span>* <a
 target="_blank" href="http://en.wikipedia.org/wiki/Normal_distribution">http://en.wikipedia.org/wiki/Normal_distribution</a></span><br><span>* <a target="_blank" href="http://en.wikipedia.org/wiki/Mahalanobis_distance">http://en.wikipedia.org/wiki/Mahalanobis_distance</a></span><br><br>In multivariate statistics it will be common to express a<br>Gaussian density function as:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exp( - mahalanobisDistance ^ 2 )<br><br><br>BTW: If you are planning on making a serious use of<br>&nbsp; the ITK statistics framework, you may want to look<br>&nbsp; at the refactored version described in:<br><br><span><a target="_blank" href="http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007">http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007</a></span><br><br><br>&nbsp; &nbsp; &nbsp;  Regards,<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
 Luis<br><br><br>----------------------------------------<br>On Wed, Mar 25, 2009 at 4:01 PM, Baoyun Li &lt;<a ymailto="mailto:baoyun_li123@yahoo.com" href="mailto:baoyun_li123@yahoo.com">baoyun_li123@yahoo.com</a>&gt; wrote:<br>&gt; Dear Luis and All:<br>&gt;<br>&gt; I am woring on EM and MRF for image segmentation. I made the EM clustering<br>&gt; working, and then using the segmenation result to perfrom MRF for refinment.<br>&gt;<br>&gt; I followed the styles in ITK example ScalarImageMarkovRandomField1.cxx&nbsp;&nbsp;.<br>&gt;<br>&gt; If I use the DistancCentroid as membershim function of the classifier, I can<br>&gt; get the segmetation improved after MRF filter.<br>&gt;<br>&gt; Since I using EM GaussianMixture model to intial segmentation, I think using<br>&gt; itkGaussianDensityFunction as membership function of classifier may give<br>&gt; better result.<br>&gt;<br>&gt; When I changed the membership function, the result is totally wrong, then
 I<br>&gt; checked the code for itkMRFImageFilter..cxx, I figure out why.<br>&gt;<br>&gt; //////////////////////////////////////////////////////////////////////////////////<br>&gt;<br>&gt; 00625&nbsp;&nbsp; const std::vector&lt;double&gt; &amp; pixelMembershipValue =<br>&gt; 00626&nbsp;&nbsp;&nbsp;&nbsp; m_ClassifierPtr-&gt;GetPixelMembershipValue( *inputPixelVec );<br>&gt; 00648&nbsp;&nbsp; //Add the prior probability to the pixel probability<br>&gt; 00649&nbsp;&nbsp; for( index = 0; index &lt; m_NumberOfClasses; index++ )<br>&gt; 00650&nbsp;&nbsp;&nbsp;&nbsp; {<br>&gt; 00651&nbsp;&nbsp;&nbsp;&nbsp; m_MahalanobisDistance[index] = m_NeighborInfluence[index] -<br>&gt; 00652&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pixelMembershipValue[index] ;<br>&gt; 00653&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; ////////////////////////////////////////////////////////////////////////////////<br>&gt;<br>&gt; In line 651, when calculating the MahaanoistDistance,<br>&gt;
 m_MahalanobisDistance[index] = m_NeighborInfluence[index] -<br>&gt; pixelMembershipValue[index] ;<br>&gt; assuming my weight are all zeros, then class with maximum pdf will give the<br>&gt; lowest Distance. As a result, the segmentation is fully wrong.<br>&gt;<br>&gt; My question is why the filter was designed in the way,&nbsp;is MRFImageFilter not<br>&gt; designed to&nbsp;apply GassianDensityFuncion as membershipfunction.<br>&gt;<br>&gt; Can I still use GaussianDensityFunction in this case?&nbsp;Would if work if I<br>&gt; &nbsp;change the sign of code 651 to +?<br>&gt;<br>&gt; Please give me some guide.<br>&gt;<br>&gt; Baoyun<br>&gt;<br>&gt;<br></div></div></div><br>

      </body></html>