<!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>
&nbsp;&nbsp; typedef itk::Image&lt;InputPixelType,2&gt; GLCMImageType;<br>
&nbsp;&nbsp; typedef
itk::Statistics::ScalarImageToCooccurrenceMatrixFilter&lt;GLCMImageType&gt;
GLCMType;<br>
&nbsp;&nbsp; typedef GLCMType::HistogramType HistogramType;<br>
&nbsp;&nbsp; typedef
itk::Statistics::HistogramToTextureFeaturesFilter&lt;HistogramType&gt;
GLCMFeaturesType;<br>
<br>
&nbsp;&nbsp; GLCMType::Pointer glcmGenerator=GLCMType::New();<br>
&nbsp;&nbsp; typedef GLCMType::OffsetType OffsetType;<br>
&nbsp;&nbsp; OffsetType offset={{1,0}};<br>
&nbsp;&nbsp; glcmGenerator-&gt;SetOffset(offset);<br>
&nbsp;&nbsp;
importFilter2-&gt;SetImportPointer((InputPixelType*)s_plane-&gt;imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);<br>
&nbsp;&nbsp; glcmGenerator-&gt;SetInput(importFilter2-&gt;GetOutput());<br>
<br>
&nbsp;&nbsp; GLCMFeaturesType::Pointer glcmCalculator=GLCMFeaturesType::New();<br>
<br>
&nbsp;&nbsp; for (int i=0; i&lt;blobs.GetNumBlobs(); i++)<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentBlob=blobs.GetBlob(i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentBlob.FillBlob(mask_image,CV_RGB(255,255,255));<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
importFilter1-&gt;SetImportPointer((InputPixelType*)mask_image-&gt;imageData,numberOfPixels,importImageFilterWillOwnTheBuffer);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; glcmGenerator-&gt;SetMaskImage(importFilter1-&gt;GetOutput());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; glcmCalculator-&gt;SetInput(glcmGenerator-&gt;GetOutput());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; glcmCalculator-&gt;Update();<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Features<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double
energy=glcmCalculator-&gt;GetFeature(GLCMFeaturesType::Energy);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br>
&nbsp;&nbsp;&nbsp; }<br>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
Has anyone an idea to solve?<br>
<br>
Thanks in advance.<br>
<br>
F. Hern&aacute;n Ledesma.<br>
<a
 href="http://www.itk.org/Doxygen/html/classitk_1_1ScalarImageToCooccurrenceMatrixFilter.html"
 class="external text" rel="nofollow"></a><br>
</body>
</html>