<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>Hi,<br><br>I'm using the ScalarImageToCooccurrenceMatrixFilter to calculate the GLCM from a 2D image, and want to extend it to 3D as well. I haven't been able to find any good examples on how to use this class, so I've coded using what I could understand from the description and old tests. <br><br>When I run my program on a small 2D image, I get a histogram with no data in it. Can someone please provide some pointers on how to proceed with this? Any help would be much appreciated. I have provided the main part of my code below. <br><br>Thanks in advance.<br><br>typedef float PixelType_in;<br>typedef float RealType;<br> <br>typedef itk::NumericTraits < PixelType_in >::RealType MeasurementType;<br><br>typedef itk::Statistics::Histogram< MeasurementType,
itk::Statistics::DenseFrequencyContainer2 > HistogramType;<br> <br> typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter <InputImageType, <br> itk::Statistics::DenseFrequencyContainer2 > <br> CooccurrenceMatrixFilterType;<br> <br> CooccurrenceMatrixFilterType::Pointer cooccurrenceFilter = CooccurrenceMatrixFilterType::New();
<br> <br> reader->Update();<br> cooccurrenceFilter->SetInput(reader->GetOutput() );<br><br> //Set the histogram parameters<br> cooccurrenceFilter->SetNumberOfBinsPerAxis( 256 );<br> cooccurrenceFilter->SetPixelValueMinMax(-0.5,255.5);<br> //Get output and assign to histogram pointer<br> const HistogramType *histogram = cooccurrenceFilter->GetOutput();<br><br> HistogramType::SizeType size ;<br> <br> size = histogram->GetSize();<br> std::cout << "Histogram size = " << size << std::endl; //The size is displaying as null <br> <br> Salma Bengali<br> Graduate Student<br> University of Iowa<br> <br></div>
</div></body></html>