[Insight-users] Texture features calculation problem
Salma Bengali
salmabengali at ymail.com
Tue May 3 21:53:57 EDT 2011
Hi,
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.
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.
Thanks in advance.
typedef float PixelType_in;
typedef float RealType;
typedef itk::NumericTraits < PixelType_in >::RealType MeasurementType;
typedef itk::Statistics::Histogram< MeasurementType,
itk::Statistics::DenseFrequencyContainer2 > HistogramType;
typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter
<InputImageType,
itk::Statistics::DenseFrequencyContainer2 >
CooccurrenceMatrixFilterType;
CooccurrenceMatrixFilterType::Pointer cooccurrenceFilter =
CooccurrenceMatrixFilterType::New();
reader->Update();
cooccurrenceFilter->SetInput(reader->GetOutput() );
//Set the histogram parameters
cooccurrenceFilter->SetNumberOfBinsPerAxis( 256 );
cooccurrenceFilter->SetPixelValueMinMax(-0.5,255.5);
//Get output and assign to histogram pointer
const HistogramType *histogram = cooccurrenceFilter->GetOutput();
HistogramType::SizeType size ;
size = histogram->GetSize();
std::cout << "Histogram size = " << size << std::endl; //The size is
displaying as null
Salma Bengali
Graduate Student
University of Iowa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110503/48f2f526/attachment.htm>
More information about the Insight-users
mailing list