Add usage of command line.
This commit is contained in:
64
src/main.cxx
64
src/main.cxx
@@ -1,24 +1,66 @@
|
||||
#include "config/config.h"
|
||||
#include <vector>
|
||||
#define EIGEN_USE_MKL_ALL
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include <complex>
|
||||
|
||||
#include "common/ceMatchedFilterHandling.h"
|
||||
#include "MatlabReader.h"
|
||||
#include "src/common/fileHelper.h"
|
||||
#include "startReconstructions.h"
|
||||
#include "log/log.h"
|
||||
|
||||
int main()
|
||||
/* 0 is data path.
|
||||
1 is dataRef path.
|
||||
2 is output path.
|
||||
3 is config file path.
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
auto defaultLogger = getLogger("Main");
|
||||
spdlog::set_default_logger(defaultLogger);
|
||||
int argNum = 4;
|
||||
std::vector<std::string> args(argNum);
|
||||
args[0] = "";
|
||||
args[1] = "";
|
||||
args[2] = Recon::DEFAULT_OUTPUT_PATH;
|
||||
args[3] = 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;
|
||||
}
|
||||
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 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
std::string dataPath = Recon::fixPathSlash(args[0]);
|
||||
std::string dataRefPath = Recon::fixPathSlash(args[1]);
|
||||
RECON_INFO("start");
|
||||
Recon::initalizeConfig();
|
||||
Recon::startReconstructions();
|
||||
Recon::startReconstructions(dataPath, dataRefPath, outPutPath);
|
||||
SPDLOG_INFO("finish");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user