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);
|
2024-09-19 15:36:10 +08:00
|
|
|
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;
|
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];
|
|
|
|
|
}
|
2024-09-19 15:36:10 +08:00
|
|
|
std::string outPutPath = args[2];
|
2023-12-26 16:29:40 +08:00
|
|
|
std::string directoryPath = outPutPath;
|
|
|
|
|
auto defaultLogger = getLogger("Main",outPutPath.data());
|
|
|
|
|
spdlog::set_default_logger(defaultLogger);
|
|
|
|
|
RECON_INFO("Read UR Args =====================");
|
2024-09-19 15:36:10 +08:00
|
|
|
if(args[0].empty())
|
2023-11-21 14:03:52 +08:00
|
|
|
{
|
2023-06-28 16:48:28 +08:00
|
|
|
RECON_INFO("No reconstruction data.");
|
2023-11-21 14:03:52 +08:00
|
|
|
return -2;
|
|
|
|
|
}
|
2024-09-19 15:36:10 +08:00
|
|
|
std::string configPath = Recon::fixPathSlash(args[3]);
|
2023-06-28 16:48:28 +08:00
|
|
|
Recon::initalizeConfig(configPath);
|
2024-09-19 15:36:10 +08:00
|
|
|
if( args[1].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
|
|
|
}
|
2024-09-19 15:36:10 +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
|
|
|
}
|
2024-09-19 15:36:10 +08:00
|
|
|
RECON_INFO("outPutPath:{0}",outPutPath);
|
|
|
|
|
std::string dataPath = Recon::fixPathSlash(args[0]);
|
2023-12-26 16:29:40 +08:00
|
|
|
RECON_INFO("dataPath:{0}",dataPath);
|
2024-09-19 15:36:10 +08:00
|
|
|
std::string dataRefPath = Recon::fixPathSlash(args[1]);
|
2023-12-26 16:29:40 +08:00
|
|
|
RECON_INFO("dataRefPath:{0}",dataRefPath);
|
|
|
|
|
RECON_INFO("UR Args End=======================");
|
|
|
|
|
RECON_INFO("UR Start");
|
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
|
|
|
return exitcode;
|
|
|
|
|
}
|
|
|
|
|
else{
|
2024-09-19 15:36:10 +08:00
|
|
|
return exitcode;
|
2023-11-21 14:03:52 +08:00
|
|
|
}
|
2023-05-04 16:37:33 +08:00
|
|
|
}
|