[ITK] Problem to pass value from an array to a histogram

Cyril Jaudet drcjaudet at gmail.com
Thu Jan 8 10:45:33 EST 2015


Hello,
I want to implement new texture analysis in c++ Grey size zone matrix.
I succeed to create a 2d matrix with the corresponding value. Now, the goal
is to transform it to an histogram and to use it with
itkHistogramToRunLengthFeaturesFilter to extract the features.
Unfortunately a problem appaers when  i use SetFrequency to store the value
of the matrix to the histogram.

invalid conversion from ‘int*’ to ‘itk::Statistics::Histogram<float,
itk::Statistics::DenseFrequencyContainer2>::InstanceIdentifier {aka long
unsigned int}’ [-fpermissive]
              histogram->SetFrequency(index, frequency);

i try to remplace the matrix value by 0 or 2.0 and it didn't work either.

Here the part of the code:

typedef  itk::Statistics::SparseFrequencyContainer2 FrequencyContainerType;
typedef  FrequencyContainerType::AbsoluteFrequencyType FrequencyType;

typedef itk::Statistics::Histogram< float, FrequencyContainerType>
HistogramType;

     unsigned int numberOfComponents=2;
     HistogramType::Pointer histogram = HistogramType::New();

     HistogramType::SizeType size(numberOfComponents);
     size[0]=D;
     size[1]=Max_volume;

     HistogramType::MeasurementVectorType lowerBound(numberOfComponents);
     lowerBound[0]=1;
     lowerBound[1]=1;
     HistogramType::MeasurementVectorType upperBound(numberOfComponents);
     upperBound[0]=D;
     upperBound[1]=Max_volume;

     histogram->Initialize(size, lowerBound, upperBound );
     histogram->SetToZero();

     int index[2];
     for(int level_Grey=0; level_Grey<D; level_Grey++ )
     {
         for(int N=0; N<Max_volume;N++)
         {
             index[0]=level_Grey;
             index[1]=N;
             histogram->SetFrequency(index,
static_cast<FrequencyType>(Z[level_Grey][N]));
         }
     }

Thanks you,


*Cyril Jaudet *Medical physicist, phd

cyril.jaudet at uzbrussel.be

Laarbeeklaan 101 - 1090 Brussel
Tel 02 477 52 35 - Fax 02 477 YY YY

www.uzbrussel.be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150108/d84a4d83/attachment.html>


More information about the Community mailing list