From ef36e63fe38da71c2118ad6809207eea62d5d50e Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Fri, 6 May 2011 17:29:14 +0200
Subject: [PATCH] ENH: add AvailableMemory is several other apps

---
 Utils/otbConcatenateImages.cxx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Utils/otbConcatenateImages.cxx b/Utils/otbConcatenateImages.cxx
index eeeb687ac2..d172bebc02 100644
--- a/Utils/otbConcatenateImages.cxx
+++ b/Utils/otbConcatenateImages.cxx
@@ -82,11 +82,13 @@ int generic_main_concatenate(otb::ApplicationOptionsResult* parseResult)
   typename ImageWriterType::Pointer imageWriter = ImageWriterType::New();
   imageWriter->SetFileName(parseResult->GetOutputImage().c_str());
 
-  unsigned long size = (10000 * 10000 * sizeof(PixelType)) / NbImages;
-
-  std::cout << "Streaming size: " << size << std::endl;
+  unsigned int ram = 256;
+  if (parseResult->IsOptionPresent("AvailableMemory"))
+    {
+    ram = parseResult->GetParameterUInt("AvailableMemory");
+    }
+  imageWriter->SetAutomaticTiledStreaming(ram);
 
-  imageWriter->SetBufferMemorySize(size);
   imageWriter->SetInput(iL2VI->GetOutput());
 
   otb::StandardFilterWatcher watcher(imageWriter, "Writing");
@@ -108,6 +110,7 @@ int ConcatenateImages::Describe(ApplicationDescriptor* descriptor)
   descriptor->AddOption("OutputNameList",
                         "Text file containing the name of the images used to generate the output in the same order",
                         "ot", 1, false, ApplicationDescriptor::String);
+  descriptor->AddOption("AvailableMemory","Set the maximum of available memory for the pipeline execution in mega bytes (optional, 256 by default)","ram", 1, false, otb::ApplicationDescriptor::Integer);
 
   return EXIT_SUCCESS;
 }
-- 
GitLab