[ITK] Problem to pass value from an array to a histogram
Cyril Jaudet
drcjaudet at gmail.com
Fri Jan 9 03:31:34 EST 2015
Thank you for your answer.
I modify the type of index but you were right the problem comes from the
SetFrequency.
Using SetFrequencyOfIndex instead. It works well.
Best regards,
Cyril
2015-01-08 17:48 GMT+01:00 Matt McCormick <matt.mccormick at kitware.com>:
> Hi Cyril,
>
> If you are trying to use this version [1] of SetFrequency, then
> declare the index variable as
>
> HistogramType::Index index;
>
> instead of
>
> int index[2]
>
> HTH,
> Matt
>
> [1]
> http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1Histogram.html#aedd20d5304684326df28c6bd10ec3130
>
> On Thu, Jan 8, 2015 at 10:45 AM, Cyril Jaudet <drcjaudet at gmail.com> wrote:
> > 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
> >
> >
> > _______________________________________________
> > Community mailing list
> > Community at itk.org
> > http://public.kitware.com/mailman/listinfo/community
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150109/93a0623b/attachment.html>
More information about the Community
mailing list