ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkRobustAutomaticThresholdImageFilter.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 __itkRobustAutomaticThresholdImageFilter_h
19 #define __itkRobustAutomaticThresholdImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
50 template< class TInputImage, class TGradientImage = TInputImage, class TOutputImage = TInputImage >
52  public ImageToImageFilter< TInputImage, TOutputImage >
53 {
54 public:
60 
62  itkNewMacro(Self);
63 
66 
68  typedef TInputImage InputImageType;
69  typedef TGradientImage GradientImageType;
70 
72  typedef typename TInputImage::PixelType InputPixelType;
73  typedef typename TOutputImage::PixelType OutputPixelType;
74  typedef typename TGradientImage::PixelType GradientPixelType;
75 
77  typedef typename TInputImage::Pointer InputImagePointer;
78  typedef typename TOutputImage::Pointer OutputImagePointer;
79  typedef typename TGradientImage::Pointer GradientImagePointer;
80 
81  typedef typename TInputImage::SizeType InputSizeType;
82  typedef typename TInputImage::IndexType InputIndexType;
83  typedef typename TInputImage::RegionType InputImageRegionType;
84  typedef typename TOutputImage::SizeType OutputSizeType;
85  typedef typename TOutputImage::IndexType OutputIndexType;
86  typedef typename TOutputImage::RegionType OutputImageRegionType;
87 
90 
92  itkStaticConstMacro(InputImageDimension, unsigned int,
93  TInputImage::ImageDimension);
94  itkStaticConstMacro(OutputImageDimension, unsigned int,
95  TOutputImage::ImageDimension);
97 
100  itkSetMacro(OutsideValue, OutputPixelType);
101 
103  itkGetConstMacro(OutsideValue, OutputPixelType);
104 
107  itkSetMacro(InsideValue, OutputPixelType);
108 
110  itkGetConstMacro(InsideValue, OutputPixelType);
111 
113  itkGetConstMacro(Threshold, InputPixelType);
114 
115  itkSetMacro(Pow, double);
116  itkGetConstMacro(Pow, double);
117 
118 #ifdef ITK_USE_CONCEPT_CHECKING
119 
120  itkConceptMacro( OutputComparableCheck,
122  itkConceptMacro( OutputOStreamWritableCheck,
124 
126 #endif
127 
129  void SetGradientImage(GradientImageType *input)
130  {
131  // Process object is not const-correct so the const casting is required.
132  this->SetNthInput( 1, const_cast< GradientImageType * >( input ) );
133  }
134 
136  GradientImageType * GetGradientImage()
137  {
138  return static_cast< GradientImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
139  }
140 
142  void SetInput1(TInputImage *input)
143  {
144  this->SetInput(input);
145  }
146 
148  void SetInput2(GradientImageType *input)
149  {
150  this->SetGradientImage(input);
151  }
152 
153 protected:
156  void PrintSelf(std::ostream & os, Indent indent) const;
157 
158  void GenerateInputRequestedRegion();
159 
160  void GenerateData();
161 
162 private:
163  RobustAutomaticThresholdImageFilter(const Self &); //purposely not implemented
164  void operator=(const Self &); //purposely not implemented
165 
166  double m_Pow;
170 }; // end of class
171 } // end namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkRobustAutomaticThresholdImageFilter.hxx"
175 #endif
176 
177 #endif
178