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 
25 namespace itk
26 {
27 
44 template <typename THistogram, typename TOutput = double>
45 class ITK_TEMPLATE_EXPORT OtsuThresholdCalculator : public HistogramThresholdCalculator<THistogram, TOutput>
46 {
47 public:
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 
80 protected:
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 
92 private:
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
itk::OtsuThresholdCalculator::Compute
void Compute()
Definition: itkOtsuThresholdCalculator.h:75
itk::HistogramThresholdCalculator::HistogramType
THistogram HistogramType
Definition: itkHistogramThresholdCalculator.h:64
itkHistogramThresholdCalculator.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkOtsuMultipleThresholdsCalculator.h
itk::OtsuThresholdCalculator::OtsuThresholdCalculator
OtsuThresholdCalculator()
Definition: itkOtsuThresholdCalculator.h:81
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::OtsuThresholdCalculator
Computes the Otsu's threshold for an image.
Definition: itkOtsuThresholdCalculator.h:45
itk::HistogramThresholdCalculator::OutputType
TOutput OutputType
Definition: itkHistogramThresholdCalculator.h:67
itk::HistogramThresholdCalculator
Base class to compute a threshold value based on the histogram of an image.
Definition: itkHistogramThresholdCalculator.h:46
itk::OtsuMultipleThresholdsCalculator::New
static Pointer New()
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::OtsuMultipleThresholdsCalculator
Computes Otsu's multiple thresholds for a histogram.
Definition: itkOtsuMultipleThresholdsCalculator.h:50