[Insight-users] Texture analysis with masks

Hernan Ledesma fledesma at inti.gob.ar
Fri Sep 21 10:46:37 EDT 2012


Hello,

I used ScalarImageToCooccurrenceMatrixFilter and 
HistogramToTextureFeaturesFilter for texture analysis with success. But 
I get invalid results using masks, i.e. Energy=-nan.

Please see the following code snippet

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    typedef itk::Image<InputPixelType,2> GLCMImageType;
    typedef 
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter<GLCMImageType> 
GLCMType;
    typedef GLCMType::HistogramType HistogramType;
    typedef 
itk::Statistics::HistogramToTextureFeaturesFilter<HistogramType> 
GLCMFeaturesType;

    GLCMType::Pointer glcmGenerator=GLCMType::New();
    typedef GLCMType::OffsetType OffsetType;
    OffsetType offset={{1,0}};
    glcmGenerator->SetOffset(offset);
    
importFilter2->SetImportPointer((InputPixelType*)s_plane->imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);
    glcmGenerator->SetInput(importFilter2->GetOutput());

    GLCMFeaturesType::Pointer glcmCalculator=GLCMFeaturesType::New();

    for (int i=0; i<blobs.GetNumBlobs(); i++)
    {
       currentBlob=blobs.GetBlob(i);
       currentBlob.FillBlob(mask_image,CV_RGB(255,255,255));

       
importFilter1->SetImportPointer((InputPixelType*)mask_image->imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);

       glcmGenerator->SetMaskImage(importFilter1->GetOutput());
       glcmCalculator->SetInput(glcmGenerator->GetOutput());
       glcmCalculator->Update();

       // Features
       double energy=glcmCalculator->GetFeature(GLCMFeaturesType::Energy);
        .
        .
        .
     }
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Has anyone an idea to solve?

Thanks in advance.

F. Hernán Ledesma.
<http://www.itk.org/Doxygen/html/classitk_1_1ScalarImageToCooccurrenceMatrixFilter.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120921/6c82e4c0/attachment.htm>


More information about the Insight-users mailing list