17 #ifndef __itkTwoOutputExampleImageFilter_txx
18 #define __itkTwoOutputExampleImageFilter_txx
23 #include "itkNumericTraits.h"
33 template <
class TImage>
37 m_OutsideValue = NumericTraits<PixelType>::Zero;
38 m_Lower = NumericTraits<PixelType>::NonpositiveMin();
39 m_Upper = NumericTraits<PixelType>::max();
41 typename TImage::Pointer output = TImage::New();
50 template <
class TImage>
55 Superclass::PrintSelf(os,indent);
57 os << indent <<
"OutsideValue: "
58 <<
static_cast<typename NumericTraits<PixelType>::PrintType
>(m_OutsideValue)
60 os << indent <<
"Lower: "
61 <<
static_cast<typename NumericTraits<PixelType>::PrintType
>(m_Lower)
63 os << indent <<
"Upper: "
64 <<
static_cast<typename NumericTraits<PixelType>::PrintType
>(m_Upper)
71 template <
class TImage>
77 || m_Lower > NumericTraits<PixelType>::NonpositiveMin())
79 m_Lower = NumericTraits<PixelType>::NonpositiveMin();
88 template <
class TImage>
93 if (m_Lower != thresh || m_Upper < NumericTraits<PixelType>::max())
96 m_Upper = NumericTraits<PixelType>::max();
105 template <
class TImage>
112 itkExceptionMacro(<<
"Lower threshold cannot be greater than upper threshold.");
116 if (m_Lower != lower || m_Upper != upper)
128 template <
class TImage>
134 itkDebugMacro(<<
"Actually executing");
146 InputIterator inIt(inputPtr, outputRegionForThread);
147 OutputIterator outIt(outputPtr, outputRegionForThread);
148 OutputIterator outInverseIt(outputInversePtr, outputRegionForThread);
151 ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
154 while( !outIt.IsAtEnd() )
157 if (m_Lower <= value && value <= m_Upper)
161 outIt.Set( inIt.Get() );
162 outInverseIt.Set( m_OutsideValue );
166 outIt.Set( m_OutsideValue );
167 outInverseIt.Set( inIt.Get() );