22 #ifndef otbThresholdVectorImageFilter_hxx
23 #define otbThresholdVectorImageFilter_hxx
27 #include "itkImageRegionIterator.h"
28 #include "itkNumericTraits.h"
29 #include "itkObjectFactory.h"
30 #include "itkProgressReporter.h"
38 template <
class TInputImage,
class TOutputImage>
44 {this->DynamicMultiThreadingOn();}
50 template <
class TInputImage,
class TOutputImage>
53 Superclass::PrintSelf(os, indent);
55 os << indent <<
"OutsideValue: " <<
static_cast<typename itk::NumericTraits<InputImageInternalPixelType>::PrintType
>(m_OutsideValue) << std::endl;
56 os << indent <<
"Lower: " <<
static_cast<typename itk::NumericTraits<InputImageInternalPixelType>::PrintType
>(m_Lower) << std::endl;
57 os << indent <<
"Upper: " <<
static_cast<typename itk::NumericTraits<InputImageInternalPixelType>::PrintType
>(m_Upper) << std::endl;
63 template <
class TInputImage,
class TOutputImage>
66 if (m_Upper != thresh || m_Lower > itk::NumericTraits<InputImageInternalPixelType>::NonpositiveMin())
68 m_Lower = itk::NumericTraits<InputImageInternalPixelType>::NonpositiveMin();
78 template <
class TInputImage,
class TOutputImage>
81 if (m_Lower != thresh || m_Upper < itk::NumericTraits<InputImageInternalPixelType>::max())
84 m_Upper = itk::NumericTraits<InputImageInternalPixelType>::max();
94 template <
class TInputImage,
class TOutputImage>
99 itkExceptionMacro(<<
"Lower threshold cannot be greater than upper threshold.");
104 if (m_Lower != lower || m_Upper != upper)
116 template <
class TInputImage,
class TOutputImage>
119 itkDebugMacro(<<
"Actually executing");
127 typedef itk::ImageRegionConstIterator<TInputImage> InputIterator;
128 typedef itk::ImageRegionIterator<TOutputImage> OutputIterator;
130 InputIterator inIt(inputPtr, outputRegionForThread);
131 OutputIterator outIt(outputPtr, outputRegionForThread);
134 while (!outIt.IsAtEnd() && !inIt.IsAtEnd())
137 unsigned int l_size = inPix.Size();
139 outPix.SetSize(l_size);
140 for (
unsigned int i = 0; i < l_size; i++)
144 if (m_Lower <= value && value <= m_Upper)
ThresholdVectorImageFilter()
InputImageType::InternalPixelType InputImageInternalPixelType
OutputImageType::PixelType OutputImagePixelType
OutputImageType::InternalPixelType OutputImageInternalPixelType
OutputImageType::Pointer OutputImagePointer
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
InputImageType::PixelType InputImagePixelType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
InputImageType::ConstPointer InputImagePointer
void ThresholdOutside(const InputImageInternalPixelType &lower, const InputImageInternalPixelType &upper)
OutputImageType::RegionType OutputImageRegionType
void ThresholdAbove(const InputImageInternalPixelType &thresh)
void ThresholdBelow(const InputImageInternalPixelType &thresh)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.