ITK  4.13.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:
46  typedef Object Superclass;
49 
51  itkNewMacro(Self);
52 
55 
57  itkStaticConstMacro(ImageDimension, unsigned int,
58  TInputImage::ImageDimension);
59 
61  typedef TInputImage InputImageType;
62  typedef TGradientImage GradientImageType;
63 
65  typedef typename InputImageType::Pointer InputImagePointer;
66  typedef typename InputImageType::ConstPointer InputImageConstPointer;
67  typedef typename GradientImageType::Pointer GradientImagePointer;
68  typedef typename GradientImageType::ConstPointer GradientImageConstPointer;
69  typedef typename InputImageType::PixelType InputPixelType;
70  typedef typename GradientImageType::PixelType GradientPixelType;
71 
73  virtual void SetInput(const InputImageType *image)
74  {
75  if ( m_Input != image )
76  {
77  m_Input = image;
78  this->Modified();
79  m_Valid = false;
80  }
81  }
83 
84  virtual void SetGradient(const GradientImageType *image)
85  {
86  if ( m_Gradient != image )
87  {
88  m_Gradient = image;
89  this->Modified();
90  m_Valid = false;
91  }
92  }
93 
94  itkSetMacro(Pow, double);
95  itkGetConstMacro(Pow, double);
96 
102  void Compute();
103 
104  const InputPixelType & GetOutput() const;
105 
106 protected:
108  virtual ~RobustAutomaticThresholdCalculator() ITK_OVERRIDE {}
109  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
110 
111 private:
112  ITK_DISALLOW_COPY_AND_ASSIGN(RobustAutomaticThresholdCalculator);
113 
114  bool m_Valid; // Have moments been computed yet?
115  double m_Pow;
117 
120 };
121 } // end namespace itk
122 
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkRobustAutomaticThresholdCalculator.hxx"
125 #endif
126 
127 #endif
Light weight base class for most itk classes.
virtual void SetInput(const InputImageType *image)
virtual void SetGradient(const GradientImageType *image)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:59