[ITK-users] ScalarImageToTextureFeaturesFilter

Zou Jing zjinger at hotmail.com
Sun Jun 24 23:27:37 EDT 2018


Dear all,

I am new to ITK and  I want to calculate texture features of  NIFTI images.
But the result of different images are all the same, the result are 1 0 1 0 0 0
I’d appreciate it if you could help me .
Many thanks.

Here attached the code :

#include "itkImage.h"
#include "itkScalarImageToTextureFeaturesFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkNiftiImageIO.h"


typedef itk::Image<float, 3> ImageType;


int main()
{
         typedef itk::ImageFileReader<ImageType>ReaderType;
         ReaderType::Pointer reader = ReaderType::New();
         ReaderType::Pointer reader1 = ReaderType::New();


         reader->SetFileName("C:/Users/studentx/Downloads/lung_data/NormalLung2/F63y/F63_2013.nii");
         reader->Update();

         reader1->SetFileName("C:/Users/studentx/Downloads/lung_data/NormalLung2/F63y/F63_2013_mask.nii");
         reader1->Update();


         typedef itk::Statistics::ScalarImageToTextureFeaturesFilter<ImageType> TextureFilterType;
         TextureFilterType::Pointer textureFilter = TextureFilterType::New();
         textureFilter->SetInput(reader->GetOutput());
         textureFilter->SetMaskImage(reader1->GetOutput());

         textureFilter->Update();

         const TextureFilterType::FeatureValueVector* output = textureFilter->GetFeatureMeans();
         for (unsigned int i = 0; i < output->size(); ++i)
         {
                   std::cout << (*output)[i] << std::endl;
         }

         return EXIT_SUCCESS;
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://itk.org/pipermail/insight-users/attachments/20180625/49748707/attachment.html>


More information about the Insight-users mailing list