ITK  4.3.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< class TInputImage, class TGradientImage >
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(void);
103 
104  const InputPixelType & GetOutput() const;
105 
106 protected:
109  void PrintSelf(std::ostream & os, Indent indent) const;
110 
111 private:
112  RobustAutomaticThresholdCalculator(const Self &); //purposely not implemented
113  void operator=(const Self &); //purposely not implemented
114 
115  bool m_Valid; // Have moments been computed
116  // yet?
117  double m_Pow;
119 
122 }; // class RobustAutomaticThresholdCalculator
123 } // end namespace itk
124 
125 #ifndef ITK_MANUAL_INSTANTIATION
126 #include "itkRobustAutomaticThresholdCalculator.hxx"
127 #endif
128 
129 #endif /* __itkRobustAutomaticThresholdCalculator_h */
130