From 9ef7c889fd7797459dc8027e59d53d7189e4932b Mon Sep 17 00:00:00 2001 From: remi cresson <remi.cresson@teledetection.fr> Date: Tue, 13 Jun 2017 12:18:56 +0000 Subject: [PATCH] FIX: Raffaele's patch to handle first empty edge --- include/grmGraphOperations.txx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/grmGraphOperations.txx b/include/grmGraphOperations.txx index dcdbdc7..80a7b73 100644 --- a/include/grmGraphOperations.txx +++ b/include/grmGraphOperations.txx @@ -145,7 +145,10 @@ namespace grm typename GraphOperations<TSegmenter>::NodePointerType GraphOperations<TSegmenter>::CheckLMBF(NodePointerType a, float t) { - if(a->m_Valid) + // TO FIX: if no-data are present within the image, an edgeless node is possible + // Here we check if the list of edges is empty prior to cost check. + // if(a->m_Valid) + if(a->m_Valid && a->m_Edges.size() > 0) { float cost = a->m_Edges.front().m_Cost; @@ -174,7 +177,10 @@ namespace grm typename GraphOperations<TSegmenter>::NodePointerType GraphOperations<TSegmenter>::CheckBF(NodePointerType a, float t) { - if(a->m_Valid) + // TO FIX: if no-data are present within the image, an edgeless node is possible + // Here we check if the list of edges is empty prior to cost check. + // if(a->m_Valid) + if(a->m_Valid && a->m_Edges.size() > 0) { float cost = a->m_Edges.front().m_Cost; -- GitLab