ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkOtsuMultipleThresholdsCalculator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkOtsuMultipleThresholdsCalculator_h
19 #define itkOtsuMultipleThresholdsCalculator_h
20 
22 #include "itkHistogram.h"
23 
24 namespace itk
25 {
48 template< typename TInputHistogram >
49 class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsCalculator:
50  public HistogramAlgorithmBase< TInputHistogram >
51 {
52 public:
58 
59  typedef typename TInputHistogram::MeasurementType MeasurementType;
60  typedef typename TInputHistogram::AbsoluteFrequencyType FrequencyType;
61 
65 
66  typedef std::vector< MeanType > MeanVectorType;
67  typedef std::vector< FrequencyType > FrequencyVectorType;
68  typedef std::vector< WeightType > WeightVectorType;
69 
70  typedef typename TInputHistogram::InstanceIdentifier InstanceIdentifierType;
71  typedef std::vector< InstanceIdentifierType > InstanceIdentifierVectorType;
72 
74  itkTypeMacro(OtsuMultipleThresholdsCalculator, HistogramAlgorithmsBase);
75  itkNewMacro(Self);
77 
79  typedef std::vector< MeasurementType > OutputType;
80 
82  const OutputType & GetOutput();
83 
85  itkSetClampMacro( NumberOfThresholds, SizeValueType, 1, NumericTraits< SizeValueType >::max() );
86  itkGetConstMacro(NumberOfThresholds, SizeValueType);
88 
90  void Compute() ITK_OVERRIDE;
91 
93  itkSetMacro(ValleyEmphasis, bool);
94  itkGetConstReferenceMacro(ValleyEmphasis, bool);
95  itkBooleanMacro(ValleyEmphasis);
97 
98 protected:
100  virtual ~OtsuMultipleThresholdsCalculator() ITK_OVERRIDE {}
101  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
102 
104  bool IncrementThresholds(InstanceIdentifierVectorType & thresholdIds,
105  MeanType totalMean,
106  MeanVectorType & classMean,
107  FrequencyVectorType & classFrequency);
108 
109 private:
110 
114 };
115 } // end of namespace itk
116 
117 #ifndef ITK_MANUAL_INSTANTIATION
118 #include "itkOtsuMultipleThresholdsCalculator.hxx"
119 #endif
120 
121 #endif
TInputHistogram::InstanceIdentifier InstanceIdentifierType
Light weight base class for most itk classes.
Computes Otsu&#39;s multiple thresholds for a histogram.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
NumericTraits< MeasurementType >::RealType MeanType
NumericTraits< MeasurementType >::RealType WeightType
base class for algorithms operating on histograms
HistogramAlgorithmBase< TInputHistogram > Superclass
TInputHistogram::AbsoluteFrequencyType FrequencyType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
NumericTraits< MeasurementType >::RealType VarianceType
std::vector< InstanceIdentifierType > InstanceIdentifierVectorType