Discussion:
[ITK-users] Otsu Filter in Statistic and Review/statistics
Zein Salah
2017-03-31 08:42:09 UTC
Permalink
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
Matt McCormick
2017-04-03 19:19:07 UTC
Permalink
Hi Zein,

It sounds like this is ITKv3. A number of Otsu fixes have been made
in ITKv4 - upgrading will likely fix the issue.

HTH,
Matt
Post by Zein Salah
Hi,
I had a strange behavior regarding otsu filter. My code is as simple as
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
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users

Loading...