补充InSAR的成像的相关工具箱

1. 增加了InSAR成像平面文件生成
2. BP成像中,增加了参考距离的相关代码
pull/10/head
陈增辉 2025-04-07 10:33:12 +08:00
parent eca5bc4575
commit 5bc08bb242
12 changed files with 961 additions and 7 deletions

View File

@ -145,6 +145,87 @@ __global__ void Kernel_RDProcess_doppler(
__global__ void Kernel_RDProcess_doppler_calRangeDistance(
double* demX, double* demY, double* demZ,
double* outR,
long pixelcount,
double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
double reftime, double r0, double r1, double r2, double r3, double r4,
double starttime, double nearRange, double farRange,
double PRF, double Fs,
double fact_lamda
) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < pixelcount) {
double demx = demX[idx];
double demy = demY[idx];
double demz = demZ[idx];
double dt = 1.0 / PRF / 3;
double Spx = 0, Spy = 0, Spz = 0, Svx = 0, Svy = 0, Svz = 0;
double Rx = 0, Ry = 0, Rz = 0, R = 0;
double dp1 = 0, dpn1 = 0, dp2 = 0, dpn2 = 0;
double ti = 0;
double inct = 0;
for (long i = 0; i < 10000; i++) { // ×î´óľü´úˇśÎ§
Spx = getPolyfitNumber(ti + dt, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5);
Spy = getPolyfitNumber(ti + dt, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5);
Spz = getPolyfitNumber(ti + dt, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5);
Svx = getPolyfitNumber(ti + dt, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5);
Svy = getPolyfitNumber(ti + dt, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5);
Svz = getPolyfitNumber(ti + dt, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5);
Rx = Spx - demx;
Ry = Spy - demy;
Rz = Spz - demz;
R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
Rx = Rx / R;
Ry = Ry / R;
Rz = Rz / R;
dp2 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda);
dpn2 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime);
// ti
Spx = getPolyfitNumber(ti, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5);
Spy = getPolyfitNumber(ti, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5);
Spz = getPolyfitNumber(ti, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5);
Svx = getPolyfitNumber(ti, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5);
Svy = getPolyfitNumber(ti, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5);
Svz = getPolyfitNumber(ti, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5);
Rx = Spx - demx;
Ry = Spy - demy;
Rz = Spz - demz;
R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
Rx = Rx / R;
Ry = Ry / R;
Rz = Rz / R;
dp1 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda);
dpn1 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime);
// iter
inct = dt * (dp2 - dpn1) / (dp1 - dp2);
if (abs(inct) <= dt || isnan(inct)) {
outR[idx] = R;//Rd_c;
return;
}
ti = ti + inct;
}
outR[idx] = 0;
}
}
void RDProcess_dopplerGPU(
@ -185,6 +266,51 @@ void RDProcess_dopplerGPU(
cudaDeviceSynchronize();
}
void RDProcess_dopplerGPU_InSARImagePlaneXYZR(
double* demX, double* demY, double* demZ,
double* outR,
long rowcount, long colcount,
double starttime, double nearRange, double farRange,
double PRF, double Fs,
double fact_lamda,
double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
double reftime, double r0, double r1, double r2, double r3, double r4
)
{
long pixelcount = rowcount * colcount;
int numBlocks = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
Kernel_RDProcess_doppler_calRangeDistance << <numBlocks, BLOCK_SIZE >> > (
demX, demY, demZ,
outR,
pixelcount,
Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
Xp5, Yp5, Zp5, Xv5, Yv5, Zv5,
reftime, r0, r1, r2, r3, r4,
starttime, nearRange, farRange,
PRF, Fs,
fact_lamda
);
PrintLasterError("RD with doppler function");
cudaDeviceSynchronize();
}
__device__ double calculateIncidenceAngle(double Rx, double Ry, double Rz, double Sx, double Sy, double Sz) {
double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz;
double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);

View File

@ -57,3 +57,21 @@ extern "C" void RDProcess_demSloperGPU(
);
extern "C" void RDProcess_dopplerGPU_InSARImagePlaneXYZR(
double* demX, double* demY, double* demZ,
double* outR,
long rowcount, long colcount,
double starttime, double nearRange, double farRange,
double PRF, double Fs,
double fact_lamda,
double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
double reftime, double r0, double r1, double r2, double r3, double r4
);

View File

@ -0,0 +1,385 @@
#include "QCreateInSARImagePlaneXYZRDialog.h"
#include "ui_QCreateInSARImagePlaneXYZRDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SatelliteOribtModel.h"
#include "SARSimulationTaskSetting.h"
#include "ImageOperatorBase.h"
#include "FileOperator.h"
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#include "LookTableSimulationComputer.cuh"
#include <QDebug>
#include "ImageShowDialogClass.h"
#include "QToolProcessBarDialog.h"
QCreateInSARImagePlaneXYZRDialog::QCreateInSARImagePlaneXYZRDialog(QWidget* parent)
: QDialog(parent), ui(new Ui::QCreateInSARImagePlaneXYZRDialogClass)
{
ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
connect(ui->pushButtonDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEMClicked(bool)));
connect(ui->pushButtonSloper, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSloperClicked(bool)));
connect(ui->pushButtonOrbitModel, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOrbitModelClicked(bool)));
connect(ui->pushButtonOutDir, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOutDirClicked(bool)));
connect(ui->pushButtonSataSetting, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSataSettingClicked(bool)));
}
QCreateInSARImagePlaneXYZRDialog::~QCreateInSARImagePlaneXYZRDialog()
{
}
void QCreateInSARImagePlaneXYZRDialog::onrejected()
{
this->close();
}
void QCreateInSARImagePlaneXYZRDialog::onpushButtonOrbitModelClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"GPS Orbit Model xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->OrbitModelPathLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QCreateInSARImagePlaneXYZRDialog::onpushButtonSataSettingClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"Satellite Params setting xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->SateSettingLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QCreateInSARImagePlaneXYZRDialog::onpushButtonDEMClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM XYZ Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->DEMLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QCreateInSARImagePlaneXYZRDialog::onpushButtonSloperClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM Sloper Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->SloperLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QCreateInSARImagePlaneXYZRDialog::onpushButtonOutDirClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getExistingDirectory(this,
u8"DEM Raster Select", // 对话框标题
"" // 初始目录,可以设置为路径
);
if (!fileName.isEmpty()) {
this->ui->outDirLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QCreateInSARImagePlaneXYZRDialog::LookTableSimualtionMainProcess(QString sateName, QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath)
{
if (!isExists(orbitpath)) {
qDebug() << "Orbit model file is not exist !!!";
return;
}
if (!isExists(SatePath)) {
qDebug() << "Satellite Model file is not exist !!!";
return;
}
if (!isExists(DEMPath)) {
qDebug() << "DEM file is not exist !!!";
return;
}
// 读取轨道模型
qDebug() << "load orbit model params from xml :" << orbitpath;
PolyfitSatelliteOribtModel orbitmodel;
orbitmodel.loadFromXml(orbitpath);
// 轨道参数
long double OribtStartTime = orbitmodel.getOribtStartTime();
std::vector<double> PolyfitPx = orbitmodel.getPolyfitPx();
std::vector<double> PolyfitPy = orbitmodel.getPolyfitPy();
std::vector<double> PolyfitPz = orbitmodel.getPolyfitPz();
std::vector<double> PolyfitVx = orbitmodel.getPolyfitVx();
std::vector<double> PolyfitVy = orbitmodel.getPolyfitVy();
std::vector<double> PolyfitVz = orbitmodel.getPolyfitVz();
// 参数模型
qDebug() << "load simulation setting params from xml :" << orbitpath;
std::shared_ptr<AbstractSARSatelliteModel> SARSetting = ReadSimulationSettingsXML(SatePath);
// 多普勒参数
double dopplerRefrenceTime = SARSetting->getDopplerParametersReferenceTime();
std::vector<double> DopplerCentroidCoefficients = SARSetting->getDopplerCentroidCoefficients();
std::vector<double> DopplerRateValuesCoefficient = SARSetting->getDopplerRateValuesCoefficients();
// 仿真成像参数计算
double startTime = SARSetting->getSARImageStartTime();
double endTime = SARSetting->getSARImageStartTime();
double PRF = SARSetting->getPRF();
double Fs = SARSetting->getFs();
double nearRange = SARSetting->getNearRange();
double farRange = SARSetting->getFarRange();
double lamda = SARSetting->getCenterLamda();
// 输出结果处理
QString outLookTablePath = "";
QString outIncPath = "";
gdalImage demimg(DEMPath);
outLookTablePath = JoinPath(outDirPath, sateName + "_looktable.bin");
this->ui->label_tip->setText(u8"look table create...");
this->LookTableSimulationDopplerProcess(
DEMPath,
outLookTablePath,
OribtStartTime,
PolyfitPx, PolyfitPy, PolyfitPz,
PolyfitVx, PolyfitVy, PolyfitVz,
dopplerRefrenceTime,
DopplerCentroidCoefficients,
startTime,
endTime,
nearRange,
farRange,
PRF,
Fs,
lamda
);
}
void QCreateInSARImagePlaneXYZRDialog::LookTableSimulationDopplerProcess(QString DEMPath, QString outLookTablePath, long double OribtStartTime, std::vector<double> PolyfitPx, std::vector<double> PolyfitPy, std::vector<double> PolyfitPz, std::vector<double> PolyfitVx, std::vector<double> PolyfitVy, std::vector<double> PolyfitVz, double dopplerRefrenceTime, std::vector<double> DopplerCentroidCoefficients, double starttime, double endtime, double nearRange, double farRange, double PRF, double Fs, double lamda)
{
qDebug() << "generate look table ";
qDebug() << "DEMPath\t" << DEMPath;
qDebug() << "outLookTablePath\t" << outLookTablePath;
gdalImage demimg(DEMPath);
gdalImage outLookTable = CreategdalImage( // 创建查找表
outLookTablePath,
demimg.height, demimg.width, 4,
demimg.gt,
demimg.projection,
true,
true,
true
);
starttime = starttime - OribtStartTime; // 处理坐标时间
endtime = endtime - OribtStartTime;
// 轨道模型
double Xp0 = 0, Yp0 = 0, Zp0 = 0, Xv0 = 0, Yv0 = 0, Zv0 = 0;
double Xp1 = 0, Yp1 = 0, Zp1 = 0, Xv1 = 0, Yv1 = 0, Zv1 = 0;
double Xp2 = 0, Yp2 = 0, Zp2 = 0, Xv2 = 0, Yv2 = 0, Zv2 = 0;
double Xp3 = 0, Yp3 = 0, Zp3 = 0, Xv3 = 0, Yv3 = 0, Zv3 = 0;
double Xp4 = 0, Yp4 = 0, Zp4 = 0, Xv4 = 0, Yv4 = 0, Zv4 = 0;
double Xp5 = 0, Yp5 = 0, Zp5 = 0, Xv5 = 0, Yv5 = 0, Zv5 = 0;
int degree = PolyfitPx.size();
switch (degree) {
case(6):
Xp5 = PolyfitPx[5];
Yp5 = PolyfitPy[5];
Zp5 = PolyfitPz[5];
Xv5 = PolyfitVx[5];
Yv5 = PolyfitVy[5];
Zv5 = PolyfitVz[5];
case(5):
Xp4 = PolyfitPx[4];
Yp4 = PolyfitPy[4];
Zp4 = PolyfitPz[4];
Xv4 = PolyfitVx[4];
Yv4 = PolyfitVy[4];
Zv4 = PolyfitVz[4];
case(4):
Xp3 = PolyfitPx[3];
Yp3 = PolyfitPy[3];
Zp3 = PolyfitPz[3];
Xv3 = PolyfitVx[3];
Yv3 = PolyfitVy[3];
Zv3 = PolyfitVz[3];
case(3):
Xp2 = PolyfitPx[2];
Yp2 = PolyfitPy[2];
Zp2 = PolyfitPz[2];
Xv2 = PolyfitVx[2];
Yv2 = PolyfitVy[2];
Zv2 = PolyfitVz[2];
case(2):
Xp1 = PolyfitPx[1];
Yp1 = PolyfitPy[1];
Zp1 = PolyfitPz[1];
Xv1 = PolyfitVx[1];
Yv1 = PolyfitVy[1];
Zv1 = PolyfitVz[1];
case(1):
Xp0 = PolyfitPx[0];
Yp0 = PolyfitPy[0];
Zp0 = PolyfitPz[0];
Xv0 = PolyfitVx[0];
Yv0 = PolyfitVy[0];
Zv0 = PolyfitVz[0];
default:
break;
}
// 多普勒参数
double r0 = 0, r1 = 0, r2 = 0, r3 = 0, r4 = 0;
degree = DopplerCentroidCoefficients.size();
switch (degree)
{
case(5):
r4 = DopplerCentroidCoefficients[4];
case(4):
r3 = DopplerCentroidCoefficients[3];
case(3):
r2 = DopplerCentroidCoefficients[2];
case(2):
r1 = DopplerCentroidCoefficients[1];
case(1):
r0 = DopplerCentroidCoefficients[0];
default:
break;
}
// 处理分块
long GPUMemoryline = floor((Memory1MB * 2.0 / 8.0 / 3.0 / demimg.width * 2000));//2GB
GPUMemoryline = GPUMemoryline < 1 ? 1 : GPUMemoryline;
// 内存预分配
double fact_lamda = 1 / lamda;
for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) {
long rowcount = GPUMemoryline;
long colcount = demimg.width;
qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//double* tmep = new double[rowcount * colcount];
std::shared_ptr<double> demX = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//
std::shared_ptr<double> host_R((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_R((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
// 数据复制
memcpy(host_demX.get(), demX.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demY.get(), demY.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demZ.get(), demZ.get(), sizeof(double) * rowcount * colcount);
//内存->GPU
HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * rowcount * demimg.width);
qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
RDProcess_dopplerGPU_InSARImagePlaneXYZR(
device_demX.get(), device_demY.get(), device_demZ.get(),
device_R.get(),
rowcount, colcount,
starttime, nearRange, farRange,
PRF, Fs,
fact_lamda,
Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
Xp5, Yp5, Zp5, Xv5, Yv5, Zv5,
dopplerRefrenceTime, r0, r1, r2, r3, r4);
// GPU -> 内存
DeviceToHost(host_R.get(), device_R.get(), sizeof(double) * rowcount * demimg.width);
qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//exit(-1);
// 数据存储
outLookTable.saveImage(demX, rid, 0, rowcount, colcount, 1);
outLookTable.saveImage(demY, rid, 0, rowcount, colcount, 2);
outLookTable.saveImage(demZ, rid, 0, rowcount, colcount, 3);
outLookTable.saveImage(host_R, rid, 0, rowcount, colcount, 4);
qDebug() << "GPU computer result write finished: " << rid << " ~ " << rowcount + rid << "\t:" << demimg.height;
}
qDebug() << "look table computed finished!!!";
}
void QCreateInSARImagePlaneXYZRDialog::onaccepted()
{
QString orbitpath = this->ui->OrbitModelPathLineEdit->text();
QString SatePath = this->ui->SateSettingLineEdit->text();
QString DEMPath = this->ui->DEMLineEdit->text();
QString outDirPath = this->ui->outDirLineEdit->text();
QString simulationName = this->ui->lineEditLookName->text();
this->LookTableSimualtionMainProcess(
simulationName,
orbitpath, SatePath, DEMPath, outDirPath
);
QMessageBox::information(this, u8"info", u8"completed!!!");
}

View File

@ -0,0 +1,70 @@
#pragma once
#include <QDialog>
namespace Ui {
class QCreateInSARImagePlaneXYZRDialogClass;
}
class QCreateInSARImagePlaneXYZRDialog : public QDialog
{
Q_OBJECT
public:
QCreateInSARImagePlaneXYZRDialog(QWidget *parent = nullptr);
~QCreateInSARImagePlaneXYZRDialog();
private:
Ui::QCreateInSARImagePlaneXYZRDialogClass* ui;
public slots:
void onaccepted();
void onrejected();
void onpushButtonOrbitModelClicked(bool);
void onpushButtonSataSettingClicked(bool);
void onpushButtonDEMClicked(bool);
void onpushButtonSloperClicked(bool);
void onpushButtonOutDirClicked(bool);
private: // doppler 处理软件
void LookTableSimualtionMainProcess(
QString sateName,
QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath
);
void LookTableSimulationDopplerProcess(
QString DEMPath,
QString outLookTablePath,
// 多项式轨道参数
long double OribtStartTime, // 轨道模型参考时间
std::vector<double> PolyfitPx, // 5次项空余填0
std::vector<double> PolyfitPy, // 5次项空余填0
std::vector<double> PolyfitPz, // 5次项空余填0
std::vector<double> PolyfitVx, // 5次项空余填0
std::vector<double> PolyfitVy, // 5次项空余填0
std::vector<double> PolyfitVz, // 5次项空余填0
// 多普勒参数
double dopplerRefrenceTime,
std::vector<double> DopplerCentroidCoefficients,// d0 ~ d5 空余填零
// 其他成像参数
double starttime, // 成像开始时间
double endtime, // 成像结束时间
double nearRange, // 近斜距
double farRange, // 远斜距
double PRF, // 脉冲重复采样频率
double Fs, // 距离采样频率
double lamda
);
};

View File

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QCreateInSARImagePlaneXYZRDialogClass</class>
<widget class="QDialog" name="QCreateInSARImagePlaneXYZRDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>763</width>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
<string>QCreateInSARImagePlaneXYZR</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonSloper">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonDEM">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="SloperLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxDoppler">
<property name="text">
<string>采用多普勒参数</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>卫星仿真参数:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonSataSetting">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>DEM文件(XYZ)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>坡度法向文件(sloper)</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OrbitModelPathLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditLookName">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>LT1A_20250210</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="outDirLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\Looktable</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_tip">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonOrbitModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>多项式轨道模型参数:</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="DEMLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>结果文件保存地址:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像平面文件名</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonOutDir">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SateSettingLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -56,7 +56,7 @@ __global__ void fftshiftKernel(cufftComplex* data, int Nfft, int Np) {
__global__ void processPulseKernel(
long prfid,
int nx, int ny,
const double* x_mat, const double* y_mat, const double* z_mat,
const double* x_mat, const double* y_mat, const double* z_mat,const double* R_mat,
double AntX, double AntY, double AntZ,
double R0, double minF,
const cufftComplex* rc_pulse,
@ -78,6 +78,7 @@ __global__ void processPulseKernel(
double dx = AntX - x_mat[idx];
double dy = AntY - y_mat[idx];
double dz = AntZ - z_mat[idx];
double initR = R_mat[idx];
//printf("processPulseKernel xmat !!\n");
double R = sqrt(dx * dx + dy * dy + dz * dz);
@ -98,7 +99,7 @@ __global__ void processPulseKernel(
rc_interp.y = rc_low.y * (1 - weight) + rc_high.y * weight;
// Phase correction
double phase = 4 * PI * minF / c * dR;
double phase = 4 * PI * minF / c * (dR- initR); // ²¹³äµ±Ç°µãµÄ²Î¿¼¾àÀë
double cos_phase = cos(phase);
double sin_phase = sin(phase);
@ -109,8 +110,12 @@ __global__ void processPulseKernel(
// Accumulate
im_final[idx].x += phCorr.x;
im_final[idx].y += phCorr.y;
//printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR);
if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) {
//if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) {
//printf(
// "[DEBUG] prfid=%-4ld | idx=%-8lld\n"
// " Ant: X=%-18.10e Y=%-18.10e Z=%-18.10e\n"
@ -133,7 +138,7 @@ __global__ void processPulseKernel(
// phCorr.x, phCorr.y,
// im_final[idx].x, im_final[idx].y
//);
}
//}
}
void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) {
@ -177,7 +182,7 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) {
processPulseKernel << <grid_size, BLOCK_SIZE >> > (
ii,
data.nx, data.ny,
data.x_mat, data.y_mat, data.z_mat,
data.x_mat, data.y_mat, data.z_mat,data.R_mat,
data.AntX[ii], data.AntY[ii], data.AntZ[ii],
data.R0, data.minF[ii],
data.phdata,
@ -206,6 +211,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) {
d_data.x_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.y_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.z_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.R_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.r_vec = h_data.r_vec;// (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft);
d_data.Freq = (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft);
d_data.phdata = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * h_data.Nfft * h_data.Np);
@ -218,6 +224,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) {
HostToDevice(h_data.x_mat, d_data.x_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image X Copy finished!!!\n");
HostToDevice(h_data.y_mat, d_data.y_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image Y Copy finished!!!\n");
HostToDevice(h_data.z_mat, d_data.z_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image Z Copy finished!!!\n");
HostToDevice(h_data.R_mat, d_data.R_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image R Copy finished!!!\n");
HostToDevice(h_data.Freq, d_data.Freq, sizeof(double) * h_data.Nfft);
//HostToDevice(h_data.r_vec, d_data.r_vec, sizeof(double) * h_data.Nfft);
HostToDevice(h_data.phdata, d_data.phdata, sizeof(cuComplex) * h_data.Nfft * h_data.Np); printf("image echo Copy finished!!!\n");
@ -242,6 +249,7 @@ void freeGPUData(GPUDATA& d_data) {
FreeCUDADevice((d_data.x_mat));
FreeCUDADevice((d_data.y_mat));
FreeCUDADevice((d_data.z_mat));
FreeCUDADevice((d_data.R_mat));
//FreeCUDADevice((d_data.r_vec));
FreeCUDADevice((d_data.Freq));
FreeCUDADevice((d_data.phdata));

View File

@ -21,7 +21,7 @@
struct GPUDATA {
long Nfft, K, Np, nx, ny; // 傅里叶点数、频点数、脉冲数、图像列、图像行
double* AntX, * AntY, * AntZ, * minF; // 天线坐标、起始频率
double* x_mat, * y_mat, * z_mat;// 華醱釴梓
double* x_mat, * y_mat, * z_mat,*R_mat;// 華醱釴梓
double* r_vec; // 坐标范围
double* Freq;// 频率
cuComplex* phdata;// 回波

View File

@ -178,6 +178,18 @@ ErrorCode TBPImageAlgCls::ProcessGPU()
std::shared_ptr<double> demX = readDataArr<double>(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demY = readDataArr<double>(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demZ = readDataArr<double>(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demR= demgridimg.band_num==3?
readDataArr<double>(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD):
readDataArr<double>(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 4, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
if (nullptr == demR) {
for (long i = 0; i < img_blockRowCount; i++) {
for (long j = 0; j < img_blockColCount; j++) {
demR.get()[i * img_blockColCount + j] = 0;
}
}
}
h_data.x_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); // 成像网格
h_data.y_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount);

View File

@ -9,6 +9,7 @@
#include "QtLinearToIntenisityDialog.h"
#include "InitCreateImageXYZDialog.h"
#include "ImagePlaneAtiInterpDialog.h"
#include "QCreateInSARImagePlaneXYZRDialog.h"
SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent)
@ -80,6 +81,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi
emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox));
}
@ -181,3 +183,20 @@ void ImagePlaneAtiInterpToolButton::run()
ImagePlaneAtiInterpDialog* dialog = new ImagePlaneAtiInterpDialog;
dialog->show();
}
QCreateInSARImagePlaneXYZRToolButton::QCreateInSARImagePlaneXYZRToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"成像工具库");
this->toolname = QString(u8"1.创建InSAR成像平面");
}
QCreateInSARImagePlaneXYZRToolButton::~QCreateInSARImagePlaneXYZRToolButton()
{
}
void QCreateInSARImagePlaneXYZRToolButton::run()
{
QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog;
dialog->show();
}

View File

@ -119,6 +119,17 @@ public:
};
class SIMULATIONSARTOOL_EXPORT QCreateInSARImagePlaneXYZRToolButton : public QToolAbstract {
Q_OBJECT
public:
QCreateInSARImagePlaneXYZRToolButton(QWidget* parent = nullptr);
~QCreateInSARImagePlaneXYZRToolButton();
public:
virtual void run() override;
};
extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);

View File

@ -217,6 +217,7 @@
<ClCompile Include="SARImage\ImageNetOperator.cpp" />
<ClCompile Include="SARImage\ImagePlaneAtiInterpDialog.cpp" />
<ClCompile Include="SARImage\InitCreateImageXYZDialog.cpp" />
<ClCompile Include="SARImage\QCreateInSARImagePlaneXYZRDialog.cpp" />
<ClCompile Include="SimulationSAR\QImageSARRFPC.cpp" />
<ClCompile Include="SimulationSAR\QSARLookTableSimualtionGUI.cpp" />
<ClCompile Include="SimulationSAR\QSimulationBPImage.cpp" />
@ -245,6 +246,7 @@
<ClInclude Include="SARImage\GPUBPImageNet.cuh" />
<ClInclude Include="SARImage\ImageNetOperator.h" />
<QtMoc Include="SARImage\ImagePlaneAtiInterpDialog.h" />
<QtMoc Include="SARImage\QCreateInSARImagePlaneXYZRDialog.h" />
<ClInclude Include="SimulationSARToolAPI.h" />
<ClInclude Include="simulationsartool_global.h" />
<QtMoc Include="SimulationSAR\QImageSARRFPC.h" />
@ -281,6 +283,7 @@
<QtUic Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.ui" />
<QtUic Include="SARImage\ImagePlaneAtiInterpDialog.ui" />
<QtUic Include="SARImage\InitCreateImageXYZDialog.ui" />
<QtUic Include="SARImage\QCreateInSARImagePlaneXYZRDialog.ui" />
<QtUic Include="SimulationSAR\QImageSARRFPC.ui" />
<QtUic Include="SimulationSAR\QSARLookTableSimualtionGUI.ui" />
<QtUic Include="SimulationSAR\QSimulationBPImage.ui" />

View File

@ -80,7 +80,7 @@
<ClInclude Include="SARImage\GPUBPImageNet.cuh">
<Filter>SARImage</Filter>
</ClInclude>
<ClInclude Include="SARImage\ImagePlaneAtiInterpDialog.h">
<ClInclude Include="SARImage\QCreateInSARImagePlaneXYZRDialog.h">
<Filter>SARImage</Filter>
</ClInclude>
</ItemGroup>
@ -145,6 +145,9 @@
<ClCompile Include="SARImage\ImagePlaneAtiInterpDialog.cpp">
<Filter>SARImage</Filter>
</ClCompile>
<ClCompile Include="SARImage\QCreateInSARImagePlaneXYZRDialog.cpp">
<Filter>SARImage</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtUic Include="SimulationSAR\QImageSARRFPC.ui">
@ -180,6 +183,9 @@
<QtUic Include="SARImage\ImagePlaneAtiInterpDialog.ui">
<Filter>SARImage</Filter>
</QtUic>
<QtUic Include="SARImage\QCreateInSARImagePlaneXYZRDialog.ui">
<Filter>SARImage</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<QtMoc Include="SimulationSAR\QImageSARRFPC.h">
@ -215,6 +221,9 @@
<QtMoc Include="SARImage\InitCreateImageXYZDialog.h">
<Filter>SARImage</Filter>
</QtMoc>
<QtMoc Include="SARImage\ImagePlaneAtiInterpDialog.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="SimulationSAR\GPURFPC.cu">