ITK  6.0.0
Insight Toolkit
itkOtsuThresholdCalculator.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
19#ifndef itkOtsuThresholdCalculator_h
20#define itkOtsuThresholdCalculator_h
21
24
25namespace itk
26{
27
44template <typename THistogram, typename TOutput = double>
45class ITK_TEMPLATE_EXPORT OtsuThresholdCalculator : public HistogramThresholdCalculator<THistogram, TOutput>
46{
47public:
48 ITK_DISALLOW_COPY_AND_MOVE(OtsuThresholdCalculator);
49
55
57 itkNewMacro(Self);
58
60 itkOverrideGetNameOfClassMacro(OtsuThresholdCalculator);
61
63 using HistogramType = THistogram;
64 using OutputType = TOutput;
65
68 itkSetMacro(ReturnBinMidpoint, bool);
69 itkGetConstReferenceMacro(ReturnBinMidpoint, bool);
70 itkBooleanMacro(ReturnBinMidpoint);
74 void
76 {
77 this->Update();
78 }
79
80protected:
82
83 {
84 m_OtsuMultipleThresholdsCalculator = OtsuMultipleThresholdsCalculator<THistogram>::New();
85 }
86 ~OtsuThresholdCalculator() override = default;
87 void
88 PrintSelf(std::ostream & os, Indent indent) const override;
89 void
90 GenerateData() override;
91
92private:
93 typename OtsuMultipleThresholdsCalculator<THistogram>::Pointer m_OtsuMultipleThresholdsCalculator{};
94 bool m_ReturnBinMidpoint{ false };
95};
96
97} // end namespace itk
98
99
100#ifndef ITK_MANUAL_INSTANTIATION
101# include "itkOtsuThresholdCalculator.hxx"
102#endif
103
104#endif
Base class to compute a threshold value based on the histogram of an image.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Computes Otsu's multiple thresholds for a histogram.
Computes the Otsu's threshold for an image.
void PrintSelf(std::ostream &os, Indent indent) const override
~OtsuThresholdCalculator() override=default
void GenerateData() override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....