构建完整批量处理GF3
parent
8d80a9ff6e
commit
fc4bdf7904
|
@ -269,8 +269,8 @@ bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath, QString outGzFolderPath
|
|||
// tar -zxvf 压缩包路径 文件或目录路径
|
||||
QProcess process;
|
||||
// 同步执行(阻塞当前线程)
|
||||
QString cmdstr = QString("tar -zxvf %1 %2").arg(inTargzPath).arg(outGzFolderPath);
|
||||
process.start("cmd.exe", QStringList() << "/c" << cmdstr); // "/c" 表示执行后关闭 CMD
|
||||
QString cmdstr = QString("tar -zxvf %1 -C %2").arg(inTargzPath).arg(outGzFolderPath);
|
||||
process.execute("cmd.exe", QStringList() << "/c" << cmdstr); // "/c" 表示执行后关闭 CMD
|
||||
process.waitForFinished(); // 等待执行完成
|
||||
// 获取输出
|
||||
QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
|
||||
|
|
|
@ -252,13 +252,15 @@ ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, dou
|
|||
|
||||
inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1);
|
||||
if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) {
|
||||
R = R1; // 斜距
|
||||
return ErrorCode::SUCCESS;
|
||||
break;
|
||||
}
|
||||
inct = std::abs(inct) < 10 ?inct:inct*1e-2;
|
||||
timeR = timeR - inct;
|
||||
}
|
||||
R = R1; // б¾à
|
||||
return ErrorCode::SUCCESS;
|
||||
return ErrorCode::FAIL;
|
||||
|
||||
}
|
||||
|
||||
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath,QString outLocalIncidenceAnglePath,bool localincAngleFlag)
|
||||
|
@ -574,8 +576,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
|
|||
long sourceespgcode = getProjectEPSGCodeByLon_Lat(centerlon, centerlat);
|
||||
long demespgcode = GetEPSGFromRasterFile(indemPath);
|
||||
double grid_resolution = gridx < gridy ? gridx : gridy;
|
||||
double degreePerPixelX = grid_resolution / 110000.0;
|
||||
double degreePerPixelY = grid_resolution / 110000.0;
|
||||
double degreePerPixelX = getPixelSpacingInDegree(grid_resolution);
|
||||
double degreePerPixelY = getPixelSpacingInDegree(grid_resolution);
|
||||
bool meter2degreeflag = ConvertResolutionToDegrees(
|
||||
sourceespgcode,
|
||||
grid_resolution,
|
||||
|
@ -586,8 +588,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
|
|||
);
|
||||
if (!meter2degreeflag) {
|
||||
qDebug() << u8"转换分辨率为经纬度失败";
|
||||
degreePerPixelX = grid_resolution / 110000.0;
|
||||
degreePerPixelY = grid_resolution / 110000.0;
|
||||
degreePerPixelX = getPixelSpacingInDegree(grid_resolution);
|
||||
degreePerPixelY = getPixelSpacingInDegree(grid_resolution);
|
||||
}
|
||||
qDebug() << u8"DEM影像范围:";
|
||||
qDebug() << u8"输入分辨率:"<<gridx<<" \t" << gridy;
|
||||
|
@ -616,24 +618,33 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
|
|||
|
||||
ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString outworkspacefolderpath, double pixelresultionDegreee, bool excutehh2vv)
|
||||
{
|
||||
|
||||
QProgressDialog progressDialog(u8"正射校正处理", u8"", 0, 6);
|
||||
progressDialog.setWindowTitle(u8"正射校正处理");
|
||||
progressDialog.setWindowModality(Qt::WindowModal);
|
||||
progressDialog.setAutoClose(true);
|
||||
progressDialog.setValue(0);
|
||||
progressDialog.setMaximum(6);
|
||||
progressDialog.setMinimum(0);
|
||||
progressDialog.show();
|
||||
|
||||
qDebug() << u8"开始正射校正处理";
|
||||
// 获取任务名称
|
||||
QString tarfilename = getFileNameWidthoutExtend(inTarFilepath);
|
||||
|
||||
|
||||
|
||||
// step 1. 创建工作空间
|
||||
|
||||
GF3TargzFilenameClass tarnameclss=getFilename(tarfilename);
|
||||
QString productionname = tarnameclss.getProductName();
|
||||
QString workfolderpath = JoinPath(outworkspacefolderpath, productionname); // 工作空间
|
||||
createNewFolerPath(workfolderpath, true);
|
||||
qDebug() << u8"step 1. 创建工作空间 ok";
|
||||
progressDialog.setValue(1);
|
||||
// step 2.解压文件
|
||||
QString unarchiverFolderPath = JoinPath(workfolderpath, u8"unarchiver");
|
||||
createNewFolerPath(unarchiverFolderPath, true);
|
||||
unTarfile(inTarFilepath, unarchiverFolderPath);
|
||||
qDebug() << u8"step 2.解压文件 ok";
|
||||
progressDialog.setValue(2);
|
||||
// 在解压文件夹中以及子文件夹查找meta.xml文件
|
||||
QFileInfoList metalist = findFilePath(unarchiverFolderPath, u8"*.meta.xml");
|
||||
if (metalist.count() !=1) {
|
||||
|
@ -649,7 +660,7 @@ ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString o
|
|||
createNewFolerPath(L1AFolder);
|
||||
ImportGF3L1AProcess(metaxmlpath, L1AFolder);
|
||||
qDebug() << u8"step 3.文件转换为通用L1A文件 ok";
|
||||
|
||||
progressDialog.setValue(3);
|
||||
// step 4. 幅度转amp
|
||||
QFileInfoList xmlfilelist = findFilePath(L1AFolder, u8"*.xml");
|
||||
if (xmlfilelist.count() == 0) {
|
||||
|
@ -670,7 +681,7 @@ ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString o
|
|||
|
||||
|
||||
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
|
||||
l1B.OpenOrNew(workfolderpath, l2bfilename, slcl1.getrowCount(), slcl1.getcolCount());
|
||||
l1B.OpenOrNew(outampfolder, l2bfilename, slcl1.getrowCount(), slcl1.getcolCount());
|
||||
QString srcxmlpath = slcl1.getxmlFilePath();
|
||||
QString tarxmlpath = l1B.getxmlFilePath();
|
||||
copyAndReplaceFile(srcxmlpath, tarxmlpath);
|
||||
|
@ -678,20 +689,21 @@ ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString o
|
|||
QString imgfilepath = slcl1.getImageRasterPath();
|
||||
Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath()); // 转振幅
|
||||
}
|
||||
|
||||
progressDialog.setValue(4);
|
||||
// step 5. 创建正射查找表
|
||||
QString L1AXmlPath = xmlfilelist[0].canonicalFilePath();
|
||||
QString looktablefolderpath = JoinPath(workfolderpath, u8"looktableRaster");
|
||||
createNewFolerPath(looktablefolderpath);
|
||||
if (GF3RDProcess(L1AXmlPath, inDEMPath, looktablefolderpath, pixelresultionDegreee, pixelresultionDegreee) == SUCCESS) {
|
||||
qDebug()<<(u8"正射表生成成功");
|
||||
}
|
||||
else {
|
||||
qDebug() << (u8"正射表生成失败");
|
||||
}
|
||||
|
||||
progressDialog.setValue(5);
|
||||
qDebug() << u8"step 4. 创建正射查找表 ok";
|
||||
// step 6. 影像正射
|
||||
QFileInfoList looktableRasterPathList = findFilePath(looktablefolderpath, u8"_looktable.tif");
|
||||
QFileInfoList looktableRasterPathList = findFilePath(looktablefolderpath, u8"*_looktable.tif");
|
||||
if (looktableRasterPathList.count() != 1) {
|
||||
qWarning() << u8"目标文件夹发现了多个查找表,不符合规则";
|
||||
QMessageBox::warning(nullptr, u8"警告", QString(u8"%1:%2").arg(tarfilename).arg(u8"目标文件夹发现了多个查找表,不符合规则"));
|
||||
|
@ -699,48 +711,52 @@ ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString o
|
|||
}
|
||||
|
||||
// step 6.1 影像入射角
|
||||
QFileInfoList looktableAngleRasterPathList = findFilePath(looktablefolderpath, u8"_localAngle.tif");
|
||||
QFileInfoList looktableAngleRasterPathList = findFilePath(looktablefolderpath, u8"*_localAngle.tif");
|
||||
if (looktableAngleRasterPathList.count() != 1) {
|
||||
qWarning() << u8"目标文件夹应该只有1个入射角,不符合规则";
|
||||
QMessageBox::warning(nullptr, u8"警告", QString(u8"%1:%2").arg(tarfilename).arg(u8"目标文件夹发现了1个入射角,不符合规则"));
|
||||
return ErrorCode::METAXMLFOUNDERROR;
|
||||
}
|
||||
QString lookincidenceAnglePath = looktableAngleRasterPathList[0].canonicalFilePath();
|
||||
|
||||
|
||||
|
||||
QString looktableRasterPath = looktableRasterPathList[0].canonicalFilePath();
|
||||
QString outworkpath = JoinPath(workfolderpath, u8"orth");
|
||||
|
||||
createNewFolerPath(outworkpath, true);
|
||||
QFileInfoList l2filelist = findFilePath(outampfolder,u8"*.xml");
|
||||
for (long i = 0; i < l2filelist.count(); i++) {
|
||||
QString inl2filepath = l2filelist[i].canonicalFilePath();
|
||||
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
|
||||
l1B.Open(inl2filepath);
|
||||
QString inRaster = l1B.getImageRasterPath();
|
||||
QString inRasterfolderpath = l1B.getoutFolderPath();
|
||||
QString inRastername = l1B.getImageRasterName();
|
||||
POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(inRastername);
|
||||
QString intempHH2VV = inRaster;
|
||||
|
||||
|
||||
if (poltype == POLARHH && excutehh2vv) {
|
||||
intempHH2VV = JoinPath(inRasterfolderpath, getFileNameWidthoutExtend(inRaster) + "_HH2VV.tif");
|
||||
GF3_Sigma0_HH2VV(inRaster, looktableRasterPath,intempHH2VV);
|
||||
}
|
||||
|
||||
|
||||
QString outname = getFileNameWidthoutExtend(intempHH2VV) + "_orth.tif";
|
||||
QString outname = getFileNameWidthoutExtend(inRaster) + "_orth.tif";
|
||||
QString outstringpath = JoinPath(outworkpath, outname);
|
||||
if (GF3OrthSLC(intempHH2VV, looktableRasterPath, outstringpath) == SUCCESS) {
|
||||
if (GF3OrthSLC(inRaster, looktableRasterPath, outstringpath) == SUCCESS) {
|
||||
qDebug() << (u8"正射生成成功");
|
||||
}
|
||||
else {
|
||||
qDebug() << (u8"正射生成失败");
|
||||
}
|
||||
|
||||
qDebug() << u8"step 5. 正射影像生成 ok";
|
||||
// step 6.2 生成HH2VV
|
||||
POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(outname);
|
||||
if (poltype == POLARHH && excutehh2vv) {
|
||||
qDebug() << u8"HH2VV生成中:"<< outstringpath;
|
||||
QString intempHH2VV = JoinPath(outworkpath, getFileNameWidthoutExtend(outstringpath) + "_HH2VV_dB.tif");
|
||||
GF3_Sigma0_HH2VV(outstringpath, looktableRasterPath,intempHH2VV);
|
||||
}
|
||||
else {
|
||||
// 将amp转换为sigma0
|
||||
QString intempHH2VV = JoinPath(outworkpath, getFileNameWidthoutExtend(outstringpath) + "_HH2VV_dB.tif");
|
||||
amp2dBRaster(outstringpath, intempHH2VV);
|
||||
|
||||
|
||||
|
||||
//qDebug() << u8"HH2VV不需要生成";
|
||||
}
|
||||
qDebug() << u8"step 6. HH2VV生成 ok";
|
||||
|
||||
}
|
||||
progressDialog.setValue(6);
|
||||
|
||||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
int GF3CALIBRATIONANDORTHLIB_EXPORT GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath, SIGMATYPE sigmatype= SIGMATYPE::AMPVALUE);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
|
|
|
@ -19,6 +19,7 @@ QGF3StripBatchProcessDialog::QGF3StripBatchProcessDialog(QWidget *parent)
|
|||
QObject::connect(ui->checkBoxDEM, SIGNAL(stateChanged(int)), this, SLOT(ontstateChanged(int)));
|
||||
QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
|
||||
QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
|
||||
QObject::connect(ui->pushButton_lineDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEM(bool)));
|
||||
|
||||
|
||||
|
||||
|
@ -40,21 +41,23 @@ void QGF3StripBatchProcessDialog::onaccept()
|
|||
}
|
||||
// »ñÈ¡·Ö±æÂÊ
|
||||
double resolutionMeter = ui->doubleSpinBox->value();// ·Ö±æÂÊת¶È
|
||||
double resoiutionDegree = getPixelSpacingInDegree(resolutionMeter);// Ã× -> ¶È
|
||||
//double resoiutionDegree = getPixelSpacingInDegree(resolutionMeter);// 米 -> 度
|
||||
QString workspacedirpath = ui->lineEditWorkDir->text();
|
||||
this->ui->progressBar->setValue(0);
|
||||
this->ui->progressBar->setMaximum(ui->listWidgetMetaxml->count());
|
||||
bool polarHH2VV = ui->checkoutPolarHH2VV->isChecked();
|
||||
for (long i = 0; i < ui->listWidgetMetaxml->count(); i++) {
|
||||
QString inTargzFilePath = ui->listWidgetMetaxml->item(i)->text();
|
||||
|
||||
this->ui->label_info->setText(QString(u8"正射处理:%1").arg(inTargzFilePath));
|
||||
GF3MainOrthProcess(demPath,
|
||||
inTargzFilePath,
|
||||
workspacedirpath,
|
||||
resoiutionDegree,
|
||||
true);
|
||||
resolutionMeter,
|
||||
polarHH2VV);
|
||||
|
||||
this->ui->progressBar->setValue(i);
|
||||
}
|
||||
QMessageBox::information(this, u8"正射处理完成", u8"正射处理完成");
|
||||
}
|
||||
|
||||
void QGF3StripBatchProcessDialog::onreject()
|
||||
|
@ -117,6 +120,17 @@ void QGF3StripBatchProcessDialog::ontstateChanged(int checked)
|
|||
}
|
||||
}
|
||||
|
||||
void QGF3StripBatchProcessDialog::onpushButtonDEM(bool flag)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, u8"选择DEM文件", "", u8"tif (*.tif);;All Files (*)");
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->lineEdit_DEM->setText(fileName);
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
|
||||
}
|
||||
}
|
||||
|
||||
void showQGF3StripBatchProcessDialog(QWidget* parent)
|
||||
{
|
||||
QGF3StripBatchProcessDialog* dialog = new QGF3StripBatchProcessDialog(parent);
|
||||
|
|
|
@ -24,7 +24,7 @@ public slots:
|
|||
void onpushButtonWorkSpaceClicked(bool);
|
||||
|
||||
void ontstateChanged(int checked);
|
||||
|
||||
void onpushButtonDEM(bool flag);
|
||||
|
||||
private:
|
||||
Ui::QGF3StripBatchProcessDialogClass* ui;
|
||||
|
|
|
@ -175,6 +175,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="checkoutPolarHH2VV">
|
||||
<property name="text">
|
||||
<string>极化转换:HH->VV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <iostream>
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
@ -27,7 +28,6 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
|||
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
QTextStream ts(&outFile);
|
||||
|
||||
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
|||
.arg(context.line)
|
||||
.arg(function);
|
||||
ts << logMessage << "\n";
|
||||
std::cout << logMessage.toLocal8Bit().constData() << std::endl;
|
||||
break;
|
||||
}
|
||||
case QtInfoMsg:
|
||||
|
@ -49,6 +50,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
|||
.arg(context.line)
|
||||
.arg(function);
|
||||
ts << logMessage << "\n";
|
||||
std::cout << logMessage.toLocal8Bit().constData() << std::endl;
|
||||
break;
|
||||
}
|
||||
case QtWarningMsg:
|
||||
|
@ -71,6 +73,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
|||
.arg(context.line)
|
||||
.arg(function);
|
||||
ts << logMessage << "\n";
|
||||
std::cout << logMessage.toLocal8Bit().constData() << std::endl;
|
||||
break;
|
||||
}
|
||||
case QtFatalMsg:
|
||||
|
@ -82,11 +85,11 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
|||
.arg(context.line)
|
||||
.arg(function);
|
||||
ts << logMessage << "\n";
|
||||
std::cout << logMessage.toLocal8Bit().constData() << std::endl;
|
||||
abort();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue