[Insight-users] Fwd: Re: Runtime error using ScalarImageToGreyLevelCooccurrenceMatrixGenerator

Hernan Ledesma fledesma at inti.gob.ar
Tue Jul 24 16:14:38 EDT 2012


Hi David,

How can I visualize the results?
I don't have access to T64.mha, I use 
GeodesicActiveContourShapePriorImageFilterOutput4.mha. The slices that 
output the extract filter (png files) are "blacks". See the following 
code snippets

//para mostrar un slice
     typedef unsigned char OutputPixelType;
     typedef itk::Image<OutputPixelType,2> OutputImageType;

     typedef unsigned char InputPixelType;
     typedef itk::Image<InputPixelType,3> InputImageType;

     typedef itk::ImageFileReader<InputImageType> ReaderMHAType;
     typedef itk::ImageFileWriter<OutputImageType> WriterPNGType;

     ReaderMHAType::Pointer readerMHA=ReaderMHAType::New();
     WriterPNGType::Pointer writerPNG=WriterPNGType::New();

     readerMHA->SetFileName("Energy0.mha");
     writerPNG->SetFileName("slice.png");

     typedef itk::ExtractImageFilter<InputImageType,OutputImageType> 
FilterType;
     FilterType::Pointer extractfilter=FilterType::New();
     extractfilter->InPlaceOn();
     extractfilter->SetDirectionCollapseToSubmatrix();
.....
.....

I think that the problem is here. What am I doing wrong?

Thank you David.
//

El 28/06/12 14:58, David Doria escribió:
> On Thu, Jun 28, 2012 at 1:32 PM, Hernan Ledesma<fledesma at inti.gob.ar>  wrote:
>    
>> Hi,
>> I have some trouble using the class
>> itk::Statistics::ScalarImageToGreyLevelCooccurrenceMatrixGenerator<>
>> I need to compute the GLCM of an RGB image for texture analysis
>> I'm doing:
>> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>> typedef itk::Image<float,2>  ScalarImageType;
>> typedef itk::RGBToLuminanceImageFilter<ProcessingImageType,ScalarImageType>
>> RGBToScalarFilterType;
>> RGBToScalarFilterType::Pointer toScalarFilter=RGBToScalarFilterType::New();
>> toScalarFilter->SetInput(filter->GetOutput());
>> toScalarFilter->Update();
>>
>> typedef
>> itk::Statistics::ScalarImageToGreyLevelCooccurrenceMatrixGenerator<ScalarImageType>
>> CooccurrenceMatrixGeneratorType;
>> CooccurrenceMatrixGeneratorType::Pointer
>> generator=CooccurrenceMatrixGeneratorType::New();
>> generator->SetInput(toScalarFilter->GetOutput());
>> generator->SetNormalize(true);
>> generator->Compute();
>> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> where ProcessingImageType is the type of a processed image:
>> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>> typedef itk::RGBPixel<float>  ProcessingPixelType;
>> typedef itk::Image<ProcessingPixelType,2>  ProcessingImageType;
>> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> and filter->GetOutput() is the processing function (Gradient anisotropic
>> diffusion filter).
>> I receive a runtime error at the generator->Compute(). What I'm doing bad?
>>
>> Thanks.
>>
>> Hernán Ledesma.
>>      
> That class seems to have been replaced by:
>
> http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1ScalarImageToCooccurrenceMatrixFilter.html
> http://www.itk.org/Wiki/ITK/Examples/Statistics/TextureFeatures
>
> David
>
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120724/17c652e6/attachment.htm>


More information about the Insight-users mailing list