Commit 9ef7c889fd7797459dc8027e59d53d7189e4932b

Authored by Rémi Cresson (IRSTEA)
1 parent c4115e48
Exists in master

FIX: Raffaele's patch to handle first empty edge

Showing 1 changed file with 8 additions and 2 deletions   Show diff stats
include/grmGraphOperations.txx
... ... @@ -145,7 +145,10 @@ namespace grm
145 145 typename GraphOperations<TSegmenter>::NodePointerType
146 146 GraphOperations<TSegmenter>::CheckLMBF(NodePointerType a, float t)
147 147 {
148   - if(a->m_Valid)
  148 + // TO FIX: if no-data are present within the image, an edgeless node is possible
  149 + // Here we check if the list of edges is empty prior to cost check.
  150 + // if(a->m_Valid)
  151 + if(a->m_Valid && a->m_Edges.size() > 0)
149 152 {
150 153 float cost = a->m_Edges.front().m_Cost;
151 154  
... ... @@ -174,7 +177,10 @@ namespace grm
174 177 typename GraphOperations<TSegmenter>::NodePointerType
175 178 GraphOperations<TSegmenter>::CheckBF(NodePointerType a, float t)
176 179 {
177   - if(a->m_Valid)
  180 + // TO FIX: if no-data are present within the image, an edgeless node is possible
  181 + // Here we check if the list of edges is empty prior to cost check.
  182 + // if(a->m_Valid)
  183 + if(a->m_Valid && a->m_Edges.size() > 0)
178 184 {
179 185 float cost = a->m_Edges.front().m_Cost;
180 186  
... ...