From 58909492f87bde5e1279d09d6b4a15872dbcdf19 Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Tue, 6 Feb 2018 10:09:09 +0100 Subject: [PATCH] TEST : hack commandline to rerun application through cli --- .../AppTest/app/otbMemoryTestApplication.cxx | 11 ++++- .../src/otbApplicationLauncherCommandLine.cxx | 45 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Modules/Applications/AppTest/app/otbMemoryTestApplication.cxx b/Modules/Applications/AppTest/app/otbMemoryTestApplication.cxx index 9afb640273..44712e35c3 100644 --- a/Modules/Applications/AppTest/app/otbMemoryTestApplication.cxx +++ b/Modules/Applications/AppTest/app/otbMemoryTestApplication.cxx @@ -64,11 +64,12 @@ private: AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); + SetParameterString("in", "/home/antoine/dev/my_data/anaglyphInput2.tif"); AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image"); SetDefaultOutputPixelType("out",ImagePixelType_uint8); - + SetParameterString("out", "/home/antoine/dev/my_data/anaglyphtestInput2.tif"); AddRAMParameter(); @@ -85,18 +86,26 @@ private: void DoExecute() ITK_OVERRIDE { + #ifdef MEM_DEBUG std::cout<<"Debug on input "<<std::endl; GetParameterImage("in")->DebugOn(); + #endif ExtractROIFilterType::Pointer extractor = ExtractROIFilterType::New(); + #ifdef MEM_DEBUG extractor->DebugOn(); + #endif m_Filters.push_back(extractor.GetPointer()); + #ifdef MEM_DEBUG std::cout<<"Debug on extractor "<<std::endl; extractor->DebugOn(); + #endif extractor->SetInput(GetParameterImage("in")); extractor->SetChannel(1); extractor->UpdateOutputInformation(); + #ifdef MEM_DEBUG std::cout<<"Debug on extractor's output "<<std::endl; extractor->GetOutput()->DebugOn(); + #endif SetParameterOutputImage("out" , extractor->GetOutput() ); } diff --git a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx index 4c5bd8a93f..0e19743f40 100644 --- a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx +++ b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx @@ -22,6 +22,7 @@ #include "otbWrapperCommandLineLauncher.h" #include "otb_tinyxml.h" #include <vector> +#include <iostream> #ifdef OTB_USE_MPI #include "otbMPIConfig.h" @@ -304,9 +305,53 @@ int main(int argc, char* argv[]) ShowUsage(argv); return false; } + goto RUN; + RUN : + for (auto i : vexp) + std::cout<<i<<" "; + std::cout<<std::endl; bool success = launcher->Load(vexp) && launcher->ExecuteAndWriteOutput(); + + std::string answer; + std::cout<<"Rerun or run with other args? r : rerun ; s : small test ; b : big test ; else quit "<<std::endl; + std::cin >> answer; + if ( answer[0]=='r') + { + std::cout<<"again"<<std::endl; + goto RUN; + } + else if ( answer[0]=='s' ) + { + std::cout<<"Small test running"<<std::endl; + vexp[2] = "/home/antoine/dev/my_data/anaglyphInput2.tif"; + vexp[4] = "/home/antoine/dev/my_data/anaglyphOut.tif"; + goto RUN; + } + else if ( answer[0]=='b' ) + { + std::cout<<"Big test running"<<std::endl; + vexp[2] = "/home/antoine/dev/my_data/bigbigtestclassic.tif"; + vexp[4] = "/home/antoine/dev/my_data/bigbigtestclasssic.tif"; + goto RUN; + } + // else + // { + // vexp.clear(); + // for (int i = 1; i < argc; i++) + // { + // std::string strarg(answer[i]); + // std::string cleanArg = CleanWord(strarg); + // if (cleanArg.empty()) + // { + // // Empty argument ! + // continue; + // } + // vexp.push_back(cleanArg); + // } + // goto RUN; + // } // shutdown MPI after application finished #ifdef OTB_USE_MPI otb::MPIConfig::Instance()->terminate(); -- GitLab