Files
UR/src/main.cxx

90 lines
2.6 KiB
C++
Raw Normal View History

2023-10-09 09:29:21 +08:00
#include "Parser.h"
2023-11-21 14:03:52 +08:00
#include "Parser.h"
2023-06-14 14:48:53 +08:00
#include "config/config.h"
2023-10-09 09:29:21 +08:00
#include "log/notify.h"
2023-11-21 14:03:52 +08:00
#include "log/notify.h"
2023-12-26 16:29:40 +08:00
#include <cstdio>
2023-06-28 16:48:28 +08:00
#include <vector>
2023-12-26 16:29:40 +08:00
#include "MatlabReader.h"
2023-05-04 16:37:33 +08:00
#define EIGEN_USE_MKL_ALL
2023-06-28 16:48:28 +08:00
#include "src/common/fileHelper.h"
2023-06-02 15:51:45 +08:00
#include "startReconstructions.h"
2023-12-26 16:29:40 +08:00
#include "transmissionReconstruction/detection/detection.h"
#include "transmissionReconstruction/detection/detection.cuh"
#include "startReconstructions.h"
2023-06-15 09:14:04 +08:00
#include "log/log.h"
2023-06-28 16:48:28 +08:00
/* 0 is data path.
1 is dataRef path.
2 is output path.
3 is config file path.
*/
int main(int argc, char *argv[])
2023-05-04 16:37:33 +08:00
{
2023-11-21 14:03:52 +08:00
int argNum = 5;
2023-06-28 16:48:28 +08:00
std::vector<std::string> args(argNum);
2023-11-21 14:03:52 +08:00
args[0] = "";
2023-12-26 16:29:40 +08:00
args[1] = "/home/sun/20230418T145123/";
args[2] = "/home/sun/20230418T141000/";
2023-11-21 14:03:52 +08:00
args[3] = Recon::DEFAULT_OUTPUT_PATH;
args[4] = Recon::DEFAULT_CONFIG_PATH;
2023-06-28 16:48:28 +08:00
argc = argc <= argNum? argc-1 : argNum;
for (int i = 0; i < argc; i++)
{
args[i] = argv[i+1];
}
2023-12-26 16:29:40 +08:00
std::string outPutPath = args[3];
std::string directoryPath = outPutPath;
auto defaultLogger = getLogger("Main",outPutPath.data());
spdlog::set_default_logger(defaultLogger);
2023-11-21 14:03:52 +08:00
std::string ReconID = args[0];
2023-12-26 16:29:40 +08:00
ReconID = ReconID=="none"?"":ReconID;
RECON_INFO("Read UR Args =====================");
RECON_INFO("ReconID:{0}",ReconID);
2023-11-21 14:03:52 +08:00
if(args[1].empty())
{
2023-06-28 16:48:28 +08:00
RECON_INFO("No reconstruction data.");
2023-11-21 14:03:52 +08:00
return -2;
}
std::string configPath = Recon::fixPathSlash(args[4]);
2023-06-28 16:48:28 +08:00
Recon::initalizeConfig(configPath);
2023-11-21 14:03:52 +08:00
if( args[2].empty() && Recon::transParams::runTransmissionReco)
2023-06-28 16:48:28 +08:00
{
RECON_INFO("Running transmission reconstruction, but no refrence data.");
2023-11-21 14:03:52 +08:00
return -3;
2023-06-28 16:48:28 +08:00
}
2023-12-26 16:29:40 +08:00
RECON_INFO("configPath:{0}",configPath);
2023-06-28 16:48:28 +08:00
2023-12-26 16:29:40 +08:00
2023-11-21 14:03:52 +08:00
outPutPath = Recon::fixPathSlash(outPutPath);
2023-06-28 16:48:28 +08:00
if(!Recon::isDirectory(directoryPath))
{
RECON_INFO("Output directory is not valid.");
2023-11-21 14:03:52 +08:00
return -4;
2023-06-28 16:48:28 +08:00
}
2023-12-26 16:29:40 +08:00
RECON_INFO("outPutPath:{0}",directoryPath);
2023-11-21 14:03:52 +08:00
std::string dataPath = Recon::fixPathSlash(args[1]);
2023-12-26 16:29:40 +08:00
RECON_INFO("dataPath:{0}",dataPath);
2023-11-21 14:03:52 +08:00
std::string dataRefPath = Recon::fixPathSlash(args[2]);
2023-12-26 16:29:40 +08:00
RECON_INFO("dataRefPath:{0}",dataRefPath);
RECON_INFO("UR Args End=======================");
RECON_INFO("UR Start");
2023-11-21 14:03:52 +08:00
Recon::notifyStart(ReconID);
2024-09-20 15:50:50 +08:00
int exitcode = Recon::startReconstructions(dataPath, dataRefPath, outPutPath);
2023-11-21 14:03:52 +08:00
if (exitcode == 0)
{
2023-12-26 16:29:40 +08:00
RECON_INFO("UR Finish");
2023-11-21 14:03:52 +08:00
if (!Recon::notifyFinish()) {
RECON_ERROR("Notify Finish failed!");
return -100;
}
return exitcode;
}
else{
return exitcode;
}
2023-05-04 16:37:33 +08:00
}