ITK - Calculate Texture Characteristics for Segmented 3D Brain MRI

I am trying to calculate texture features for a segmented 3D brain MRI using the ITK library with C ++. So I followed this example . The example takes a 3D image and extracts 3 different elements for all 13 possible spatial directions. In my program, I just want to get the given three-dimensional image:

  • Energy
  • Correlation
  • Inertia
  • Haralick correlation
  • Backward difference
  • Cluster prominence
  • Cluster shade

Here is what I still have:

 //definitions of used types typedef itk::Image<float, 3> InternalImageType; typedef itk::Image<unsigned char, 3> VisualizingImageType; typedef itk::Neighborhood<float, 3> NeighborhoodType; typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter<InternalImageType> Image2CoOccuranceType; typedef Image2CoOccuranceType::HistogramType HistogramType; typedef itk::Statistics::HistogramToTextureFeaturesFilter<HistogramType> Hist2FeaturesType; typedef InternalImageType::OffsetType OffsetType; typedef itk::AddImageFilter <InternalImageType> AddImageFilterType; typedef itk::MultiplyImageFilter<InternalImageType> MultiplyImageFilterType; void calcTextureFeatureImage (OffsetType offset, InternalImageType::Pointer inputImage) { // principal variables //Gray Level Co-occurance Matrix Generator Image2CoOccuranceType::Pointer glcmGenerator=Image2CoOccuranceType::New(); glcmGenerator->SetOffset(offset); glcmGenerator->SetNumberOfBinsPerAxis(16); //reasonable number of bins glcmGenerator->SetPixelValueMinMax(0, 255); //for input UCHAR pixel type Hist2FeaturesType::Pointer featureCalc=Hist2FeaturesType::New(); //Region Of Interest typedef itk::RegionOfInterestImageFilter<InternalImageType,InternalImageType> roiType; roiType::Pointer roi=roiType::New(); roi->SetInput(inputImage); InternalImageType::RegionType window; InternalImageType::RegionType::SizeType size; size.Fill(50); window.SetSize(size); window.SetIndex(0,0); window.SetIndex(1,0); window.SetIndex(2,0); roi->SetRegionOfInterest(window); roi->Update(); glcmGenerator->SetInput(roi->GetOutput()); glcmGenerator->Update(); featureCalc->SetInput(glcmGenerator->GetOutput()); featureCalc->Update(); std::cout<<"\n Entropy : "; std::cout<<featureCalc->GetEntropy()<<"\n Energy"; std::cout<<featureCalc->GetEnergy()<<"\n Correlation"; std::cout<<featureCalc->GetCorrelation()<<"\n Inertia"; std::cout<<featureCalc->GetInertia()<<"\n HaralickCorrelation"; std::cout<<featureCalc->GetHaralickCorrelation()<<"\n InverseDifferenceMoment"; std::cout<<featureCalc->GetInverseDifferenceMoment()<<"\nClusterProminence"; std::cout<<featureCalc->GetClusterProminence()<<"\nClusterShade"; std::cout<<featureCalc->GetClusterShade(); } 

The program works. However, I have this problem: it gives the same results for different 3D images , even when I change the window size .

Has anyone used ITK for this? If there is any other way to achieve this, can someone point me to a solution?

Any help would be greatly appreciated.

+6
source share
2 answers

I think your images have only one gray scale level . For example, if you separate your images using the itk-snap tool, when you save the segmentation result, itk-snap save it with one gray scale level. So, if you try to calculate the texture functions for images segmented using itk-snap , you will always have the same results, even if you change the images or the window size because you only have one gray scale level in the matching matrix . Try to run your program using non-segmented images, you will surely get different results.

EDIT:

To calculate texture functions for segmented images, try another segmentation method that preserves the original gray scale levels for the non-segmented image.

+2
source

Something strange in your code is size.Fill(50) , while in the example they show it should contain the image size:

  size.Fill(3); //window size=3x3x3 
0
source

Source: https://habr.com/ru/post/984965/


All Articles