From 0c9425d9fff5269ed2219846ae918ea63ca04e83 Mon Sep 17 00:00:00 2001
From: "raffaele.gaetano" <raffaele.gaetano@cirad.fr>
Date: Tue, 11 Dec 2018 16:29:26 +0100
Subject: [PATCH] Working on the resume option to resume segmentation after
 fail or abort.

---
 include/lsgrmController.txx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/lsgrmController.txx b/include/lsgrmController.txx
index 52855de..386c510 100644
--- a/include/lsgrmController.txx
+++ b/include/lsgrmController.txx
@@ -92,7 +92,8 @@ void Controller<TSegmenter>::RunSegmentation()
     // Run first partial segmentation
     boost::timer t; t.restart();
 	
-    auto accumulatedMemory = RunFirstPartialSegmentation<TSegmenter>(
+    if (!m_Resuming) {
+	auto accumulatedMemory = RunFirstPartialSegmentation<TSegmenter>(
         m_InputImage,
         m_SpecificParameters,
         m_Threshold,
@@ -104,6 +105,10 @@ void Controller<TSegmenter>::RunSegmentation()
         m_TileWidth,
         m_TileHeight,
         isFusion);
+	} else {
+		// temp. patch, maybe calculate real current memory after resuming graphs.
+		auto accumulatedMemory = 2 * m_Memory;
+	}
 
 #ifdef OTB_USE_MPI
     GatherUsefulVariables(accumulatedMemory, isFusion);
-- 
GitLab