Files
UR/src/main.cxx
2024-09-20 15:54:34 +08:00

81 lines
2.4 KiB
C++

#include "Parser.h"
#include "Parser.h"
#include "config/config.h"
#include "log/notify.h"
#include "log/notify.h"
#include <cstdio>
#include <vector>
#include "MatlabReader.h"
#define EIGEN_USE_MKL_ALL
#include "src/common/fileHelper.h"
#include "startReconstructions.h"
#include "transmissionReconstruction/detection/detection.h"
#include "transmissionReconstruction/detection/detection.cuh"
#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<std::string> args(argNum);
args[0] = "/home/AScans_Data/CAS0.1Phantom/20230823T165617/";
args[1] = "/home/AScans_Data/CAS0.1Phantom/20230823T171851/";
args[2] = "/home/krad/Storage/DICOM/00e04b741e9f_20240619T145752/";
args[3] = Recon::DEFAULT_CONFIG_PATH;
argc = argc <= argNum? argc-1 : argNum;
for (int i = 0; i < argc; i++)
{
args[i] = argv[i+1];
}
std::string outPutPath = args[2];
std::string directoryPath = outPutPath;
auto defaultLogger = getLogger("Main",outPutPath.data());
spdlog::set_default_logger(defaultLogger);
RECON_INFO("Read UR Args =====================");
if(args[0].empty())
{
RECON_INFO("No reconstruction data.");
return -2;
}
std::string configPath = Recon::fixPathSlash(args[3]);
Recon::initalizeConfig(configPath);
if( args[1].empty() && Recon::transParams::runTransmissionReco)
{
RECON_INFO("Running transmission reconstruction, but no refrence data.");
return -3;
}
RECON_INFO("configPath:{0}",configPath);
outPutPath = Recon::fixPathSlash(outPutPath);
if(!Recon::isDirectory(directoryPath))
{
RECON_INFO("Output directory is not valid.");
return -4;
}
RECON_INFO("outPutPath:{0}",outPutPath);
std::string dataPath = Recon::fixPathSlash(args[0]);
RECON_INFO("dataPath:{0}",dataPath);
std::string dataRefPath = Recon::fixPathSlash(args[1]);
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");
return exitcode;
}
else{
return exitcode;
}
}