ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkOtsuMultipleThresholdsCalculator.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
24namespace itk
25{
47
48template <typename TInputHistogram>
49class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsCalculator : public HistogramAlgorithmBase<TInputHistogram>
50{
51public:
57
58 using MeasurementType = typename TInputHistogram::MeasurementType;
59 using FrequencyType = typename TInputHistogram::AbsoluteFrequencyType;
60
64
65 using MeanVectorType = std::vector<MeanType>;
66 using FrequencyVectorType = std::vector<FrequencyType>;
67 using WeightVectorType = std::vector<WeightType>;
68
69 using InstanceIdentifierType = typename TInputHistogram::InstanceIdentifier;
70 using InstanceIdentifierVectorType = std::vector<InstanceIdentifierType>;
71
74 itkOverrideGetNameOfClassMacro(OtsuMultipleThresholdsCalculator);
75 itkNewMacro(Self);
78 using OutputType = std::vector<MeasurementType>;
79
81 const OutputType &
83
86 itkSetClampMacro(NumberOfThresholds, SizeValueType, 1, NumericTraits<SizeValueType>::max());
87 itkGetConstMacro(NumberOfThresholds, SizeValueType);
90 void
91 Compute() override;
92
95 itkSetMacro(ValleyEmphasis, bool);
96 itkGetConstReferenceMacro(ValleyEmphasis, bool);
97 itkBooleanMacro(ValleyEmphasis);
102 itkSetMacro(ReturnBinMidpoint, bool);
103 itkGetConstReferenceMacro(ReturnBinMidpoint, bool);
104 itkBooleanMacro(ReturnBinMidpoint);
106
107protected:
110 void
111 PrintSelf(std::ostream & os, Indent indent) const override;
112
114 bool
116 MeanType globalMean,
117 MeanVectorType & classMean,
118 FrequencyVectorType & classFrequency);
119
120private:
123 bool m_ValleyEmphasis{ false };
124 bool m_ReturnBinMidpoint{ false };
125};
126} // end of namespace itk
127
128#ifndef ITK_MANUAL_INSTANTIATION
129# include "itkOtsuMultipleThresholdsCalculator.hxx"
130#endif
131
132#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
static constexpr T max(const T &)
typename NumericTraits< MeasurementType >::RealType MeanType
~OtsuMultipleThresholdsCalculator() override=default
typename NumericTraits< MeasurementType >::RealType WeightType
typename TInputHistogram::AbsoluteFrequencyType FrequencyType
std::vector< InstanceIdentifierType > InstanceIdentifierVectorType
typename TInputHistogram::MeasurementType MeasurementType
typename NumericTraits< MeasurementType >::RealType VarianceType
void PrintSelf(std::ostream &os, Indent indent) const override
HistogramAlgorithmBase< TInputHistogram > Superclass
typename TInputHistogram::InstanceIdentifier InstanceIdentifierType
bool IncrementThresholds(InstanceIdentifierVectorType &thresholdIndexes, MeanType globalMean, MeanVectorType &classMean, FrequencyVectorType &classFrequency)
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86