diff --git a/src/common/fileHelper.h b/src/common/fileHelper.h index ff06d07..0ef0a15 100644 --- a/src/common/fileHelper.h +++ b/src/common/fileHelper.h @@ -6,7 +6,7 @@ namespace Recon { const std::string DEFAULT_CONFIG_PATH = "/home/UR/ConfigFiles/"; - const std::string DEFAULT_OUTPUT_PATH = "/home/UR/ReconResult/USCT_Result.mat"; + const std::string DEFAULT_OUTPUT_PATH = "/home/UR/ReconResult/"; const std::string DEFAULT_OUTPUT_FILENAME = "USCT_Result.mat"; std::string getPath(const std::string &aFullPath); diff --git a/src/main.cxx b/src/main.cxx index 6975aab..8ea970a 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -14,53 +14,64 @@ int main(int argc, char *argv[]) { - auto defaultLogger = getLogger("Main"); - spdlog::set_default_logger(defaultLogger); - int argNum = 4; +int argNum = 5; std::vector args(argNum); - args[0] = ""; - args[1] = ""; - args[2] = Recon::DEFAULT_OUTPUT_PATH; - args[3] = Recon::DEFAULT_CONFIG_PATH; +args[0] = ""; + args[1] = "/home/sun/20230418T145123/"; + args[2] = "/home/sun/20230418T141000/"; + args[3] = Recon::DEFAULT_OUTPUT_PATH; + args[4] = Recon::DEFAULT_CONFIG_PATH; argc = argc <= argNum? argc-1 : argNum; for (int i = 0; i < argc; i++) { args[i] = argv[i+1]; } - - if(args[0].empty()) + std::string outPutPath = args[3]; + std::string directoryPath = outPutPath; + auto defaultLogger = getLogger("Main",outPutPath.data()); + spdlog::set_default_logger(defaultLogger); + std::string ReconID = args[0]; + ReconID = ReconID=="none"?"":ReconID; + RECON_INFO("Read UR Args ====================="); + RECON_INFO("ReconID:{0}",ReconID); + if(args[1].empty()) { RECON_INFO("No reconstruction data."); return 0; } - std::string configPath = Recon::fixPathSlash(args[3]); + + std::string configPath = Recon::fixPathSlash(args[4]); Recon::initalizeConfig(configPath); - if( args[1].empty() && Recon::transParams::runTransmissionReco) + if( args[2].empty() && Recon::transParams::runTransmissionReco) { RECON_INFO("Running transmission reconstruction, but no refrence data."); - return 0; + return -3; } +RECON_INFO("configPath:{0}",configPath); + + + outPutPath = Recon::fixPathSlash(outPutPath); - std::string outPutPath = args[2]; - std::string directoryPath = outPutPath; - if(Recon::endsWithMat(outPutPath)) - { - directoryPath = Recon::getPath(outPutPath); - } - else - { - outPutPath = Recon::fixPathSlash(outPutPath) + Recon::DEFAULT_OUTPUT_FILENAME; - } if(!Recon::isDirectory(directoryPath)) { RECON_INFO("Output directory is not valid."); - return 0; + return -4; + } + RECON_INFO("outPutPath:{0}",directoryPath); + std::string dataPath = Recon::fixPathSlash(args[1]); + RECON_INFO("dataPath:{0}",dataPath); + std::string dataRefPath = Recon::fixPathSlash(args[2]); + RECON_INFO("dataRefPath:{0}",dataRefPath); + RECON_INFO("UR Args End======================="); + RECON_INFO("UR Start"); + int exitcode = Recon::startReconstructions(dataPath, dataRefPath, outPutPath); + if (exitcode == 0) + { + RECON_INFO("UR Finish"); + + return exitcode; + } + else{ + return exitcode; } - - std::string dataPath = Recon::fixPathSlash(args[0]); - std::string dataRefPath = Recon::fixPathSlash(args[1]); - RECON_INFO("start"); - Recon::startReconstructions(dataPath, dataRefPath, outPutPath); - SPDLOG_INFO("finish"); - return 0; }