1 Commits

Author SHA1 Message Date
kradchen
66bf808a89 Make double version executable 2023-11-28 11:05:04 +08:00
2 changed files with 42 additions and 31 deletions

View File

@@ -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);

View File

@@ -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<std::string> 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");
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;
return exitcode;
}
else{
return exitcode;
}
}