ITK  5.2.0
Insight Toolkit
itkKappaSigmaThresholdImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
46 template <typename TInputImage,
47  typename TMaskImage = Image<unsigned char, TInputImage::ImageDimension>,
48  class TOutputImage = TInputImage>
49 class ITK_TEMPLATE_EXPORT KappaSigmaThresholdImageFilter : 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, (Concept::Comparable<OutputPixelType>));
116  itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
117  // End concept checking
118 #endif
119 
121  void
123  {
124  // Process object is not const-correct so the const casting is required.
125  this->SetNthInput(1, const_cast<MaskImageType *>(input));
126  }
127 
129  const MaskImageType *
130  GetMaskImage() const
131  {
132  return static_cast<MaskImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
133  }
134 
136  void
137  SetInput1(const TInputImage * input)
138  {
139  this->SetInput(input);
140  }
141 
143  void
144  SetInput2(const MaskImageType * input)
145  {
146  this->SetMaskImage(input);
147  }
148 
149 protected:
151  ~KappaSigmaThresholdImageFilter() override = default;
152  void
153  PrintSelf(std::ostream & os, Indent indent) const override;
154 
155  void
156  GenerateInputRequestedRegion() override;
157 
158  void
159  GenerateData() override;
160 
167 
169 
171  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
172  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
173 
174 private:
176  double m_SigmaFactor{ 2 };
177  unsigned int m_NumberOfIterations{ 2 };
181 };
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 # include "itkKappaSigmaThresholdImageFilter.hxx"
186 #endif
187 
188 #endif
itk::KappaSigmaThresholdImageFilter::SetInput1
void SetInput1(const TInputImage *input)
Definition: itkKappaSigmaThresholdImageFilter.h:137
itk::KappaSigmaThresholdImageFilter::MaskPixelType
typename TMaskImage::PixelType MaskPixelType
Definition: itkKappaSigmaThresholdImageFilter.h:73
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::KappaSigmaThresholdImageFilter::m_MaskValue
MaskPixelType m_MaskValue
Definition: itkKappaSigmaThresholdImageFilter.h:175
itk::KappaSigmaThresholdImageFilter::m_InsideValue
OutputPixelType m_InsideValue
Definition: itkKappaSigmaThresholdImageFilter.h:179
itk::KappaSigmaThresholdImageFilter::OutputSizeType
typename TOutputImage::SizeType OutputSizeType
Definition: itkKappaSigmaThresholdImageFilter.h:164
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::KappaSigmaThresholdImageFilter
Threshold an image using Kappa-Sigma-Clipping.
Definition: itkKappaSigmaThresholdImageFilter.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::KappaSigmaThresholdImageFilter::MaskImagePointer
typename TMaskImage::Pointer MaskImagePointer
Definition: itkKappaSigmaThresholdImageFilter.h:78
itk::KappaSigmaThresholdImageFilter::SetMaskImage
void SetMaskImage(const MaskImageType *input)
Definition: itkKappaSigmaThresholdImageFilter.h:122
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::KappaSigmaThresholdImageCalculator
Computes a Kappa-Sigma-Clipping threshold for an image.
Definition: itkKappaSigmaThresholdImageCalculator.h:52
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::KappaSigmaThresholdImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkKappaSigmaThresholdImageFilter.h:72
itkImageToImageFilter.h
itk::KappaSigmaThresholdImageFilter::SetInput2
void SetInput2(const MaskImageType *input)
Definition: itkKappaSigmaThresholdImageFilter.h:144
itk::KappaSigmaThresholdImageFilter::InputIndexType
typename TInputImage::IndexType InputIndexType
Definition: itkKappaSigmaThresholdImageFilter.h:162
itk::KappaSigmaThresholdImageFilter::MaskImageType
TMaskImage MaskImageType
Definition: itkKappaSigmaThresholdImageFilter.h:68
itk::KappaSigmaThresholdImageFilter::GetMaskImage
const MaskImageType * GetMaskImage() const
Definition: itkKappaSigmaThresholdImageFilter.h:130
itk::KappaSigmaThresholdImageFilter::m_Threshold
InputPixelType m_Threshold
Definition: itkKappaSigmaThresholdImageFilter.h:178
itk::Concept::Comparable
Definition: itkConceptChecking.h:328
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::KappaSigmaThresholdImageFilter::OutputIndexType
typename TOutputImage::IndexType OutputIndexType
Definition: itkKappaSigmaThresholdImageFilter.h:165
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::KappaSigmaThresholdImageFilter::m_OutsideValue
OutputPixelType m_OutsideValue
Definition: itkKappaSigmaThresholdImageFilter.h:180
itkKappaSigmaThresholdImageCalculator.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::KappaSigmaThresholdImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkKappaSigmaThresholdImageFilter.h:71
itk::KappaSigmaThresholdImageFilter::InputSizeType
typename TInputImage::SizeType InputSizeType
Definition: itkKappaSigmaThresholdImageFilter.h:161