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 
31 #include "itkInPlaceImageFilter.h"
32 
33 #include "itkConceptChecking.h"
34 
35 namespace itk
36 {
70 template <typename TImage>
71 class ITK_TEMPLATE_EXPORT ThresholdImageFilter : public InPlaceImageFilter<TImage, TImage>
72 {
73 public:
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
98 
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 
141 protected:
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 
160 private:
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ThresholdImageFilter::InputImagePointer
typename InputImageType::ConstPointer InputImagePointer
Definition: itkThresholdImageFilter.h:131
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:636
itk::ThresholdImageFilter::PixelType
typename TImage::PixelType PixelType
Definition: itkThresholdImageFilter.h:89
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itkConceptChecking.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ThresholdImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkThresholdImageFilter.h:139
itk::ThresholdImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkThresholdImageFilter.h:133
itk::ThresholdImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkThresholdImageFilter.h:132
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ThresholdImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkThresholdImageFilter.h:137
itk::ThresholdImageFilter::InputImageType
TImage InputImageType
Definition: itkThresholdImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ThresholdImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkThresholdImageFilter.h:138
itk::ThresholdImageFilter
Set image values to a user-specified value if they are below, above, or outside threshold values.
Definition: itkThresholdImageFilter.h:71
itk::Concept::Comparable
Definition: itkConceptChecking.h:330
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::ThresholdImageFilter::OutputImageType
TImage OutputImageType
Definition: itkThresholdImageFilter.h:136