feat: Change execute input args

This commit is contained in:
kradchen
2024-09-19 15:36:10 +08:00
parent 658782b96d
commit 4c4ab3794e

View File

@@ -25,37 +25,33 @@ int main(int argc, char *argv[])
{ {
int argNum = 5; int argNum = 5;
std::vector<std::string> args(argNum); std::vector<std::string> args(argNum);
args[0] = ""; args[0] = "/home/AScans_Data/CAS0.1Phantom/20230823T165617/";
args[1] = "/home/sun/20230418T145123/"; args[1] = "/home/AScans_Data/CAS0.1Phantom/20230823T171851/";
args[2] = "/home/sun/20230418T141000/"; args[2] = "/home/krad/Storage/DICOM/00e04b741e9f_20240619T145752/";
args[3] = Recon::DEFAULT_OUTPUT_PATH; args[3] = Recon::DEFAULT_CONFIG_PATH;
args[4] = Recon::DEFAULT_CONFIG_PATH;
argc = argc <= argNum? argc-1 : argNum; argc = argc <= argNum? argc-1 : argNum;
for (int i = 0; i < argc; i++) for (int i = 0; i < argc; i++)
{ {
args[i] = argv[i+1]; args[i] = argv[i+1];
} }
std::string outPutPath = args[3]; std::string outPutPath = args[2];
std::string directoryPath = outPutPath; std::string directoryPath = outPutPath;
auto defaultLogger = getLogger("Main",outPutPath.data()); auto defaultLogger = getLogger("Main",outPutPath.data());
spdlog::set_default_logger(defaultLogger); spdlog::set_default_logger(defaultLogger);
std::string ReconID = args[0];
ReconID = ReconID=="none"?"":ReconID;
RECON_INFO("Read UR Args ====================="); RECON_INFO("Read UR Args =====================");
RECON_INFO("ReconID:{0}",ReconID); if(args[0].empty())
if(args[1].empty())
{ {
RECON_INFO("No reconstruction data."); RECON_INFO("No reconstruction data.");
return -2; return -2;
} }
std::string configPath = Recon::fixPathSlash(args[4]); std::string configPath = Recon::fixPathSlash(args[3]);
Recon::initalizeConfig(configPath); Recon::initalizeConfig(configPath);
if( args[2].empty() && Recon::transParams::runTransmissionReco) if( args[1].empty() && Recon::transParams::runTransmissionReco)
{ {
RECON_INFO("Running transmission reconstruction, but no refrence data."); RECON_INFO("Running transmission reconstruction, but no refrence data.");
return -3; return -3;
} }
RECON_INFO("configPath:{0}",configPath); RECON_INFO("configPath:{0}",configPath);
outPutPath = Recon::fixPathSlash(outPutPath); outPutPath = Recon::fixPathSlash(outPutPath);
@@ -65,25 +61,20 @@ RECON_INFO("configPath:{0}",configPath);
RECON_INFO("Output directory is not valid."); RECON_INFO("Output directory is not valid.");
return -4; return -4;
} }
RECON_INFO("outPutPath:{0}",directoryPath); RECON_INFO("outPutPath:{0}",outPutPath);
std::string dataPath = Recon::fixPathSlash(args[1]); std::string dataPath = Recon::fixPathSlash(args[0]);
RECON_INFO("dataPath:{0}",dataPath); RECON_INFO("dataPath:{0}",dataPath);
std::string dataRefPath = Recon::fixPathSlash(args[2]); std::string dataRefPath = Recon::fixPathSlash(args[1]);
RECON_INFO("dataRefPath:{0}",dataRefPath); RECON_INFO("dataRefPath:{0}",dataRefPath);
RECON_INFO("UR Args End======================="); RECON_INFO("UR Args End=======================");
RECON_INFO("UR Start"); RECON_INFO("UR Start");
Recon::notifyStart(ReconID);
int exitcode = Recon::startReconstructions(dataPath, dataRefPath, outPutPath); int exitcode = Recon::startReconstructions(dataPath, dataRefPath, outPutPath);
if (exitcode == 0) if (exitcode == 0)
{ {
RECON_INFO("UR Finish"); RECON_INFO("UR Finish");
if (!Recon::notifyFinish()) {
RECON_ERROR("Notify Finish failed!");
return -100;
}
return exitcode; return exitcode;
} }
else{ else{
return exitcode; return exitcode;
} }
} }