diff --git a/Code/BasicFilters/otbImageToPointSetFilter.h b/Code/BasicFilters/otbImageToPointSetFilter.h index 90395ff01272c97481927d097957154209f53a41..e8a33f95413c154afe4daf2873586c34097138c3 100644 --- a/Code/BasicFilters/otbImageToPointSetFilter.h +++ b/Code/BasicFilters/otbImageToPointSetFilter.h @@ -78,7 +78,7 @@ protected: /** Multi-threading implementation */ - typedef std::vector<typename OutputPointSetType::PointsContainer::Pointer> OutputPointContainerForThreadType; + typedef std::vector<typename OutputPointSetType::PointsContainer::Pointer> OutputPointsContainerForThreadType; virtual void BeforeThreadedGenerateData(); @@ -99,7 +99,7 @@ protected: Pointer Filter; }; - OutputPointContainerForThreadType m_PointContainerPerThread; + OutputPointsContainerForThreadType m_PointsContainerPerThread; /** End Multi-threading implementation */ diff --git a/Code/BasicFilters/otbImageToPointSetFilter.txx b/Code/BasicFilters/otbImageToPointSetFilter.txx index b0e44eece39b4269058d7188e7770ea84dfe87ac..93b94a2cca516178e7aa67401ebf94dd41cb8cac 100644 --- a/Code/BasicFilters/otbImageToPointSetFilter.txx +++ b/Code/BasicFilters/otbImageToPointSetFilter.txx @@ -138,10 +138,9 @@ ImageToPointSetFilter<TInputImage,TOutputPointSet> str.Filter = this; // Initializing object per thread - typename PointsContainerType::Pointer defaultPointsContainer - = OutputPointSetType::PointsContainer::New(); - this->m_PointContainerPerThread - = OutputPointContainerForThreadType(this->GetNumberOfThreads(),defaultPointsContainer); + typename PointsContainerType::Pointer defaultPointsContainer = PointsContainerType::New(); + this->m_PointsContainerPerThread + = OutputPointsContainerForThreadType(this->GetNumberOfThreads(),defaultPointsContainer); // Setting up multithreader @@ -171,19 +170,18 @@ ImageToPointSetFilter<TInputImage,TOutputPointSet> ::AfterThreadedGenerateData(void) { // copy the lists to the output - //TODO rename PointContainer in PointsContainer - typename OutputPointSetType::PointsContainer * outputPointContainer = this->GetOutput()->GetPoints(); - outputPointContainer->Initialize(); - typedef typename OutputPointSetType::PointsContainer::ConstIterator OutputPointContainerIterator; - for (unsigned int i=0; i< this->m_PointContainerPerThread.size(); ++i) + PointsContainerType * outputPointsContainer = this->GetOutput()->GetPoints(); + outputPointsContainer->Initialize(); + typedef typename PointsContainerType::ConstIterator OutputPointsContainerIterator; + for (unsigned int i=0; i< this->m_PointsContainerPerThread.size(); ++i) { - if (this->m_PointContainerPerThread[i].IsNotNull()) + if (this->m_PointsContainerPerThread[i].IsNotNull()) { - for (OutputPointContainerIterator it = this->m_PointContainerPerThread[i]->Begin(); - it != this->m_PointContainerPerThread[i]->End(); + for (OutputPointsContainerIterator it = this->m_PointsContainerPerThread[i]->Begin(); + it != this->m_PointsContainerPerThread[i]->End(); ++it) { - outputPointContainer->push_back(it.Value()); + outputPointsContainer->push_back(it.Value()); } } } diff --git a/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.h b/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.h index acb3266afda5a4d8e534560b9fb54adcdba9133d..a14c1981f25e9d889f103f1d74530e49cd8fb7a9 100644 --- a/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.h +++ b/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.h @@ -72,7 +72,6 @@ protected: ThresholdImageToPointSetFilter(); virtual ~ThresholdImageToPointSetFilter() {}; -// virtual void GenerateData(); virtual void ThreadedGenerateData(const InputImageRegionType &inputRegionForThread, int threadId); void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.txx b/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.txx index 8db768223b2936e7d5ed3b3ce7ea572ea5faff4a..a04bbe9a5bef1cf7e89966089c4b62bb9f097957 100644 --- a/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.txx +++ b/Code/FeatureExtraction/otbThresholdImageToPointSetFilter.txx @@ -35,52 +35,13 @@ ThresholdImageToPointSetFilter<TInputImage, TOutputPointSet> m_UpperThreshold = itk::NumericTraits<InputPixelType>::max(); } - -//template <class TInputImage, class TOutputPointSet> -//void -//ThresholdImageToPointSetFilter<TInputImage, TOutputPointSet> -//::GenerateData() -//{ -// InputImageConstPointer inputPtr = this->GetInput(0); -// OutputPointSetPointer outputPtr = this->GetOutput(); -// -// unsigned int pointId = 0; -// typename OutputPointSetType::PointType position; -// -// outputPtr->Initialize(); -// -// typedef itk::ImageRegionConstIterator<TInputImage> InputIterator; -// InputIterator inIt(inputPtr, inputPtr->GetRequestedRegion() ); -// -// // walk the regions, threshold each pixel -// while ( !inIt.IsAtEnd() ) -// { -// -// const InputPixelType value = inIt.Get(); -// const IndexType index = inIt.GetIndex(); -// -// if ((value >= m_LowerThreshold) && (value <= m_UpperThreshold)) -// { -// position[0] = index[0]; -// position[1] = index[1]; -// -// outputPtr->SetPoint(pointId,position); -// -// pointId++; -// -// } -// ++inIt; -// } -//} - - template <class TInputImage, class TOutputPointSet> void ThresholdImageToPointSetFilter<TInputImage, TOutputPointSet> ::ThreadedGenerateData(const InputImageRegionType &inputRegionForThread, int threadId) { otbMsgDevMacro(<< "Processing thread: " << threadId); - this->m_PointContainerPerThread[threadId] = PointsContainerType::New(); + this->m_PointsContainerPerThread[threadId] = PointsContainerType::New(); InputImageConstPointer inputPtr = this->GetInput(); // Define the iterators @@ -101,7 +62,7 @@ ThresholdImageToPointSetFilter<TInputImage, TOutputPointSet> const IndexType index = inputIt.GetIndex(); position[0] = index[0]; position[1] = index[1]; - this->m_PointContainerPerThread[threadId]->push_back(position); + this->m_PointsContainerPerThread[threadId]->push_back(position); } ++inputIt;