[ITK-users] Otsu Filter in Statistic and Review/statistics

Zein Salah zeinsalah at gmail.com
Fri Mar 31 04:42:09 EDT 2017


Hi,

I had a strange behavior regarding otsu filter. My code is as simple as
this:


    typedef itk::Statistics::ScalarImageToHistogramGenerator<ImageType>
ScalarImageToHistogramGeneratorType;
    typedef ScalarImageToHistogramGeneratorType::HistogramType
HistogramType;
    typedef itk::OtsuMultipleThresholdsCalculator<HistogramType>
OtsuCalculatorType;

    ScalarImageToHistogramGeneratorType::Pointer
scalarImageToHistogramGenerator =
ScalarImageToHistogramGeneratorType::New();
    scalarImageToHistogramGenerator->SetNumberOfBins(128);
    scalarImageToHistogramGenerator->SetInput(itkImage);
    scalarImageToHistogramGenerator->Compute();


    OtsuCalculatorType::Pointer otsuCalculator = OtsuCalculatorType::New();
    otsuCalculator->SetNumberOfThresholds(numberOfThresholds);

otsuCalculator->SetInputHistogram(scalarImageToHistogramGenerator->GetOutput());
    otsuCalculator->Update();

    const OtsuCalculatorType::OutputType& thresholdVector =
otsuCalculator->GetOutput();
    HistogramType::MeasurementType threshold =
thresholdVector[usedThreshold];


I tested this with itk configured with ITK_USE_REVIEW_STATISTICS set to ON
and once to OFF.
With some images, the results is not the same.

Is this a known issue?

thanks,
Zein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170331/cd6d9970/attachment-0003.html>


More information about the Insight-users mailing list