Skip to content
Snippets Groups Projects
Commit aa09070f authored by Julien Malik's avatar Julien Malik
Browse files

ENH: replace direct use of MemoryPrintEstimator by integrated functionnality in StreamingFileWriter

parent cce11710
Branches
Tags
No related merge requests found
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "otbImageFileReader.h" #include "otbImageFileReader.h"
#include "otbStreamingImageFileWriter.h" #include "otbStreamingImageFileWriter.h"
#include "otbChangeLabelImageFilter.h" #include "otbChangeLabelImageFilter.h"
#include "otbPipelineMemoryPrintCalculator.h"
#include "otbStandardWriterWatcher.h" #include "otbStandardWriterWatcher.h"
// itk // itk
...@@ -158,35 +157,17 @@ int ImageSVMClassifier::Execute(otb::ApplicationOptionsResult* parseResult) ...@@ -158,35 +157,17 @@ int ImageSVMClassifier::Execute(otb::ApplicationOptionsResult* parseResult)
//-------------------------- //--------------------------
// Save labeled Image // Save labeled Image
WriterType::Pointer writer = WriterType::New(); WriterType::Pointer writer = WriterType::New();
writer->SetInput(classificationFilter->GetOutput());
writer->SetFileName(parseResult->GetParameterString("OutputLabeledImage")); writer->SetFileName(parseResult->GetParameterString("OutputLabeledImage"));
unsigned int ram = 256;
//Instantiate the pipeline memory print estimator
MemoryCalculatorType::Pointer calculator = MemoryCalculatorType::New();
const double byteToMegabyte = 1./vcl_pow(2.0, 20);
if (parseResult->IsOptionPresent("AvailableMemory")) if (parseResult->IsOptionPresent("AvailableMemory"))
{ {
long long int memory = static_cast <long long int> (parseResult->GetParameterUInt("AvailableMemory")); ram = parseResult->GetParameterUInt("AvailableMemory");
calculator->SetAvailableMemory(memory / byteToMegabyte);
} }
else writer->SetAutomaticTiledStreaming(ram);
{
calculator->SetAvailableMemory(256 * byteToMegabyte);
}
calculator->SetDataToWrite(classificationFilter->GetOutput());
calculator->Compute();
writer->SetTilingStreamDivisions(calculator->GetOptimalNumberOfStreamDivisions());
writer->SetInput(classificationFilter->GetOutput());
otb::StandardWriterWatcher watcher(writer,"Classification"); otb::StandardWriterWatcher watcher(writer,"Classification");
writer->Update(); writer->Update();
std::cout<<"Classification done ... "<<std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment