// FEKONearBpBaseImage.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "FEKONearBPBasic.h"
#include <string>
#include <iostream>
#include "LampToolTest.h"

int TestImageBP_main(int argc, char* argv[])
{
    qDebug() << "process starting .......\n";
    qDebug() << "-i  in_echo.bin  -o out_resule.bin -Rref 10 -minX -1 -maxX 1 -minY -1 -maxY 1 -PlaneZ 0 -ImageHeight 201 -ImageWidth 201" << "\n";
    qDebug() << "BP mehtod for FEKO Near field (Cartesian) " << "\n";
    qDebug() << "format: " << "\n";
    qDebug() << "height[int32] width[int32] frequencylist[width*double]   echoData   " << "\n";
    qDebug() << "echoData format: ant[x,y,z 3xdouble] real[width*double] imag[width*double]" << "\n";
    qDebug() << "echodata [freqNUM,PRF_num]" << "\n";
    qDebug() << "warnning:Eigen default matrix is  row-major storage" << "\n";
    qDebug() << "===============params list==============================" << "\n";
    QString in_path = "";
    QString out_path = "";
    int mode = 1;
    double Rref=0, minX=0, maxX = 0, minY = 0, maxY = 0, PlaneZ = 0, ImageHeight = 0, ImageWidth = 0;
    for (int i = 0; i < argc; i++) {
        qDebug() << argv[i] << "\n";
    }
    for (int i = 0; i < argc; i++) {
        if (strcmp(argv[i], "-i")==0) {
            if (i == argc - 1) { return 1; }
            in_path = argv[i + 1];
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-o") == 0) {
            if (i == argc - 1) { return 1; }
            out_path = argv[i + 1];
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-Rref") == 0) {
            if (i == argc - 1) { return 1; }
            Rref =std::stod(argv[i+1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-minX") == 0) {
            if (i == argc - 1) { return 1; }
            minX = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-maxX") == 0) {
            if (i == argc - 1) { return 1; }
            maxX = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-minY") == 0) {
            if (i == argc - 1) { return 1; }
            minY = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-maxY") == 0) {
            if (i == argc - 1) { return 1; }
            maxY = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-PlaneZ") == 0) {
            if (i == argc - 1) { return 1; }
            PlaneZ = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-ImageHeight") == 0) {
            if (i == argc - 1) { return 1; }
            ImageHeight = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-ImageWidth")==0) {
            if (i == argc - 1) { return 1; }
            ImageWidth = std::stod(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
        else if (strcmp(argv[i], "-mode") == 0) {
            if (i == argc - 1) { return 1; }
            mode = std::stoi(argv[i + 1]);
            qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
        }
    }
    qDebug() << "======================================================" << "\n";
    //qDebug() << Eigen::MatrixXd::LinSpaced(1, 10).array() << "\n";
	if (mode == 0) {
		//BP2DProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
	}
	else if (mode == 1) {
        //FBP2DProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
	}
    else if (mode == 2) {

    }

    return 0;
}




