ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinaryThresholdImageFilter.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 itkBinaryThresholdImageFilter_h
19#define itkBinaryThresholdImageFilter_h
20
22#include "itkConceptChecking.h"
24
25namespace itk
26{
64namespace Functor
65{
66template <typename TInput, typename TOutput>
67class ITK_TEMPLATE_EXPORT BinaryThreshold
68{
69public:
77
78
79 ~BinaryThreshold() = default;
80
81 void
82 SetLowerThreshold(const TInput & thresh)
83 {
84 m_LowerThreshold = thresh;
85 }
86 void
87 SetUpperThreshold(const TInput & thresh)
88 {
89 m_UpperThreshold = thresh;
90 }
91 void
92 SetInsideValue(const TOutput & value)
93 {
94 m_InsideValue = value;
95 }
96 void
97 SetOutsideValue(const TOutput & value)
98 {
99 m_OutsideValue = value;
100 }
101
102
103 bool
110
112
113 inline TOutput
114 operator()(const TInput & A) const
115 {
116 if (m_LowerThreshold <= A && A <= m_UpperThreshold)
117 {
118 return m_InsideValue;
119 }
120 return m_OutsideValue;
121 }
122
123private:
128};
129} // namespace Functor
130
131template <typename TInputImage, typename TOutputImage>
132class ITK_TEMPLATE_EXPORT BinaryThresholdImageFilter
134 TInputImage,
135 TOutputImage,
136 Functor::BinaryThreshold<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
137{
138public:
139 ITK_DISALLOW_COPY_AND_MOVE(BinaryThresholdImageFilter);
140
144 TInputImage,
145 TOutputImage,
149
151 itkNewMacro(Self);
152
154 itkOverrideGetNameOfClassMacro(BinaryThresholdImageFilter);
155
157 using InputPixelType = typename TInputImage::PixelType;
158 using OutputPixelType = typename TOutputImage::PixelType;
159
162
165 itkSetMacro(OutsideValue, OutputPixelType);
166
168 itkGetConstReferenceMacro(OutsideValue, OutputPixelType);
169
172 itkSetMacro(InsideValue, OutputPixelType);
173
175 itkGetConstReferenceMacro(InsideValue, OutputPixelType);
176
181 virtual void
183
184 virtual void
186
187 virtual void
189
190 virtual void
192
194 virtual InputPixelType
196
197 virtual InputPixelObjectType *
199
200 virtual const InputPixelObjectType *
202
203 virtual InputPixelType
205
206 virtual InputPixelObjectType *
208
209 virtual const InputPixelObjectType *
211
212 itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputPixelType>));
213 itkConceptMacro(InputPixelTypeComparable, (Concept::Comparable<InputPixelType>));
214 itkConceptMacro(InputOStreamWritableCheck, (Concept::OStreamWritable<InputPixelType>));
215 itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
216
217protected:
219 ~BinaryThresholdImageFilter() override = default;
220 void
221 PrintSelf(std::ostream & os, Indent indent) const override;
222
225 void
227
228private:
231};
232} // end namespace itk
233
234#ifndef ITK_MANUAL_INSTANTIATION
235# include "itkBinaryThresholdImageFilter.hxx"
236#endif
237
238#endif
typename TInputImage::PixelType InputPixelType
virtual const InputPixelObjectType * GetLowerThresholdInput() const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::BinaryThreshold< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
void BeforeThreadedGenerateData() override
virtual InputPixelType GetLowerThreshold() const
virtual InputPixelObjectType * GetUpperThresholdInput()
virtual const InputPixelObjectType * GetUpperThresholdInput() const
~BinaryThresholdImageFilter() override=default
virtual void SetUpperThreshold(const InputPixelType threshold)
virtual void SetLowerThreshold(const InputPixelType threshold)
typename TOutputImage::PixelType OutputPixelType
virtual void SetLowerThresholdInput(const InputPixelObjectType *)
virtual void SetUpperThresholdInput(const InputPixelObjectType *)
virtual InputPixelObjectType * GetLowerThresholdInput()
SimpleDataObjectDecorator< InputPixelType > InputPixelObjectType
virtual InputPixelType GetUpperThreshold() const
void PrintSelf(std::ostream &os, Indent indent) const override
void SetUpperThreshold(const TInput &thresh)
void SetLowerThreshold(const TInput &thresh)
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(BinaryThreshold)
bool operator==(const BinaryThreshold &other) const
TOutput operator()(const TInput &A) const
Control indentation during Print() invocation.
Definition itkIndent.h:50
static constexpr T NonpositiveMin()
static constexpr T max(const T &)
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
bool ExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Return the result of an exact comparison between two scalar values of potentially different types.
Definition itkMath.h:720
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....