From 7312fb67607f030ff5bc241bc8eb9379f21c4965 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Tue, 22 Nov 2016 15:50:48 +0100 Subject: [PATCH] BUG: no sample copied when numThreads is 1 --- .../otbDescriptorsListSampleGenerator.txx | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx index 0f9b7b680b..bccb8ec45e 100644 --- a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx +++ b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx @@ -203,26 +203,22 @@ PersistentDescriptorsListSampleGenerator<TInputImage, TVectorData, TFunctionType labelListSample->SetMeasurementVectorSize(m_ThreadLabelListSample[0]->GetMeasurementVectorSize()); // Copy the first thread elements into lists - if( this->GetNumberOfThreads() > 1 ) + ListSampleType* threadListSample = m_ThreadListSample[0]; + LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[0]; + SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[0]; + for (unsigned int i = 0; i < threadListSample->Size(); ++i) { - ListSampleType* threadListSample = m_ThreadListSample[0]; - LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[0]; - SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[0]; - - for (unsigned int i = 0; i < threadListSample->Size(); ++i) - { - listSample->PushBack( threadListSample->GetMeasurementVector(i) ); - labelListSample->PushBack( threadLabelListSample->GetMeasurementVector(i) ); - samplesPosition.push_back( threadSamplesPosition[i] ); - } + listSample->PushBack( threadListSample->GetMeasurementVector(i) ); + labelListSample->PushBack( threadLabelListSample->GetMeasurementVector(i) ); + samplesPosition.push_back( threadSamplesPosition[i] ); } // Add the other thread element checking if the point dosn't already exist for (itk::ThreadIdType threadId = 1; threadId < this->GetNumberOfThreads(); ++threadId ) { - ListSampleType* threadListSample = m_ThreadListSample[threadId]; - LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[threadId]; - SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[threadId]; + threadListSample = m_ThreadListSample[threadId]; + threadLabelListSample = m_ThreadLabelListSample[threadId]; + threadSamplesPosition = m_ThreadSamplesPosition[threadId]; for (unsigned int i = 0; i < threadListSample->Size(); ++i) { -- GitLab