From 01af611dd5882b91ef07b94895e2fb57f0589a53 Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Wed, 16 Dec 2009 10:26:13 +0800 Subject: [PATCH] BUG: add otbMacro include --- Code/BasicFilters/otbImageToPointSetFilter.h | 4 +- .../BasicFilters/otbImageToPointSetFilter.txx | 24 +++++------ .../otbThresholdImageToPointSetFilter.h | 1 - .../otbThresholdImageToPointSetFilter.txx | 43 +------------------ 4 files changed, 15 insertions(+), 57 deletions(-) diff --git a/Code/BasicFilters/otbImageToPointSetFilter.h b/Code/BasicFilters/otbImageToPointSetFilter.h index 90395ff012..e8a33f9541 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 b0e44eece3..93b94a2cca 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 acb3266afd..a14c1981f2 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 8db768223b..a04bbe9a5b 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; -- GitLab