<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hello,<br>
<br>
I used ScalarImageToCooccurrenceMatrixFilter and
HistogramToTextureFeaturesFilter for texture analysis with success. But
I get invalid results using masks, i.e. Energy=-nan. <br>
<br>
Please see the following code snippet<br>
<br>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
typedef itk::Image<InputPixelType,2> GLCMImageType;<br>
typedef
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter<GLCMImageType>
GLCMType;<br>
typedef GLCMType::HistogramType HistogramType;<br>
typedef
itk::Statistics::HistogramToTextureFeaturesFilter<HistogramType>
GLCMFeaturesType;<br>
<br>
GLCMType::Pointer glcmGenerator=GLCMType::New();<br>
typedef GLCMType::OffsetType OffsetType;<br>
OffsetType offset={{1,0}};<br>
glcmGenerator->SetOffset(offset);<br>
importFilter2->SetImportPointer((InputPixelType*)s_plane->imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);<br>
glcmGenerator->SetInput(importFilter2->GetOutput());<br>
<br>
GLCMFeaturesType::Pointer glcmCalculator=GLCMFeaturesType::New();<br>
<br>
for (int i=0; i<blobs.GetNumBlobs(); i++)<br>
{<br>
currentBlob=blobs.GetBlob(i);<br>
currentBlob.FillBlob(mask_image,CV_RGB(255,255,255));<br>
<br>
importFilter1->SetImportPointer((InputPixelType*)mask_image->imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);<br>
<br>
glcmGenerator->SetMaskImage(importFilter1->GetOutput());<br>
glcmCalculator->SetInput(glcmGenerator->GetOutput());<br>
glcmCalculator->Update();<br>
<br>
// Features<br>
double
energy=glcmCalculator->GetFeature(GLCMFeaturesType::Energy);<br>
.<br>
.<br>
.<br>
}<br>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
Has anyone an idea to solve?<br>
<br>
Thanks in advance.<br>
<br>
F. Hernán Ledesma.<br>
<a
href="http://www.itk.org/Doxygen/html/classitk_1_1ScalarImageToCooccurrenceMatrixFilter.html"
class="external text" rel="nofollow"></a><br>
</body>
</html>