Zein Salah
2017-03-31 08:42:09 UTC
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
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