ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRobustAutomaticThresholdCalculator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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_ASSIGN(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 SetInput(const InputImageType *image)
75  {
76  if ( m_Input != image )
77  {
78  m_Input = image;
79  this->Modified();
80  m_Valid = false;
81  }
82  }
84 
85  virtual void SetGradient(const GradientImageType *image)
86  {
87  if ( m_Gradient != image )
88  {
89  m_Gradient = image;
90  this->Modified();
91  m_Valid = false;
92  }
93  }
94 
95  itkSetMacro(Pow, double);
96  itkGetConstMacro(Pow, double);
97 
103  void Compute();
104 
105  const InputPixelType & GetOutput() const;
106 
107 protected:
110  void PrintSelf(std::ostream & os, Indent indent) const override;
111 
112 private:
113  bool m_Valid; // Have moments been computed yet?
114  double m_Pow;
116 
119 };
120 } // end namespace itk
121 
122 #ifndef ITK_MANUAL_INSTANTIATION
123 #include "itkRobustAutomaticThresholdCalculator.hxx"
124 #endif
125 
126 #endif
typename InputImageType::ConstPointer InputImageConstPointer
Light weight base class for most itk classes.
typename GradientImageType::ConstPointer GradientImageConstPointer
virtual void SetInput(const InputImageType *image)
virtual void SetGradient(const GradientImageType *image)
typename GradientImageType::PixelType GradientPixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60