ITK  5.0.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:
52  ITK_DISALLOW_COPY_AND_ASSIGN(KappaSigmaThresholdImageFilter);
53 
59 
61  itkNewMacro(Self);
62 
65 
67  using InputImageType = TInputImage;
68  using MaskImageType = TMaskImage;
69 
71  using InputPixelType = typename TInputImage::PixelType;
72  using OutputPixelType = typename TOutputImage::PixelType;
73  using MaskPixelType = typename TMaskImage::PixelType;
74 
76  using InputImagePointer = typename TInputImage::Pointer;
77  using OutputImagePointer = typename TOutputImage::Pointer;
78  using MaskImagePointer = typename TMaskImage::Pointer;
79 
82  itkSetMacro(OutsideValue, OutputPixelType);
83 
85  itkGetConstMacro(OutsideValue, OutputPixelType);
86 
89  itkSetMacro(InsideValue, OutputPixelType);
90 
92  itkGetConstMacro(InsideValue, OutputPixelType);
93 
95  itkGetConstMacro(Threshold, InputPixelType);
96 
99  itkSetMacro(MaskValue, MaskPixelType);
100  itkGetConstMacro(MaskValue, MaskPixelType);
102 
104  itkSetMacro(SigmaFactor, double);
105  itkGetConstMacro(SigmaFactor, double);
107 
109  itkSetMacro(NumberOfIterations, unsigned int);
110  itkGetConstMacro(NumberOfIterations, unsigned int);
112 
113 #ifdef ITK_USE_CONCEPT_CHECKING
114  // Begin concept checking
115  itkConceptMacro( OutputComparableCheck,
117  itkConceptMacro( OutputOStreamWritableCheck,
119  // End concept checking
120 #endif
121 
123  void SetMaskImage(const MaskImageType *input)
124  {
125  // Process object is not const-correct so the const casting is required.
126  this->SetNthInput( 1, const_cast< MaskImageType * >( input ) );
127  }
128 
130  const MaskImageType * GetMaskImage() const
131  {
132  return static_cast< MaskImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
133  }
134 
136  void SetInput1(const TInputImage *input)
137  {
138  this->SetInput(input);
139  }
140 
142  void SetInput2(const MaskImageType *input)
143  {
144  this->SetMaskImage(input);
145  }
146 
147 protected:
149  ~KappaSigmaThresholdImageFilter() override = default;
150  void PrintSelf(std::ostream & os, Indent indent) const override;
151 
152  void GenerateInputRequestedRegion() override;
153 
154  void GenerateData() override;
155 
162 
164 
166  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
167  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
168 
169 private:
171  double m_SigmaFactor{ 2 };
172  unsigned int m_NumberOfIterations{ 2 };
176 };
177 } // end namespace itk
178 
179 #ifndef ITK_MANUAL_INSTANTIATION
180 #include "itkKappaSigmaThresholdImageFilter.hxx"
181 #endif
182 
183 #endif
typename OutputImageType::Pointer OutputImagePointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename TOutputImage::PixelType OutputPixelType
Base class for all process objects that output image data.
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
Computes a Kappa-Sigma-Clipping threshold for an image.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Threshold an image using Kappa-Sigma-Clipping.
typename InputImageType::RegionType InputImageRegionType
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.