Skip to content
Snippets Groups Projects
Commit 01af611d authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: add otbMacro include

parent 1f11c259
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
......@@ -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());
}
}
}
......
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment