20 #ifndef __itkBinaryThresholdImageFilter_txx
21 #define __itkBinaryThresholdImageFilter_txx
31 template <
class TInputImage,
class TOutputImage>
35 m_OutsideValue = NumericTraits<OutputPixelType>::Zero;
36 m_InsideValue = NumericTraits<OutputPixelType>::max();
42 lower->Set( NumericTraits<InputPixelType>::NonpositiveMin() );
46 upper->Set( NumericTraits<InputPixelType>::max() );
54 template <
class TInputImage,
class TOutputImage>
61 if (lower && lower->Get() == threshold)
71 lower = InputPixelObjectType::New();
74 lower->Set(threshold);
78 template <
class TInputImage,
class TOutputImage>
83 if (input != this->GetLowerThresholdInput())
86 const_cast<InputPixelObjectType*>(input));
91 template <
class TInputImage,
class TOutputImage>
97 =
const_cast<Self*
>(
this)->GetLowerThresholdInput();
102 template <
class TInputImage,
class TOutputImage>
113 lower = InputPixelObjectType::New();
114 lower->Set( NumericTraits<InputPixelType>::NonpositiveMin() );
121 template <
class TInputImage,
class TOutputImage>
134 lower = InputPixelObjectType::New();
135 lower->Set( NumericTraits<InputPixelType>::NonpositiveMin() );
146 template <
class TInputImage,
class TOutputImage>
153 if (upper && upper->Get() == threshold)
163 upper = InputPixelObjectType::New();
166 upper->Set(threshold);
170 template <
class TInputImage,
class TOutputImage>
175 if (input != this->GetUpperThresholdInput())
178 const_cast<InputPixelObjectType*>(input));
183 template <
class TInputImage,
class TOutputImage>
189 =
const_cast<Self*
>(
this)->GetUpperThresholdInput();
194 template <
class TInputImage,
class TOutputImage>
205 upper = InputPixelObjectType::New();
206 upper->Set( NumericTraits<InputPixelType>::max() );
213 template <
class TInputImage,
class TOutputImage>
226 upper = InputPixelObjectType::New();
227 upper->Set( NumericTraits<InputPixelType>::max() );
237 template <
class TInputImage,
class TOutputImage>
242 Superclass::PrintSelf(os,indent);
244 os << indent <<
"OutsideValue: "
245 <<
static_cast<typename NumericTraits<OutputPixelType>::PrintType
>(m_OutsideValue) << std::endl;
246 os << indent <<
"InsideValue: "
247 <<
static_cast<typename NumericTraits<OutputPixelType>::PrintType
>(m_InsideValue) << std::endl;
248 os << indent <<
"LowerThreshold: "
249 <<
static_cast<typename NumericTraits<InputPixelType>::PrintType
>(this->GetLowerThreshold()) << std::endl;
250 os << indent <<
"UpperThreshold: "
251 <<
static_cast<typename NumericTraits<InputPixelType>::PrintType
>(this->GetUpperThreshold()) << std::endl;
257 template <
class TInputImage,
class TOutputImage>
266 if (lowerThreshold->Get() > upperThreshold->Get())
268 itkExceptionMacro(<<
"Lower threshold cannot be greater than upper threshold.");
272 this->GetFunctor().SetLowerThreshold( lowerThreshold->Get() );
273 this->GetFunctor().SetUpperThreshold( upperThreshold->Get() );
275 this->GetFunctor().SetInsideValue( m_InsideValue );
276 this->GetFunctor().SetOutsideValue( m_OutsideValue );