ITK  5.4.0
Insight Toolkit
itkRobustAutomaticThresholdCalculator.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 itkRobustAutomaticThresholdCalculator_h
19 #define itkRobustAutomaticThresholdCalculator_h
20 
21 #include "itkMacro.h"
22 #include "itkImage.h"
23 
24 namespace itk
25 {
39 template <typename TInputImage, typename TGradientImage>
40 class ITK_TEMPLATE_EXPORT RobustAutomaticThresholdCalculator : public Object
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(RobustAutomaticThresholdCalculator);
44 
47  using Superclass = Object;
50 
52  itkNewMacro(Self);
53 
55  itkOverrideGetNameOfClassMacro(RobustAutomaticThresholdCalculator);
56 
58  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
59 
61  using InputImageType = TInputImage;
62  using GradientImageType = TGradientImage;
63 
69  using InputPixelType = typename InputImageType::PixelType;
70  using GradientPixelType = typename GradientImageType::PixelType;
71 
73  virtual void
74  SetInput(const InputImageType * image)
75  {
76  if (m_Input != image)
77  {
78  m_Input = image;
79  this->Modified();
80  m_Valid = false;
81  }
82  }
85  virtual void
87  {
88  if (m_Gradient != image)
89  {
90  m_Gradient = image;
91  this->Modified();
92  m_Valid = false;
93  }
94  }
95 
96  itkSetMacro(Pow, double);
97  itkGetConstMacro(Pow, double);
98 
104  void
105  Compute();
106 
107  const InputPixelType &
108  GetOutput() const;
109 
110 protected:
112  ~RobustAutomaticThresholdCalculator() override = default;
113  void
114  PrintSelf(std::ostream & os, Indent indent) const override;
115 
116 private:
117  bool m_Valid{ false }; // Have moments been computed yet?
118  double m_Pow{ 1 };
119  InputPixelType m_Output{};
120 
123 };
124 } // end namespace itk
125 
126 #ifndef ITK_MANUAL_INSTANTIATION
127 # include "itkRobustAutomaticThresholdCalculator.hxx"
128 #endif
129 
130 #endif
itk::RobustAutomaticThresholdCalculator::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkRobustAutomaticThresholdCalculator.h:69
itk::RobustAutomaticThresholdCalculator
Compute the robust automatic threshold.
Definition: itkRobustAutomaticThresholdCalculator.h:40
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::RobustAutomaticThresholdCalculator::SetGradient
virtual void SetGradient(const GradientImageType *image)
Definition: itkRobustAutomaticThresholdCalculator.h:86
itk::RobustAutomaticThresholdCalculator::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkRobustAutomaticThresholdCalculator.h:65
itkImage.h
itk::RobustAutomaticThresholdCalculator::GradientPixelType
typename GradientImageType::PixelType GradientPixelType
Definition: itkRobustAutomaticThresholdCalculator.h:70
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkMacro.h
itk::RobustAutomaticThresholdCalculator::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkRobustAutomaticThresholdCalculator.h:66
itk::RobustAutomaticThresholdCalculator::GradientImagePointer
typename GradientImageType::Pointer GradientImagePointer
Definition: itkRobustAutomaticThresholdCalculator.h:67
itk::RobustAutomaticThresholdCalculator::SetInput
virtual void SetInput(const InputImageType *image)
Definition: itkRobustAutomaticThresholdCalculator.h:74
itk::RobustAutomaticThresholdCalculator::GradientImageType
TGradientImage GradientImageType
Definition: itkRobustAutomaticThresholdCalculator.h:62
itk::RobustAutomaticThresholdCalculator::GradientImageConstPointer
typename GradientImageType::ConstPointer GradientImageConstPointer
Definition: itkRobustAutomaticThresholdCalculator.h:68
itk::RobustAutomaticThresholdCalculator::InputImageType
TInputImage InputImageType
Definition: itkRobustAutomaticThresholdCalculator.h:61
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61