ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkKappaSigmaThresholdImageFilter.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 itkKappaSigmaThresholdImageFilter_h
19 #define itkKappaSigmaThresholdImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
45 template< typename TInputImage,
46  typename TMaskImage = Image< unsigned char, TInputImage::ImageDimension >,
47  class TOutputImage = TInputImage >
48 class ITK_TEMPLATE_EXPORT KappaSigmaThresholdImageFilter:
49  public ImageToImageFilter< TInputImage, TOutputImage >
50 {
51 public:
57 
59  itkNewMacro(Self);
60 
63 
65  typedef TInputImage InputImageType;
66  typedef TMaskImage MaskImageType;
67 
69  typedef typename TInputImage::PixelType InputPixelType;
70  typedef typename TOutputImage::PixelType OutputPixelType;
71  typedef typename TMaskImage::PixelType MaskPixelType;
72 
74  typedef typename TInputImage::Pointer InputImagePointer;
75  typedef typename TOutputImage::Pointer OutputImagePointer;
76  typedef typename TMaskImage::Pointer MaskImagePointer;
77 
80  itkSetMacro(OutsideValue, OutputPixelType);
81 
83  itkGetConstMacro(OutsideValue, OutputPixelType);
84 
87  itkSetMacro(InsideValue, OutputPixelType);
88 
90  itkGetConstMacro(InsideValue, OutputPixelType);
91 
93  itkGetConstMacro(Threshold, InputPixelType);
94 
97  itkSetMacro(MaskValue, MaskPixelType);
98  itkGetConstMacro(MaskValue, MaskPixelType);
100 
102  itkSetMacro(SigmaFactor, double);
103  itkGetConstMacro(SigmaFactor, double);
105 
107  itkSetMacro(NumberOfIterations, unsigned int);
108  itkGetConstMacro(NumberOfIterations, unsigned int);
110 
111 #ifdef ITK_USE_CONCEPT_CHECKING
112  // Begin concept checking
113  itkConceptMacro( OutputComparableCheck,
115  itkConceptMacro( OutputOStreamWritableCheck,
117  // End concept checking
118 #endif
119 
121  void SetMaskImage(const MaskImageType *input)
122  {
123  // Process object is not const-correct so the const casting is required.
124  this->SetNthInput( 1, const_cast< MaskImageType * >( input ) );
125  }
126 
128  const MaskImageType * GetMaskImage() const
129  {
130  return static_cast< MaskImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
131  }
132 
134  void SetInput1(const TInputImage *input)
135  {
136  this->SetInput(input);
137  }
138 
140  void SetInput2(const MaskImageType *input)
141  {
142  this->SetMaskImage(input);
143  }
144 
145 protected:
148  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
149 
150  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
151 
152  virtual void GenerateData() ITK_OVERRIDE;
153 
154  typedef typename TInputImage::SizeType InputSizeType;
155  typedef typename TInputImage::IndexType InputIndexType;
156  typedef typename TInputImage::RegionType InputImageRegionType;
157  typedef typename TOutputImage::SizeType OutputSizeType;
158  typedef typename TOutputImage::IndexType OutputIndexType;
159  typedef typename TOutputImage::RegionType OutputImageRegionType;
160 
161  typedef KappaSigmaThresholdImageCalculator< TInputImage, TMaskImage > CalculatorType;
162 
164  itkStaticConstMacro(InputImageDimension, unsigned int,
165  TInputImage::ImageDimension);
166  itkStaticConstMacro(OutputImageDimension, unsigned int,
167  TOutputImage::ImageDimension);
169 
170 private:
171  ITK_DISALLOW_COPY_AND_ASSIGN(KappaSigmaThresholdImageFilter);
172 
173  MaskPixelType m_MaskValue;
174  double m_SigmaFactor;
175  unsigned int m_NumberOfIterations;
176  InputPixelType m_Threshold;
177  OutputPixelType m_InsideValue;
179 };
180 } // end namespace itk
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 #include "itkKappaSigmaThresholdImageFilter.hxx"
184 #endif
185 
186 #endif
Base class for all process objects that output image data.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
InputImageType::RegionType InputImageRegionType
Computes a Kappa-Sigma-Clipping threshold for an image.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Threshold an image using Kappa-Sigma-Clipping.
TOutput m_OutsideValue
Base class for filters that take an image as input and produce an image as output.
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.