Fix notify and DICOMExportor bug.
This commit is contained in:
72
src/main.cxx
72
src/main.cxx
@@ -1,6 +1,8 @@
|
||||
#include "Parser.h"
|
||||
#include "Parser.h"
|
||||
#include "config/config.h"
|
||||
#include "log/notify.h"
|
||||
#include "log/notify.h"
|
||||
#include <vector>
|
||||
#define EIGEN_USE_MKL_ALL
|
||||
|
||||
@@ -15,51 +17,65 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int argNum = 4;
|
||||
int argNum = 5;
|
||||
std::vector<std::string> args(argNum);
|
||||
args[0] = "/home/sun/20230418T141000/";
|
||||
args[1] = "/home/sun/20230418T145123/";
|
||||
args[2] = Recon::DEFAULT_OUTPUT_PATH;
|
||||
args[3] = Recon::DEFAULT_CONFIG_PATH;
|
||||
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())
|
||||
{
|
||||
RECON_INFO("No reconstruction data.");
|
||||
return 0;
|
||||
printf("No recon id.");
|
||||
return -1;
|
||||
}
|
||||
std::string configPath = Recon::fixPathSlash(args[3]);
|
||||
Recon::initalizeConfig(configPath);
|
||||
if( args[1].empty() && Recon::transParams::runTransmissionReco)
|
||||
std::string ReconID = args[0];
|
||||
if(args[1].empty())
|
||||
{
|
||||
RECON_INFO("Running transmission reconstruction, but no refrence data.");
|
||||
return 0;
|
||||
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[2];
|
||||
std::string outPutPath = args[3];
|
||||
std::string directoryPath = outPutPath;
|
||||
if(Recon::endsWithMat(outPutPath))
|
||||
{
|
||||
directoryPath = Recon::getPath(outPutPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
outPutPath = Recon::fixPathSlash(outPutPath) + Recon::DEFAULT_OUTPUT_FILENAME;
|
||||
}
|
||||
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 0;
|
||||
return -4;
|
||||
}
|
||||
|
||||
std::string dataPath = Recon::fixPathSlash(args[0]);
|
||||
std::string dataRefPath = Recon::fixPathSlash(args[1]);
|
||||
std::string dataPath = Recon::fixPathSlash(args[1]);
|
||||
std::string dataRefPath = Recon::fixPathSlash(args[2]);
|
||||
RECON_INFO("start");
|
||||
Recon::startReconstructions(dataPath, dataRefPath, outPutPath);
|
||||
SPDLOG_INFO("finish");
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user