#include "Parser.h" #include "Parser.h" #include "config/config.h" #include "log/notify.h" #include "log/notify.h" #include #define EIGEN_USE_MKL_ALL #include "src/common/fileHelper.h" #include "startReconstructions.h" #include "log/log.h" /* 0 is data path. 1 is dataRef path. 2 is output path. 3 is config file path. */ int main(int argc, char *argv[]) { int argNum = 5; std::vector args(argNum); args[0] = ""; args[1] = ""; args[2] = ""; 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()) { printf("No recon id."); return -1; } std::string ReconID = args[0]; if(args[1].empty()) { printf("No reconstruction data."); return -2; } std::string configPath = Recon::fixPathSlash(args[4]); Recon::initalizeConfig(configPath); if( args[2].empty() && Recon::transParams::runTransmissionReco) { printf("Running transmission reconstruction, but no refrence data."); return -3; } std::string outPutPath = args[3]; std::string directoryPath = outPutPath; auto defaultLogger = getLogger("Main",outPutPath.data()); spdlog::set_default_logger(defaultLogger); outPutPath = Recon::fixPathSlash(outPutPath); if(!Recon::isDirectory(directoryPath)) { RECON_INFO("Output directory is not valid."); return -4; } std::string dataPath = Recon::fixPathSlash(args[1]); std::string dataRefPath = Recon::fixPathSlash(args[2]); RECON_INFO("start"); Recon::notifyStart(ReconID); int exitcode = Recon::startReconstructions(dataPath, dataRefPath, outPutPath); if (exitcode == 0) { RECON_INFO("finish"); if (!Recon::notifyFinish()) { RECON_ERROR("Notify Finish failed!"); return -100; } return exitcode; } else{ return exitcode; } }