22 #ifndef otbThresholdImageToPointSetFilter_hxx
23 #define otbThresholdImageToPointSetFilter_hxx
26 #include "itkImageRegionConstIterator.h"
31 template <
class TInputImage,
class TOutputPo
intSet>
34 m_LowerThreshold = itk::NumericTraits<InputPixelType>::NonpositiveMin();
35 m_UpperThreshold = itk::NumericTraits<InputPixelType>::max();
38 template <
class TInputImage,
class TOutputPo
intSet>
40 itk::ThreadIdType threadId)
42 this->m_PointsContainerPerThread[threadId] = PointsContainerType::New();
43 this->m_PointDataContainerPerThread[threadId] = PointDataContainerType::New();
47 itk::ImageRegionConstIterator<TInputImage> inputIt(inputPtr, inputRegionForThread);
49 itk::ProgressReporter progress(
this, threadId, inputRegionForThread.GetNumberOfPixels());
51 typename OutputPointSetType::PointType position;
54 unsigned long currentIndex = 0;
56 while (!inputIt.IsAtEnd())
59 if ((value >= m_LowerThreshold) && (value <= m_UpperThreshold))
62 const IndexType index = inputIt.GetIndex();
63 position[0] = index[0];
64 position[1] = index[1];
65 this->m_PointsContainerPerThread[threadId]->InsertElement(currentIndex, position);
66 this->m_PointDataContainerPerThread[threadId]->InsertElement(currentIndex,
static_cast<typename PointDataContainerType::Element
>(value));
70 progress.CompletedPixel();
77 template <
class TInputImage,
class TOutputPo
intSet>
80 Superclass::PrintSelf(os, indent);
81 os << indent <<
"LowerThreshold : " << m_LowerThreshold << std::endl;
82 os << indent <<
"UpperThreshold : " << m_UpperThreshold << std::endl;
ThresholdImageToPointSetFilter()
Superclass::InputImageType::IndexType IndexType
void ThreadedGenerateData(const InputImageRegionType &inputRegionForThread, itk::ThreadIdType threadId) override
Superclass::InputImageRegionType InputImageRegionType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Superclass::InputImageConstPointer InputImageConstPointer
Superclass::InputImagePixelType InputPixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.