[Insight-users] Histogram statistics

Martin Kavec kavec at messi.uku.fi
Thu Oct 20 10:56:05 EDT 2005


Hello everybody,

I am trying to calculate some statistics out of the image histogram, but the 
execution is pretty slow. Here is what I do:

typedef itk::Statistics::ScalarImageToHistogramGenerator< InputImageType > 
HistogramGeneratorType;
   typename HistogramGeneratorType::Pointer histogramGenerator = 
HistogramGeneratorType::New();

   histogramGenerator->SetInput( input );
   histogramGenerator->SetNumberOfBins( 1000 );
   histogramGenerator->SetMarginalScale( 10.0 );
   histogramGenerator->Compute();

   typedef typename HistogramGeneratorType::HistogramType  HistogramType;
   const HistogramType *histogram = histogramGenerator->GetOutput();

   m_BrightnessThreshold = histogram->Quantile( 0, 0.98 );


Is there any way to speed this up, or any other way to calculate the histogram 
quantile?

Thans,

Martin


More information about the Insight-users mailing list