00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOtsuMultipleThresholdsCalculator_h
00018 #define __itkOtsuMultipleThresholdsCalculator_h
00019
00020 #include "itkHistogramAlgorithmBase.h"
00021 #include "itkHistogram.h"
00022
00023 namespace itk
00024 {
00025
00039 template< class TInputHistogram >
00040 class ITK_EXPORT OtsuMultipleThresholdsCalculator :
00041 public HistogramAlgorithmBase< TInputHistogram >
00042 {
00043 public:
00045 typedef OtsuMultipleThresholdsCalculator Self;
00046 typedef HistogramAlgorithmBase<TInputHistogram> Superclass;
00047 typedef SmartPointer<Self> Pointer;
00048 typedef SmartPointer<const Self> ConstPointer;
00049
00050 typedef typename TInputHistogram::MeasurementType MeasurementType;
00051
00052 #ifdef ITK_USE_REVIEW_STATISTICS
00053 typedef typename TInputHistogram::AbsoluteFrequencyType FrequencyType;
00054 #else
00055 typedef typename TInputHistogram::FrequencyType FrequencyType;
00056 #endif
00057
00058 typedef typename NumericTraits<MeasurementType>::RealType MeanType;
00059 typedef typename NumericTraits<MeasurementType>::RealType VarianceType;
00060
00061 typedef std::vector<MeanType> MeanVectorType;
00062 typedef std::vector<FrequencyType> FrequencyVectorType;
00063
00064 typedef typename TInputHistogram::InstanceIdentifier InstanceIdentifierType;
00065 typedef std::vector<InstanceIdentifierType> InstanceIdentifierVectorType;
00066
00068 itkTypeMacro(OtsuMultipleThresholdsCalculator, HistogramAlgorithmsBase);
00069 itkNewMacro(Self);
00071
00073 typedef std::vector<MeasurementType> OutputType;
00074
00076 const OutputType& GetOutput();
00077
00079 itkSetClampMacro(NumberOfThresholds, unsigned long, 1, NumericTraits<unsigned long>::max() );
00080 itkGetConstMacro(NumberOfThresholds,unsigned long);
00082
00083 protected:
00084 OtsuMultipleThresholdsCalculator();
00085 virtual ~OtsuMultipleThresholdsCalculator() {}
00086 void PrintSelf(std::ostream& os, Indent indent) const;
00087
00089 void GenerateData();
00090
00092 bool IncrementThresholds(InstanceIdentifierVectorType& thresholdIds, MeanType totalMean, MeanVectorType& classMean, FrequencyVectorType& classFrequency);
00093
00094 private:
00096 unsigned long m_NumberOfThresholds;
00097 OutputType m_Output;
00098
00099 };
00100
00101 }
00102
00103 #ifndef ITK_MANUAL_INSTANTIATION
00104 #include "itkOtsuMultipleThresholdsCalculator.txx"
00105 #endif
00106
00107 #endif
00108