From eae1c149ab35ad9b5ea95d6150c7c4581ad10278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr> Date: Tue, 18 Sep 2018 16:58:27 +0200 Subject: [PATCH] ENH : code review --- .../include/otbLabelImageSmallRegionMergingFilter.hxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx index 41a4975186..04f8216fa3 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx @@ -93,11 +93,10 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > } else { - m_LUT[m_LUT[curLabelLUT]] = adjLabelLUT; m_LUT[curLabelLUT] = adjLabelLUT; } } - + // Update the LUT for (auto & label : m_LUT) { @@ -202,12 +201,14 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > for (it.GoToBegin(); ! it.IsAtEnd(); ++it, ++itN) { assert( !itN.IsAtEnd() ); - int currentLabel = FindCorrespondingLabel(it.Get()); + int currentLabel = m_LUT[ it.Get() ]; + + if ( m_LabelPopulation[currentLabel] == m_Size ) { for (auto ci = itN.Begin() ; !ci.IsAtEnd(); ci++) { - int neighbourLabel = FindCorrespondingLabel(ci.Get() ); + int neighbourLabel = m_LUT[ ci.Get() ]; if (neighbourLabel != currentLabel) m_NeighboursMapsTmp[threadId][ currentLabel ].insert( neighbourLabel ); } -- GitLab