ITK  4.13.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< typename TInputImage, typename TGradientImage = TInputImage, typename TOutputImage = TInputImage >
51 class ITK_TEMPLATE_EXPORT RobustAutomaticThresholdImageFilter:
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 
83  typedef typename TInputImage::RegionType InputImageRegionType;
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  // Begin concept checking
120  itkConceptMacro( OutputComparableCheck,
122  itkConceptMacro( OutputOStreamWritableCheck,
124  // End concept checking
125 #endif
126 
129  {
130  // Process object is not const-correct so the const casting is required.
131  this->SetNthInput( 1, const_cast< GradientImageType * >( input ) );
132  }
133 
136  {
137  return static_cast< GradientImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
138  }
139 
141  void SetInput1(TInputImage *input)
142  {
143  this->SetInput(input);
144  }
145 
148  {
149  this->SetGradientImage(input);
150  }
151 
152 protected:
155  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
156 
157  void GenerateInputRequestedRegion() ITK_OVERRIDE;
158 
159  void GenerateData() ITK_OVERRIDE;
160 
161 private:
162  ITK_DISALLOW_COPY_AND_ASSIGN(RobustAutomaticThresholdImageFilter);
163 
164  double m_Pow;
165  InputPixelType m_Threshold;
166  OutputPixelType m_InsideValue;
168 };
169 } // end namespace itk
170 
171 #ifndef ITK_MANUAL_INSTANTIATION
172 #include "itkRobustAutomaticThresholdImageFilter.hxx"
173 #endif
174 
175 #endif
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Base class for all process objects that output image data.
Threshold an image using robust automatic threshold selection (RATS) method.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
TOutput m_OutsideValue
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
RobustAutomaticThresholdCalculator< TInputImage, TGradientImage > CalculatorType