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