[Insight-users] inputLabelImage is never used in ScalarImageMarkovRandomField1.cxx

Baoyun Li baoyun_li123 at yahoo.com
Mon Mar 23 12:40:47 EDT 2009


Dear All: 

I am going through the example code of itkMRFImageFilter, but I have two questions.

1,  ScalarImageMarkovRandomField1.cxx  require the reference labled image as input;


   typedef itk::ImageFileReader< LabelImageType > LabelReaderType;
   LabelReaderType::Pointer labelReader = LabelReaderType::New();
   labelReader->SetFileName( inputLabelImageFileName );

but in the example code, there is no code like   labelReader->GetOutput(), seems the inputlabled image is never used, why?

2, the example code calculated the meandistance as 

  double meanDistance = 0;
  vnl_vector<double> centroid(1); 
  for( unsigned int i=0; i < numberOfClasses; i++ )
    {
     MembershipFunctionPointer membershipFunction = 
                                         MembershipFunctionType::New();
     centroid[0] = atof( argv[i+numberOfArgumentsBeforeMeans] ); 
     membershipFunction->SetCentroid( centroid );
     classifier->AddMembershipFunction( membershipFunction );
     meanDistance += static_cast< double > (centroid[0]);
    }
   meanDistance /= numberOfClasses;

So if my inputimage is vector image, should I get the mean distance  like sqrt( sum(centroid[NumberofCompoents)).

But finally, the meanditance is only used:

for(std::vector< double >::iterator wIt = weights.begin(); 
      wIt != weights.end(); wIt++ )
    {
    *wIt = static_cast< double > ( (*wIt) * meanDistance / (2 * totalWeight));
    }
  mrfFilter->SetMRFNeighborhoodWeight( weights );

It looks to me the meanDistance has no effect on the result since all the neiborhood weight mutiple by same scale meanDistance.

Can somebody teach me more..

Baoyun



________________________________
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Baoyun Li <baoyun_li123 at yahoo.com>
Cc: insight-users at itk.org
Sent: Saturday, March 21, 2009 12:35:48 PM
Subject: Re: can itkMRFImageFilter discard the intensity information


Hi Baoyun,


Please take a look at the example:

  Insight/Examples/Statistics/
      ScalarImageMarkovRandomField1.cxx

You may find it to be a useful guide on how to use the MRF filter.

I'm not sure what you mean by "using the intensity information".
Could you please explain this in more detail ?

A piece of source code will be great....


    Thanks


        Luis



------------------
Baoyun Li wrote:
> Dear All:
>  After going through the documents for itkMRFImageFilter, I have some doubts about using the intensity information.
>  I understand the filter using Gassian model to relabel the segmeantion image.. But why?
>  In otherwords, if I have already got ok segmeantion result based EM Gaussian Mixuture model, thus I only need hMRF to take care of the continous of the labled segmetation. Seem reclassify the image based on Gassuian model is redundent or make the segmentation worse if I blieved my initial segmentation.
>  If there anyway to ignore using the intensity information.
>  Or I am fundmentally wrong, say that using intensity information certainly can improve the performance.
>  Can somebody teach me?
>  Best regards
>  Baoyun
> 



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090323/ae0a1376/attachment.htm>


More information about the Insight-users mailing list