ITK  6.0.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 * https://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
23
24namespace itk
25{
46template <typename TInputImage,
47 typename TMaskImage = Image<unsigned char, TInputImage::ImageDimension>,
48 class TOutputImage = TInputImage>
49class ITK_TEMPLATE_EXPORT KappaSigmaThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(KappaSigmaThresholdImageFilter);
53
59
61 itkNewMacro(Self);
62
64 itkOverrideGetNameOfClassMacro(KappaSigmaThresholdImageFilter);
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
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);
104 itkSetMacro(SigmaFactor, double);
105 itkGetConstMacro(SigmaFactor, double);
109 itkSetMacro(NumberOfIterations, unsigned int);
110 itkGetConstMacro(NumberOfIterations, unsigned int);
113#ifdef ITK_USE_CONCEPT_CHECKING
114 // Begin concept checking
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 *
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
145 {
146 this->SetMaskImage(input);
147 }
148
149protected:
152 void
153 PrintSelf(std::ostream & os, Indent indent) const override;
154
155 void
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
174private:
175 MaskPixelType m_MaskValue{};
176 double m_SigmaFactor{ 2 };
177 unsigned int m_NumberOfIterations{ 2 };
178 InputPixelType m_Threshold{};
179 OutputPixelType m_InsideValue{};
180 OutputPixelType m_OutsideValue{};
181};
182} // end namespace itk
183
184#ifndef ITK_MANUAL_INSTANTIATION
185# include "itkKappaSigmaThresholdImageFilter.hxx"
186#endif
187
188#endif
Base class for all data objects in ITK.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Computes a Kappa-Sigma-Clipping threshold for an image.
Threshold an image using Kappa-Sigma-Clipping.
void GenerateInputRequestedRegion() override
typename TOutputImage::PixelType OutputPixelType
typename TOutputImage::RegionType OutputImageRegionType
void PrintSelf(std::ostream &os, Indent indent) const override
typename TInputImage::RegionType InputImageRegionType
~KappaSigmaThresholdImageFilter() override=default
Light weight base class for most itk classes.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....