ITK  5.4.0
Insight Toolkit
itkThresholdImageFilter.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/*=========================================================================
19 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkThresholdImageFilter_h
29#define itkThresholdImageFilter_h
30
32
33#include "itkConceptChecking.h"
34
35namespace itk
36{
70template <typename TImage>
71class ITK_TEMPLATE_EXPORT ThresholdImageFilter : public InPlaceImageFilter<TImage, TImage>
72{
73public:
74 ITK_DISALLOW_COPY_AND_MOVE(ThresholdImageFilter);
75
81
83 itkNewMacro(Self);
84
86 itkOverrideGetNameOfClassMacro(ThresholdImageFilter);
87
89 using PixelType = typename TImage::PixelType;
90
92#ifdef ITK_USE_CONCEPT_CHECKING
93 // Begin concept checking
94 itkConceptMacro(PixelTypeComparableCheck, (Concept::Comparable<PixelType>));
95 itkConceptMacro(PixelTypeOStreamWritableCheck, (Concept::OStreamWritable<PixelType>));
96 // End concept checking
97#endif
102 itkSetMacro(OutsideValue, PixelType);
103
105 itkGetConstMacro(OutsideValue, PixelType);
106
108 void
109 ThresholdAbove(const PixelType & threshold);
110
112 void
113 ThresholdBelow(const PixelType & threshold);
114
116 void
117 ThresholdOutside(const PixelType & lower, const PixelType & upper);
118
120 itkSetMacro(Lower, PixelType);
121 itkGetConstMacro(Lower, PixelType);
125 itkSetMacro(Upper, PixelType);
126 itkGetConstMacro(Upper, PixelType);
130 using InputImageType = TImage;
133 using InputImagePixelType = typename InputImageType::PixelType;
134
136 using OutputImageType = TImage;
139 using OutputImagePixelType = typename OutputImageType::PixelType;
140
141protected:
143 ~ThresholdImageFilter() override = default;
144 void
145 PrintSelf(std::ostream & os, Indent indent) const override;
146
157 void
158 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
159
160private:
161 PixelType m_OutsideValue{};
162 PixelType m_Lower{};
163 PixelType m_Upper{};
164};
165} // end namespace itk
166
167#ifndef ITK_MANUAL_INSTANTIATION
168# include "itkThresholdImageFilter.hxx"
169#endif
170
171#endif
Base class for filters that take an image as input and overwrite that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Set image values to a user-specified value if they are below, above, or outside threshold values.
void ThresholdAbove(const PixelType &threshold)
typename InputImageType::RegionType InputImageRegionType
void PrintSelf(std::ostream &os, Indent indent) const override
void ThresholdBelow(const PixelType &threshold)
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::ConstPointer InputImagePointer
typename OutputImageType::PixelType OutputImagePixelType
typename TImage::PixelType PixelType
typename OutputImageType::Pointer OutputImagePointer
~ThresholdImageFilter() override=default
void ThresholdOutside(const PixelType &lower, const PixelType &upper)
typename InputImageType::PixelType InputImagePixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....