2024-11-25 10:09:24 +00:00
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "TBPImageAlgCls.h"
|
|
|
|
|
#include <QDateTime>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <cmath>
|
2024-11-27 05:10:40 +00:00
|
|
|
|
#include <QProgressDialog>
|
2024-12-20 15:38:34 +00:00
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include "GPUTool.cuh"
|
2024-12-24 07:27:09 +00:00
|
|
|
|
#include "GPUTBPImage.cuh"
|
2025-02-19 06:19:32 +00:00
|
|
|
|
#include "ImageOperatorBase.h"
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
void CreatePixelXYZ(std::shared_ptr<EchoL0Dataset> echoL0ds, QString outPixelXYZPath)
|
|
|
|
|
{
|
2025-02-26 11:39:46 +00:00
|
|
|
|
long bandwidth = echoL0ds->getBandwidth();
|
|
|
|
|
double Rnear = echoL0ds->getNearRange();
|
|
|
|
|
double Rfar = echoL0ds->getFarRange();
|
|
|
|
|
double refRange = echoL0ds->getRefPhaseRange();
|
|
|
|
|
double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
|
|
|
|
|
long prfcount = echoL0ds->getPluseCount();
|
|
|
|
|
long freqcount = echoL0ds->getPlusePoints();
|
|
|
|
|
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
|
|
|
|
|
gt(0, 0) = 0;
|
|
|
|
|
gt(0, 1) = 1;
|
|
|
|
|
gt(0, 2) = 0;
|
|
|
|
|
gt(1, 0) = 0;
|
|
|
|
|
gt(1, 1) = 0;
|
|
|
|
|
gt(1, 2) = 1;
|
2025-02-28 16:47:58 +00:00
|
|
|
|
gdalImage xyzRaster = CreategdalImage(outPixelXYZPath, prfcount, freqcount, 3, gt, QString(""), false, true,true,GDT_Float64);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
2025-02-26 11:39:46 +00:00
|
|
|
|
dx = (echoL0ds->getFarRange()-echoL0ds->getNearRange())/(echoL0ds->getPlusePoints()-1);
|
|
|
|
|
Rnear = echoL0ds->getNearRange();
|
2025-02-24 10:53:35 +00:00
|
|
|
|
double Rref = echoL0ds->getRefPhaseRange();
|
|
|
|
|
double centerInc = echoL0ds->getCenterAngle()*d2r;
|
2025-02-26 11:39:46 +00:00
|
|
|
|
long echocol = Memory1GB * 1.0 / 8 / 4 / prfcount * 6;
|
2025-02-25 05:18:19 +00:00
|
|
|
|
qDebug() << "echocol:\t " << echocol ;
|
2025-02-26 11:39:46 +00:00
|
|
|
|
echocol = echocol < 1 ? 1: echocol;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> Pxs((double*)mallocCUDAHost(sizeof(double)*prfcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
|
|
|
|
double time = 0;
|
|
|
|
|
double Px = 0;
|
|
|
|
|
double Py = 0;
|
|
|
|
|
double Pz = 0;
|
|
|
|
|
for (long i = 0; i < prfcount; i++) {
|
|
|
|
|
|
|
|
|
|
Pxs.get()[i] = antpos.get()[i * 19 + 1]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Pys.get()[i] = antpos.get()[i * 19 + 2];
|
|
|
|
|
Pzs.get()[i] = antpos.get()[i * 19 + 3];
|
|
|
|
|
AntDirectX.get()[i] = antpos.get()[i * 19 + 13];// zero doppler
|
|
|
|
|
AntDirectY.get()[i] = antpos.get()[i * 19 + 14];
|
|
|
|
|
AntDirectZ.get()[i] = antpos.get()[i * 19 + 15];
|
|
|
|
|
|
|
|
|
|
double NormAnt = std::sqrt(AntDirectX.get()[i] * AntDirectX.get()[i] +
|
|
|
|
|
AntDirectY.get()[i] * AntDirectY.get()[i] +
|
|
|
|
|
AntDirectZ.get()[i] * AntDirectZ.get()[i]);
|
|
|
|
|
AntDirectX.get()[i] = AntDirectX.get()[i] / NormAnt;
|
|
|
|
|
AntDirectY.get()[i] = AntDirectY.get()[i] / NormAnt;
|
|
|
|
|
AntDirectZ.get()[i] = AntDirectZ.get()[i] / NormAnt;// <20><>һ<EFBFBD><D2BB>
|
|
|
|
|
}
|
|
|
|
|
antpos.reset();
|
|
|
|
|
}
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
2025-02-27 10:30:29 +00:00
|
|
|
|
HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) {
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
long tempechocol = echocol;
|
|
|
|
|
if (startcolidx + tempechocol >= freqcount) {
|
|
|
|
|
tempechocol = freqcount - startcolidx;
|
|
|
|
|
}
|
|
|
|
|
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << freqcount ;
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> demx = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
|
|
|
|
std::shared_ptr<double> demy = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
|
|
|
|
std::shared_ptr<double> demz = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<double> h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> h_demz((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
|
for (long ii = 0; ii < prfcount; ii++) {
|
|
|
|
|
for (long jj = 0; jj < tempechocol; jj++) {
|
|
|
|
|
h_demx.get()[ii*tempechocol+jj]=demx.get()[ii*tempechocol+jj];
|
|
|
|
|
h_demy.get()[ii*tempechocol+jj]=demy.get()[ii*tempechocol+jj];
|
|
|
|
|
h_demz.get()[ii*tempechocol+jj]=demz.get()[ii*tempechocol+jj];
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
HostToDevice(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
|
|
|
|
HostToDevice(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
|
|
|
|
HostToDevice(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
2025-02-24 10:53:35 +00:00
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
TIMEBPCreateImageGrid(
|
|
|
|
|
d_Pxs.get(), d_Pys.get(), d_Pzs.get(),
|
|
|
|
|
d_AntDirectX.get(), d_AntDirectY.get(), d_AntDirectZ.get(),
|
|
|
|
|
d_demx.get(), d_demy.get(), d_demz.get(),
|
2025-02-28 16:47:58 +00:00
|
|
|
|
prfcount, tempechocol, 1000,
|
2025-03-03 03:18:50 +00:00
|
|
|
|
Rnear+dx* startcolidx, dx, refRange // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-02-26 11:39:46 +00:00
|
|
|
|
);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
2025-02-27 08:16:10 +00:00
|
|
|
|
DeviceToHost(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
|
|
|
|
DeviceToHost(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
|
|
|
|
DeviceToHost(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
|
for (long ii = 0; ii < prfcount; ii++) {
|
|
|
|
|
for (long jj = 0; jj < tempechocol; jj++) {
|
|
|
|
|
demx.get()[ii * tempechocol + jj]=h_demx.get()[ii * tempechocol + jj] ;
|
|
|
|
|
demy.get()[ii * tempechocol + jj]=h_demy.get()[ii * tempechocol + jj] ;
|
|
|
|
|
demz.get()[ii * tempechocol + jj]=h_demz.get()[ii * tempechocol + jj] ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
xyzRaster.saveImage(demx, 0, startcolidx,prfcount,tempechocol, 1);
|
|
|
|
|
xyzRaster.saveImage(demy, 0, startcolidx,prfcount,tempechocol, 2);
|
|
|
|
|
xyzRaster.saveImage(demz, 0, startcolidx,prfcount,tempechocol, 3);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
2025-02-25 08:25:18 +00:00
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
2024-11-29 15:32:50 +00:00
|
|
|
|
|
2024-11-25 10:09:24 +00:00
|
|
|
|
void TBPImageProcess(QString echofile, QString outImageFolder, QString imagePlanePath,long num_thread)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<EchoL0Dataset> echoL0ds(new EchoL0Dataset);
|
|
|
|
|
echoL0ds->Open(echofile);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr< SARSimulationImageL1Dataset> imagL1(new SARSimulationImageL1Dataset);
|
|
|
|
|
imagL1->setCenterAngle(echoL0ds->getCenterAngle());
|
|
|
|
|
imagL1->setCenterFreq(echoL0ds->getCenterFreq());
|
|
|
|
|
imagL1->setNearRange(echoL0ds->getNearRange());
|
|
|
|
|
imagL1->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2);
|
|
|
|
|
imagL1->setFarRange(echoL0ds->getFarRange());
|
|
|
|
|
imagL1->setFs(echoL0ds->getFs());
|
|
|
|
|
imagL1->setLookSide(echoL0ds->getLookSide());
|
2025-02-27 10:30:29 +00:00
|
|
|
|
|
2024-11-25 10:09:24 +00:00
|
|
|
|
imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TBPImageAlgCls TBPimag;
|
|
|
|
|
TBPimag.setEchoL0(echoL0ds);
|
|
|
|
|
TBPimag.setImageL1(imagL1);
|
|
|
|
|
TBPimag.setImagePlanePath(imagePlanePath);
|
|
|
|
|
|
|
|
|
|
TBPimag.Process(num_thread);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
|
2024-11-25 10:09:24 +00:00
|
|
|
|
void TBPImageAlgCls::setImagePlanePath(QString INimagePlanePath)
|
|
|
|
|
{
|
|
|
|
|
this->imagePlanePath = INimagePlanePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString TBPImageAlgCls::getImagePlanePath()
|
|
|
|
|
{
|
|
|
|
|
return this->imagePlanePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBPImageAlgCls::setEchoL0(std::shared_ptr<EchoL0Dataset> inL0ds)
|
|
|
|
|
{
|
|
|
|
|
this->L0ds = inL0ds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBPImageAlgCls::setImageL1(std::shared_ptr<SARSimulationImageL1Dataset> inL1ds)
|
|
|
|
|
{
|
|
|
|
|
this->L1ds = inL1ds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<EchoL0Dataset> TBPImageAlgCls::getEchoL1()
|
|
|
|
|
{
|
|
|
|
|
return this->L0ds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<SARSimulationImageL1Dataset> TBPImageAlgCls::getImageL0()
|
|
|
|
|
{
|
|
|
|
|
return this->L1ds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ErrorCode TBPImageAlgCls::Process(long num_thread)
|
|
|
|
|
{
|
2025-02-26 11:39:46 +00:00
|
|
|
|
|
|
|
|
|
qDebug() << u8"<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
2025-02-28 16:47:58 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>XYZ";
|
2024-12-25 10:47:02 +00:00
|
|
|
|
QString outRasterXYZ = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_xyz.bin");
|
2024-12-20 15:38:34 +00:00
|
|
|
|
CreatePixelXYZ(this->L0ds, outRasterXYZ);
|
2025-03-03 03:44:03 +00:00
|
|
|
|
return this->ProcessWithGridNet(num_thread, outRasterXYZ);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
2025-03-03 03:44:03 +00:00
|
|
|
|
}
|
2025-02-26 11:39:46 +00:00
|
|
|
|
|
2025-03-03 03:44:03 +00:00
|
|
|
|
ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPath)
|
|
|
|
|
{
|
|
|
|
|
this->outRasterXYZPath = xyzRasterPath;
|
|
|
|
|
qDebug() << u8"Ƶ<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>-> ʱ<><CAB1><EFBFBD>ز<EFBFBD>";
|
2025-02-28 16:47:58 +00:00
|
|
|
|
this->TimeEchoDataPath = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_Timeecho.bin");
|
|
|
|
|
this->EchoFreqToTime();
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
// <20><>ʼ<EFBFBD><CABC>Raster
|
|
|
|
|
qDebug() << u8"<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD>";
|
|
|
|
|
long imageheight = this->L1ds->getrowCount();
|
|
|
|
|
long imagewidth = this->L1ds->getcolCount();
|
|
|
|
|
|
2025-03-03 03:44:03 +00:00
|
|
|
|
|
|
|
|
|
long blokline = Memory1GB / 8 / 4 / imageheight * 32;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
blokline = blokline < 1000 ? 1000 : blokline;
|
|
|
|
|
|
|
|
|
|
long startline = 0;
|
|
|
|
|
for (startline = 0; startline < imageheight; startline = startline + blokline) {
|
|
|
|
|
long templine = blokline;
|
|
|
|
|
if (startline + templine >= imageheight) {
|
|
|
|
|
templine = imageheight - startline;
|
|
|
|
|
}
|
2025-03-03 03:44:03 +00:00
|
|
|
|
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startline << "\t-\t" << startline + templine << " / " << imageheight;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
2025-01-08 05:50:02 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> imageRaster = this->L1ds->getImageRaster(startline, templine);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
for (long i = 0; i < templine; i++) {
|
|
|
|
|
for (long j = 0; j < imagewidth; j++) {
|
2025-03-03 03:44:03 +00:00
|
|
|
|
imageRaster.get()[i * imagewidth + j] = std::complex<double>(0, 0);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-03 03:44:03 +00:00
|
|
|
|
this->L1ds->saveImageRaster(imageRaster, startline, templine);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
2025-02-26 11:39:46 +00:00
|
|
|
|
|
2025-02-26 01:45:43 +00:00
|
|
|
|
|
|
|
|
|
qDebug() << u8"Ƶ<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>-> ʱ<><CAB1><EFBFBD>ز<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
if (GPURUN) {
|
|
|
|
|
return this->ProcessGPU();
|
|
|
|
|
}
|
|
|
|
|
else {
|
2025-03-03 03:44:03 +00:00
|
|
|
|
QMessageBox::information(nullptr, u8"<EFBFBD><EFBFBD>ʾ", u8"Ŀǰֻ֧<EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD>");
|
2025-03-03 03:18:50 +00:00
|
|
|
|
return ErrorCode::FAIL;
|
|
|
|
|
}
|
2025-02-27 10:30:29 +00:00
|
|
|
|
return ErrorCode::SUCCESS;
|
2025-03-03 03:44:03 +00:00
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-03-03 03:44:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
ErrorCode TBPImageAlgCls::ProcessGPU()
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
|
|
|
|
|
long rowCount = this->L1ds->getrowCount();
|
|
|
|
|
long colCount = this->L1ds->getcolCount();
|
|
|
|
|
long pixelCount = rowCount * colCount;
|
|
|
|
|
long PRFCount = this->L0ds->getPluseCount();
|
|
|
|
|
long PlusePoints = this->L0ds->getPlusePoints();
|
2025-02-25 05:18:19 +00:00
|
|
|
|
long bandwidth = this->L0ds->getBandwidth();
|
|
|
|
|
|
|
|
|
|
double Rnear = this->L1ds->getNearRange();
|
|
|
|
|
double Rfar = this->L1ds->getFarRange();
|
|
|
|
|
double refRange = this->L0ds->getRefPhaseRange();
|
|
|
|
|
double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b
|
|
|
|
|
Rfar = Rnear + dx * (PlusePoints - 1); // <20><><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
|
2024-12-26 01:49:35 +00:00
|
|
|
|
float freq = this->L1ds->getCenterFreq();
|
2024-12-20 15:38:34 +00:00
|
|
|
|
double factorj = freq * 4 * M_PI / LIGHTSPEED ;
|
|
|
|
|
|
2024-12-26 01:49:35 +00:00
|
|
|
|
qDebug() << "------------------------------------------------";
|
|
|
|
|
qDebug() << "TBP params:";
|
|
|
|
|
qDebug() << "Rnear:\t" << Rnear;
|
|
|
|
|
qDebug() << "Rfar:\t" << Rfar;
|
2025-02-24 10:53:35 +00:00
|
|
|
|
qDebug() << "refRange:\t" << this->getEchoL1()->getRefPhaseRange();
|
2025-02-25 05:18:19 +00:00
|
|
|
|
qDebug() << "dx:\t" << dx;
|
2024-12-26 01:49:35 +00:00
|
|
|
|
qDebug() << "freq:\t" << freq;
|
|
|
|
|
qDebug() << "rowCount:\t" << rowCount;
|
|
|
|
|
qDebug() << "colCount:\t" << colCount;
|
|
|
|
|
qDebug() << "PRFCount:\t" << PRFCount;
|
|
|
|
|
qDebug() << "PlusePoints:\t" << PlusePoints;
|
2025-02-25 08:25:18 +00:00
|
|
|
|
qDebug() << "bandwidth:\t" << bandwidth;
|
2024-12-26 01:49:35 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>λ
|
|
|
|
|
|
|
|
|
|
double deltaF = bandwidth / (PlusePoints - 1);
|
|
|
|
|
double startfreq = freq - bandwidth / 2;
|
|
|
|
|
|
|
|
|
|
double startlamda = LIGHTSPEED / startfreq;
|
2025-02-25 08:25:18 +00:00
|
|
|
|
qDebug() << "deltaF:\t" << deltaF;
|
2024-12-26 01:49:35 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> Pxs (new double[this->L0ds->getPluseCount()],delArrPtr);
|
|
|
|
|
std::shared_ptr<double> Pys (new double[this->L0ds->getPluseCount()],delArrPtr);
|
|
|
|
|
std::shared_ptr<double> Pzs (new double[this->L0ds->getPluseCount()],delArrPtr);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<double> antpos = this->L0ds->getAntPos();
|
|
|
|
|
double time = 0;
|
|
|
|
|
double Px = 0;
|
|
|
|
|
double Py = 0;
|
|
|
|
|
double Pz = 0;
|
|
|
|
|
for (long i = 0; i < rowCount; i++) {
|
|
|
|
|
time = antpos.get()[i *19 + 0];
|
|
|
|
|
Px = antpos.get()[i *19 + 1];
|
|
|
|
|
Py = antpos.get()[i *19 + 2];
|
|
|
|
|
Pz = antpos.get()[i *19 + 3];
|
|
|
|
|
Pxs.get()[i] = Px;
|
|
|
|
|
Pys.get()[i] = Py;
|
|
|
|
|
Pzs.get()[i] = Pz;
|
|
|
|
|
}
|
|
|
|
|
antpos.reset();
|
|
|
|
|
}
|
2025-02-25 08:25:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
2025-02-25 08:25:18 +00:00
|
|
|
|
double dr = sqrt(pow(Pxs.get()[2]- Pxs.get()[1],2)+pow(Pys.get()[2] - Pys.get()[1],2)+pow(Pzs.get()[2] - Pzs.get()[1],2));
|
2025-02-25 05:18:19 +00:00
|
|
|
|
qDebug() << "------- resolution ----------------------------------";
|
|
|
|
|
qDebug() << "Range Resolution (m):\t" << dx ;
|
|
|
|
|
qDebug() << "Cross Resolution (m):\t" << dr;
|
2025-02-25 07:24:45 +00:00
|
|
|
|
qDebug() << "Range Range (m):\t" << dx*PlusePoints;
|
|
|
|
|
qDebug() << "Cross Range (m):\t" << dr*PRFCount;
|
2025-02-25 05:18:19 +00:00
|
|
|
|
qDebug() << "start Freq (Hz):\t" << startfreq;
|
|
|
|
|
qDebug() << "start lamda (m):\t" << startlamda;
|
|
|
|
|
qDebug() << "rowCount:\t" << rowCount;
|
|
|
|
|
qDebug() << "colCount:\t" << colCount;
|
|
|
|
|
qDebug() << "PRFCount:\t" << PRFCount;
|
|
|
|
|
qDebug() << "PlusePoints:\t" << PlusePoints;
|
|
|
|
|
qDebug() << "Rnear:\t" << Rnear;
|
|
|
|
|
qDebug() << "Rfar:\t" << Rfar;
|
|
|
|
|
qDebug() << "refRange:\t" << refRange;
|
|
|
|
|
// <20><>λ<EFBFBD><CEBB><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
long echoBlockline = Memory1GB / 8 / 2 / PlusePoints * 2; //2GB
|
2024-12-20 15:38:34 +00:00
|
|
|
|
echoBlockline = echoBlockline < 1 ? 1 : echoBlockline;
|
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
long imageBlockline = Memory1GB / 8 / 2 / colCount * 2; //2GB
|
2024-12-20 15:38:34 +00:00
|
|
|
|
imageBlockline = imageBlockline < 1 ? 1 : imageBlockline;
|
|
|
|
|
|
|
|
|
|
gdalImage imageXYZ(this->outRasterXYZPath);
|
2025-02-27 10:30:29 +00:00
|
|
|
|
gdalImageComplex imagetimeimg(this->TimeEchoDataPath);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
|
|
|
|
|
long startimgrowid = 0;
|
|
|
|
|
for (startimgrowid = 0; startimgrowid < rowCount; startimgrowid = startimgrowid + imageBlockline) {
|
|
|
|
|
long tempimgBlockline = imageBlockline;
|
|
|
|
|
if (startimgrowid + imageBlockline >= rowCount) {
|
|
|
|
|
tempimgBlockline = rowCount - startimgrowid;
|
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
qDebug() << "\r image create Row Range :\t"<<QString("[%1]").arg(startimgrowid*100.0/ rowCount)<< startimgrowid << "\t-\t" << startimgrowid + tempimgBlockline << "\t/\t" << rowCount;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
// <20><>ȡ<EFBFBD>ֲ<EFBFBD>pixel x,y,z
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<double> img_x = readDataArr<double>(imageXYZ,startimgrowid,0,tempimgBlockline,colCount,1,GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
|
|
|
|
std::shared_ptr<double> img_y = readDataArr<double>(imageXYZ,startimgrowid,0,tempimgBlockline,colCount,2,GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
|
|
|
|
std::shared_ptr<double> img_z = readDataArr<double>(imageXYZ,startimgrowid,0,tempimgBlockline,colCount,3,GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
2025-01-08 05:50:02 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> imgArr = this->L1ds->getImageRaster(startimgrowid, tempimgBlockline);
|
2024-12-20 15:38:34 +00:00
|
|
|
|
// <20><>ȡ<EFBFBD>ز<EFBFBD>
|
|
|
|
|
long startechoid = 0;
|
2025-02-27 10:30:29 +00:00
|
|
|
|
long iffeechoLen = PlusePoints;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
for (long startechoid = 0; startechoid < PRFCount; startechoid = startechoid + echoBlockline) {
|
|
|
|
|
long tempechoBlockline = echoBlockline;
|
|
|
|
|
if (startechoid + tempechoBlockline >= PRFCount) {
|
|
|
|
|
tempechoBlockline = PRFCount - startechoid;
|
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> echoArr = readDataArrComplex < std::complex<double>>(imagetimeimg,startechoid,long(0), tempechoBlockline, iffeechoLen, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);//; this->L0ds->getEchoArr(startechoid, tempechoBlockline);
|
2025-02-26 11:39:46 +00:00
|
|
|
|
std::shared_ptr<double> antpx(new double[tempechoBlockline],delArrPtr);
|
|
|
|
|
std::shared_ptr<double> antpy(new double[tempechoBlockline], delArrPtr);
|
|
|
|
|
std::shared_ptr<double> antpz(new double[tempechoBlockline], delArrPtr);
|
2025-03-03 03:18:50 +00:00
|
|
|
|
|
|
|
|
|
for (long anti = 0; anti < tempechoBlockline; anti++) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-20 15:38:34 +00:00
|
|
|
|
antpx.get()[anti] = Pxs.get()[anti + startechoid];
|
|
|
|
|
antpy.get()[anti] = Pys.get()[anti + startechoid];
|
|
|
|
|
antpz.get()[anti] = Pzs.get()[anti + startechoid];
|
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
|
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
TBPImageGPUAlg2(
|
2025-03-03 03:18:50 +00:00
|
|
|
|
antpx, antpy, antpz, // <20><><EFBFBD><EFBFBD>
|
|
|
|
|
img_x, img_y, img_z, // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
echoArr, // <20>ز<EFBFBD>
|
|
|
|
|
imgArr, // ͼ<><CDBC>
|
2025-02-25 05:18:19 +00:00
|
|
|
|
startfreq, dx,
|
|
|
|
|
Rnear, Rfar, refRange,
|
2024-12-20 15:38:34 +00:00
|
|
|
|
tempimgBlockline, colCount,
|
2025-03-03 03:18:50 +00:00
|
|
|
|
tempechoBlockline, PlusePoints
|
2024-12-29 04:05:41 +00:00
|
|
|
|
);
|
2025-02-25 07:24:45 +00:00
|
|
|
|
qDebug() << QString(" image block PRF:[%1] \t").arg((startechoid + tempechoBlockline) * 100.0 / PRFCount)
|
|
|
|
|
<< startechoid << "\t-\t" << startechoid + tempechoBlockline;
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
|
|
|
|
this->L1ds->saveImageRaster(imgArr, startimgrowid, tempimgBlockline);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] image writing:\t" << this->L1ds->getxmlFilePath();
|
2024-12-24 08:18:14 +00:00
|
|
|
|
this->L1ds->saveToXml();
|
2024-12-20 15:38:34 +00:00
|
|
|
|
return ErrorCode::SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TBPImageGPUAlg2(std::shared_ptr<double> antPx, std::shared_ptr<double> antPy, std::shared_ptr<double> antPz,
|
|
|
|
|
std::shared_ptr<double> img_x, std::shared_ptr<double> img_y, std::shared_ptr<double> img_z,
|
2025-01-08 05:50:02 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> echoArr,
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> img_arr,
|
|
|
|
|
double freq, double dx, double Rnear, double Rfar, double refRange,
|
2024-12-20 15:38:34 +00:00
|
|
|
|
long rowcount, long colcount,
|
2025-03-03 03:18:50 +00:00
|
|
|
|
long prfcount, long freqcount
|
2024-12-20 15:38:34 +00:00
|
|
|
|
)
|
|
|
|
|
{
|
2024-12-24 08:18:14 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
std::shared_ptr<double> h_antPx ((double*)mallocCUDAHost(sizeof(double) * prfcount),FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> h_antPy ((double*)mallocCUDAHost(sizeof(double) * prfcount),FreeCUDAHost);
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<double> h_antPz ((double*)mallocCUDAHost(sizeof(double) * prfcount),FreeCUDAHost);
|
2024-12-27 17:08:08 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<double> d_antPx ((double*)mallocCUDADevice(sizeof(double) * prfcount),FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_antPy ((double*)mallocCUDADevice(sizeof(double) * prfcount),FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_antPz ((double*)mallocCUDADevice(sizeof(double) * prfcount),FreeCUDADevice);
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<double> h_imgx((double*)mallocCUDAHost(sizeof(double) * rowcount * colcount),FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> h_imgy((double*)mallocCUDAHost(sizeof(double) * rowcount * colcount),FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<double> h_imgz((double*)mallocCUDAHost(sizeof(double) * rowcount * colcount),FreeCUDAHost);
|
2024-12-27 17:08:08 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
std::shared_ptr<double> d_imgx ((double*)mallocCUDADevice(sizeof(double) * rowcount * colcount),FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_imgy ((double*)mallocCUDADevice(sizeof(double) * rowcount * colcount),FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<double> d_imgz ((double*)mallocCUDADevice(sizeof(double) * rowcount * colcount),FreeCUDADevice);
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20>ز<EFBFBD><D8B2><EFBFBD>Χ
|
|
|
|
|
std::shared_ptr<cuComplex> h_echoArr((cuComplex*)mallocCUDAHost(sizeof(cuComplex) * prfcount * freqcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<cuComplex> d_echoArr((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * prfcount * freqcount), FreeCUDADevice);
|
2025-02-25 05:18:19 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
std::shared_ptr<cuComplex> h_imgArr((cuComplex*)mallocCUDAHost(sizeof(cuComplex) * rowcount * colcount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<cuComplex> d_imgArr((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * rowcount * colcount), FreeCUDADevice);
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
|
for (long i = 0; i < prfcount; i++) {
|
|
|
|
|
for (long j = 0; j < freqcount; j++) {
|
|
|
|
|
h_echoArr.get()[i * freqcount + j] = make_cuComplex(echoArr.get()[i * freqcount + j].real(),
|
|
|
|
|
echoArr.get()[i * freqcount + j].imag());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
for (long i = 0; i < prfcount; i++) {
|
2025-02-25 05:18:19 +00:00
|
|
|
|
h_antPx.get()[i] = antPx.get()[i];
|
|
|
|
|
h_antPy.get()[i] = antPy.get()[i];
|
|
|
|
|
h_antPz.get()[i] = antPz.get()[i];
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 06:47:54 +00:00
|
|
|
|
#pragma omp parallel for
|
2024-12-20 15:38:34 +00:00
|
|
|
|
for (long i = 0; i < rowcount; i++) {
|
|
|
|
|
for (long j = 0; j < colcount; j++) {
|
2025-02-25 06:47:54 +00:00
|
|
|
|
h_imgx.get()[i * colcount + j] = img_x.get()[i * colcount + j];
|
|
|
|
|
h_imgy.get()[i * colcount + j] = img_y.get()[i * colcount + j];
|
|
|
|
|
h_imgz.get()[i * colcount + j] = img_z.get()[i * colcount + j];
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 06:47:54 +00:00
|
|
|
|
#pragma omp parallel for
|
2025-02-25 05:18:19 +00:00
|
|
|
|
for (long i = 0; i < rowcount; i++) {
|
|
|
|
|
for (long j = 0; j < colcount; j++) {
|
2025-02-25 06:47:54 +00:00
|
|
|
|
h_imgArr.get()[i * colcount + j].x = img_arr.get()[i * colcount + j].real();
|
|
|
|
|
h_imgArr.get()[i * colcount + j].y = img_arr.get()[i * colcount + j].imag();
|
2025-02-25 05:18:19 +00:00
|
|
|
|
}
|
2024-12-29 06:40:02 +00:00
|
|
|
|
}
|
2025-02-25 05:18:19 +00:00
|
|
|
|
HostToDevice(h_imgArr.get(), d_imgArr.get(), sizeof(cuComplex) * rowcount * colcount);
|
2025-03-03 03:18:50 +00:00
|
|
|
|
HostToDevice(h_echoArr.get(), d_echoArr.get(), sizeof(cuComplex) * prfcount * freqcount);
|
|
|
|
|
HostToDevice(h_antPx.get(), d_antPx.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(h_antPy.get(), d_antPy.get(), sizeof(double) * prfcount);
|
|
|
|
|
HostToDevice(h_antPz.get(), d_antPz.get(), sizeof(double) * prfcount);
|
|
|
|
|
|
|
|
|
|
HostToDevice(h_imgx.get(), d_imgx.get(), sizeof(double) * rowcount * colcount);
|
|
|
|
|
HostToDevice(h_imgy.get(), d_imgy.get(), sizeof(double) * rowcount * colcount);
|
|
|
|
|
HostToDevice(h_imgz.get(), d_imgz.get(), sizeof(double) * rowcount * colcount);
|
|
|
|
|
|
2024-12-29 04:05:41 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
// ֱ<><D6B1>ʹ<EFBFBD><CAB9>
|
|
|
|
|
double startlamda = LIGHTSPEED / freq;
|
|
|
|
|
|
|
|
|
|
TimeBPImage(
|
|
|
|
|
d_antPx.get(), d_antPy.get(), d_antPz.get(),
|
|
|
|
|
d_imgx.get(), d_imgy.get(), d_imgz.get(),
|
2025-03-03 03:18:50 +00:00
|
|
|
|
d_echoArr.get(), prfcount, freqcount,
|
2025-02-25 05:18:19 +00:00
|
|
|
|
d_imgArr.get(), rowcount, colcount,
|
2025-03-03 03:18:50 +00:00
|
|
|
|
startlamda, Rnear, dx, refRange,Rfar
|
2025-02-25 05:18:19 +00:00
|
|
|
|
);
|
2024-12-28 08:08:44 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
// Device -> Host
|
|
|
|
|
DeviceToHost(h_imgArr.get(), d_imgArr.get(), sizeof(cuComplex)* rowcount* colcount);
|
|
|
|
|
|
2024-12-28 08:08:44 +00:00
|
|
|
|
|
|
|
|
|
|
2025-02-25 06:47:54 +00:00
|
|
|
|
#pragma omp parallel for
|
2025-02-25 05:18:19 +00:00
|
|
|
|
for (long i = 0; i < rowcount; i++) {
|
|
|
|
|
for (long j = 0; j < colcount; j++) {
|
2025-02-25 06:47:54 +00:00
|
|
|
|
img_arr.get()[i * colcount + j] = std::complex<double>(h_imgArr.get()[i * colcount + j].x, h_imgArr.get()[i * colcount + j].y);
|
2024-12-28 08:08:44 +00:00
|
|
|
|
}
|
2024-12-20 15:38:34 +00:00
|
|
|
|
}
|
2024-12-28 08:08:44 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
|
2024-12-28 08:08:44 +00:00
|
|
|
|
|
2025-02-25 05:18:19 +00:00
|
|
|
|
}
|
2024-12-28 07:25:56 +00:00
|
|
|
|
|
|
|
|
|
|
2024-12-20 15:38:34 +00:00
|
|
|
|
void TBPImageAlgCls::setGPU(bool flag)
|
|
|
|
|
{
|
|
|
|
|
this->GPURUN = flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TBPImageAlgCls::getGPU( )
|
|
|
|
|
{
|
|
|
|
|
return this->GPURUN;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
void TBPImageAlgCls::EchoFreqToTime()
|
2024-11-25 10:09:24 +00:00
|
|
|
|
{
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
2024-11-25 10:09:24 +00:00
|
|
|
|
long PRFCount = this->L0ds->getPluseCount();
|
2025-03-03 03:18:50 +00:00
|
|
|
|
long inColCount = this->L0ds->getPlusePoints();
|
|
|
|
|
long outColCount = inColCount;// nextpow2(inColCount);
|
|
|
|
|
this->TimeEchoRowCount = PRFCount;
|
|
|
|
|
this->TimeEchoColCount = outColCount;
|
|
|
|
|
qDebug() << "IFFT : " << this->TimeEchoDataPath;
|
|
|
|
|
qDebug() << "PRF Count:\t" << PRFCount;
|
|
|
|
|
qDebug() << "inColCount:\t" << inColCount;
|
|
|
|
|
qDebug() << "outColCount:\t" << outColCount;
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
gdalImageComplex outTimeEchoImg = CreategdalImageComplexNoProj(this->TimeEchoDataPath, this->TimeEchoRowCount, this->TimeEchoColCount, 1);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
// <20>ֿ<EFBFBD>
|
|
|
|
|
long echoBlockline = Memory1GB / 8 / 2 / outColCount * 3; //1GB
|
|
|
|
|
echoBlockline = echoBlockline < 1 ? 1 : echoBlockline;
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
long startechoid = 0;
|
|
|
|
|
for (long startechoid = 0; startechoid < PRFCount; startechoid = startechoid + echoBlockline) {
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
long tempechoBlockline = echoBlockline;
|
|
|
|
|
if (startechoid + tempechoBlockline >= PRFCount) {
|
|
|
|
|
tempechoBlockline = PRFCount - startechoid;
|
2024-11-25 10:09:24 +00:00
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
std::shared_ptr<std::complex<double>> echoArr = this->L0ds->getEchoArr(startechoid, tempechoBlockline);
|
|
|
|
|
std::shared_ptr<std::complex<double>> IFFTArr = outTimeEchoImg.getDataComplexSharePtr(startechoid, 0, tempechoBlockline, outColCount, 1);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
std::shared_ptr<cuComplex> host_echoArr((cuComplex*)mallocCUDAHost(sizeof(cuComplex) * tempechoBlockline * outColCount), FreeCUDAHost);
|
|
|
|
|
std::shared_ptr<cuComplex> host_IFFTechoArr((cuComplex*)mallocCUDAHost(sizeof(cuComplex) * tempechoBlockline * outColCount), FreeCUDAHost);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
memset(host_echoArr.get(), 0, sizeof(cuComplex) * tempechoBlockline * outColCount);
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
|
for (long ii = 0; ii < tempechoBlockline; ii++) {
|
|
|
|
|
for (long jj = 0; jj < inColCount; jj++) {
|
|
|
|
|
host_echoArr.get()[ii * outColCount + jj] = make_cuComplex(echoArr.get()[ii * inColCount + jj].real(), echoArr.get()[ii * inColCount + jj].imag());
|
2024-11-25 10:09:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
#pragma omp parallel for
|
|
|
|
|
for (long ii = 0; ii < tempechoBlockline * outColCount; ii++) {
|
|
|
|
|
host_IFFTechoArr.get()[ii] = make_cuComplex(0, 0);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
std::shared_ptr<cuComplex> device_echoArr((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * tempechoBlockline * inColCount), FreeCUDADevice);
|
|
|
|
|
std::shared_ptr<cuComplex> device_IFFTechoArr((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * tempechoBlockline * outColCount), FreeCUDADevice);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
HostToDevice(host_echoArr.get(), device_echoArr.get(), sizeof(cuComplex) * tempechoBlockline * inColCount);
|
|
|
|
|
HostToDevice(host_IFFTechoArr.get(), device_IFFTechoArr.get(), sizeof(cuComplex) * tempechoBlockline * outColCount);
|
|
|
|
|
CUDAIFFT(device_echoArr.get(), device_IFFTechoArr.get(), tempechoBlockline, outColCount, outColCount);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
FFTShift1D(device_IFFTechoArr.get(), tempechoBlockline, outColCount);
|
|
|
|
|
|
|
|
|
|
DeviceToHost(host_IFFTechoArr.get(), device_IFFTechoArr.get(), sizeof(cuComplex) * tempechoBlockline * outColCount);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
2025-03-03 03:18:50 +00:00
|
|
|
|
for (long ii = 0; ii < tempechoBlockline; ii++) {
|
|
|
|
|
for (long jj = 0; jj < outColCount; jj++) {
|
|
|
|
|
IFFTArr.get()[ii * outColCount + jj] = std::complex<double>(host_IFFTechoArr.get()[ii * outColCount + jj].x, host_IFFTechoArr.get()[ii * outColCount + jj].y);
|
|
|
|
|
//IFFTArr.get()[ii * outColCount + jj] = std::complex<double>(host_echoArr.get()[ii * outColCount + jj].x, host_echoArr.get()[ii * outColCount + jj].y);
|
2024-11-25 10:09:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-03 03:18:50 +00:00
|
|
|
|
|
|
|
|
|
outTimeEchoImg.saveImage(IFFTArr, startechoid, 0, tempechoBlockline, outColCount, 1);
|
|
|
|
|
|
|
|
|
|
qDebug() << QString(" image block PRF:[%1] \t").arg((startechoid + tempechoBlockline) * 100.0 / PRFCount)
|
|
|
|
|
<< startechoid << "\t-\t" << startechoid + tempechoBlockline;
|
2024-11-25 10:09:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
|
2025-03-03 03:18:50 +00:00
|
|
|
|
}
|
2024-11-29 15:32:50 +00:00
|
|
|
|
|