GF3批量化处理流程软件
parent
fe5c3f4149
commit
8d80a9ff6e
|
@ -112,6 +112,14 @@ enum POLARTYPEENUM { // 极化类型
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum SIGMATYPE {
|
||||||
|
DBVALUE,
|
||||||
|
AMPVALUE,
|
||||||
|
INTENSITYVALUE,
|
||||||
|
LINEARVALUE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*********************************************** 基础结构体区域 ********************************************************************/
|
/*********************************************** 基础结构体区域 ********************************************************************/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -357,4 +365,24 @@ inline void releaseVoidArray(void* a)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline double converSigma2amp(double inSig, SIGMATYPE sigtype) {
|
||||||
|
switch (sigtype)
|
||||||
|
{
|
||||||
|
case DBVALUE:
|
||||||
|
return pow(10, inSig / 20);
|
||||||
|
break;
|
||||||
|
case AMPVALUE:
|
||||||
|
return inSig;
|
||||||
|
break;
|
||||||
|
case INTENSITYVALUE:
|
||||||
|
return pow(10, inSig / 10);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return inSig;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -12,6 +12,9 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QFileInfoList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,3 +262,61 @@ bool copyAndReplaceFile(const QString& sourceFilePath, const QString& destina
|
||||||
qDebug() << "File copied successfully from" << sourceFilePath << "to" << destinationFilePath;
|
qDebug() << "File copied successfully from" << sourceFilePath << "to" << destinationFilePath;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
process.waitForFinished(); // 等待执行完成
|
||||||
|
// 获取输出
|
||||||
|
QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
|
||||||
|
QString error = QString::fromLocal8Bit(process.readAllStandardError());
|
||||||
|
qDebug() << "Output:" << output;
|
||||||
|
qDebug() << "Error:" << error;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist)
|
||||||
|
{
|
||||||
|
QDir outDir(inpath);
|
||||||
|
if (outDir.exists()) {
|
||||||
|
if (isremoveExist) {
|
||||||
|
outDir.removeRecursively();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QDir().mkpath(inpath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfoList findFilePath(const QString& strFilePath, const QString& strNameFilters)
|
||||||
|
{
|
||||||
|
QFileInfoList fileList;
|
||||||
|
if (strFilePath.isEmpty() || strNameFilters.isEmpty())
|
||||||
|
{
|
||||||
|
return fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir dir;
|
||||||
|
QStringList filters;
|
||||||
|
filters << strNameFilters;
|
||||||
|
dir.setPath(strFilePath);
|
||||||
|
dir.setNameFilters(filters);
|
||||||
|
QDirIterator iter(dir, QDirIterator::Subdirectories);
|
||||||
|
while (iter.hasNext())
|
||||||
|
{
|
||||||
|
iter.next();
|
||||||
|
QFileInfo info = iter.fileInfo();
|
||||||
|
if (info.isFile())
|
||||||
|
{
|
||||||
|
fileList.append(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileList;
|
||||||
|
}//blog.csdn.net/sinat_33419023/article/details/106105037
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileInfoList>
|
||||||
|
|
||||||
|
|
||||||
bool BASECONSTVARIABLEAPI isDirectory(const QString& path);
|
bool BASECONSTVARIABLEAPI isDirectory(const QString& path);
|
||||||
|
@ -54,5 +55,10 @@ QString BASECONSTVARIABLEAPI addMaskToFileName(const QString& filePath, QStrin
|
||||||
|
|
||||||
bool BASECONSTVARIABLEAPI copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath);
|
bool BASECONSTVARIABLEAPI copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath);
|
||||||
|
|
||||||
|
// 压缩包文件解压
|
||||||
|
bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath,QString outGzFolderPath);
|
||||||
|
bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist = false);
|
||||||
|
|
||||||
|
QFileInfoList BASECONSTVARIABLEAPI findFilePath(const QString& dirPath, const QString& pattern);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -89,6 +89,7 @@ enum ErrorCode {
|
||||||
IMAGE_L1DATA_XMLNAMEOPENERROR = 402,
|
IMAGE_L1DATA_XMLNAMEOPENERROR = 402,
|
||||||
IMAGE_L1DATA_XMLNAMEPARASEERROR = 403,
|
IMAGE_L1DATA_XMLNAMEPARASEERROR = 403,
|
||||||
|
|
||||||
|
METAXMLFOUNDERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ extern "C" BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg);
|
||||||
extern "C" BASECONSTVARIABLEAPI void PrintfToQDebug(const char* msg);
|
extern "C" BASECONSTVARIABLEAPI void PrintfToQDebug(const char* msg);
|
||||||
extern "C" BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg);
|
extern "C" BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg);
|
||||||
extern "C" BASECONSTVARIABLEAPI void printfinfo(const char* format, ...);
|
extern "C" BASECONSTVARIABLEAPI void printfinfo(const char* format, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // !PRINTMSGTOQDEBUG_H_
|
#endif // !PRINTMSGTOQDEBUG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -631,7 +631,6 @@ ErrorCode SARSimulationImageL1Dataset::saveImageRaster(std::shared_ptr<std::comp
|
||||||
omp_set_lock(&lock);
|
omp_set_lock(&lock);
|
||||||
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(this->ImageRasterPath, GDALAccess::GA_Update);
|
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(this->ImageRasterPath, GDALAccess::GA_Update);
|
||||||
|
|
||||||
|
|
||||||
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
|
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
|
||||||
GDALRasterBand* poBand = rasterDataset->GetRasterBand(1);
|
GDALRasterBand* poBand = rasterDataset->GetRasterBand(1);
|
||||||
if (NULL == poBand || nullptr == poBand) {
|
if (NULL == poBand || nullptr == poBand) {
|
||||||
|
@ -642,6 +641,7 @@ ErrorCode SARSimulationImageL1Dataset::saveImageRaster(std::shared_ptr<std::comp
|
||||||
return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR;
|
return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR;
|
||||||
}
|
}
|
||||||
else {}
|
else {}
|
||||||
|
|
||||||
long width = rasterDataset->GetRasterXSize();
|
long width = rasterDataset->GetRasterXSize();
|
||||||
long height = rasterDataset->GetRasterYSize();
|
long height = rasterDataset->GetRasterYSize();
|
||||||
long band_num = rasterDataset->GetRasterCount();
|
long band_num = rasterDataset->GetRasterCount();
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <qprogressdialog.h>
|
#include <qprogressdialog.h>
|
||||||
|
#include "BaseTool.h"
|
||||||
|
#include "GeoOperator.h"
|
||||||
|
#include "ImageOperatorBase.h"
|
||||||
|
#include "FileOperator.h"
|
||||||
|
#include "GF3Util.h"
|
||||||
|
#include "GF3CalibrationAndOrthLib.h"
|
||||||
|
|
||||||
ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst)
|
ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +404,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ±£´æ½á¹û
|
// ±£´æ½á¹û
|
||||||
omp_set_lock(&lock);
|
omp_set_lock(&lock);
|
||||||
rasterRC.saveImage(sar_r, startRId, 0, 1);
|
rasterRC.saveImage(sar_r, startRId, 0, 1);
|
||||||
|
@ -406,7 +412,6 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
|
||||||
|
|
||||||
omp_unset_lock(&lock);
|
omp_unset_lock(&lock);
|
||||||
|
|
||||||
|
|
||||||
Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181;
|
Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181;
|
||||||
if (localincAngleFlag) {
|
if (localincAngleFlag) {
|
||||||
Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1);
|
Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1);
|
||||||
|
@ -445,7 +450,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
|
||||||
R = std::sqrt(Rst_x*Rst_x+Rst_y*Rst_y+Rst_z*Rst_z);
|
R = std::sqrt(Rst_x*Rst_x+Rst_y*Rst_y+Rst_z*Rst_z);
|
||||||
slopeR = std::sqrt(slopex*slopex + slopey * slopey + slopez * slopez);
|
slopeR = std::sqrt(slopex*slopex + slopey * slopey + slopez * slopez);
|
||||||
localangle = ((slopex * Rst_x) + (slopey * Rst_y) + (slopez * Rst_z));
|
localangle = ((slopex * Rst_x) + (slopey * Rst_y) + (slopez * Rst_z));
|
||||||
localangle = std::acos(localangle / R/slopeR)*r2d;
|
localangle = std::acos(localangle / R/slopeR)*r2d; // 角度
|
||||||
Angle_Arr(i, j) = localangle;
|
Angle_Arr(i, j) = localangle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,9 +462,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
|
||||||
localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
|
localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
|
||||||
}
|
}
|
||||||
else {}
|
else {}
|
||||||
|
|
||||||
omp_unset_lock(&lock);
|
omp_unset_lock(&lock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -610,3 +613,134 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
|
||||||
}
|
}
|
||||||
return ErrorCode::SUCCESS;
|
return ErrorCode::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString outworkspacefolderpath, double pixelresultionDegreee, bool excutehh2vv)
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
// step 2.解压文件
|
||||||
|
QString unarchiverFolderPath = JoinPath(workfolderpath, u8"unarchiver");
|
||||||
|
createNewFolerPath(unarchiverFolderPath, true);
|
||||||
|
unTarfile(inTarFilepath, unarchiverFolderPath);
|
||||||
|
qDebug() << u8"step 2.解压文件 ok";
|
||||||
|
// 在解压文件夹中以及子文件夹查找meta.xml文件
|
||||||
|
QFileInfoList metalist = findFilePath(unarchiverFolderPath, u8"*.meta.xml");
|
||||||
|
if (metalist.count() !=1) {
|
||||||
|
qWarning() << u8"目标文件夹发现了多个meta.xml,不符合规则";
|
||||||
|
QMessageBox::warning(nullptr, u8"警告", QString(u8"%1:%2").arg(tarfilename).arg(u8"目标文件夹发现了多个meta.xml,不符合规则"));
|
||||||
|
return ErrorCode::METAXMLFOUNDERROR;
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
QString metaxmlpath = metalist[0].canonicalFilePath();
|
||||||
|
|
||||||
|
// step 3.文件转换为通用L1A文件
|
||||||
|
QString L1AFolder = JoinPath(workfolderpath, u8"L1AFolder");
|
||||||
|
createNewFolerPath(L1AFolder);
|
||||||
|
ImportGF3L1AProcess(metaxmlpath, L1AFolder);
|
||||||
|
qDebug() << u8"step 3.文件转换为通用L1A文件 ok";
|
||||||
|
|
||||||
|
// step 4. 幅度转amp
|
||||||
|
QFileInfoList xmlfilelist = findFilePath(L1AFolder, u8"*.xml");
|
||||||
|
if (xmlfilelist.count() == 0) {
|
||||||
|
qWarning() << u8"目标文件夹没有发现了L1A数据 xml,不符合规则";
|
||||||
|
QMessageBox::warning(nullptr, u8"警告", QString(u8"%1:%2").arg(tarfilename).arg(u8"目标文件夹没有发现了L1A数据 xml,不符合规则"));
|
||||||
|
return ErrorCode::METAXMLFOUNDERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString outampfolder = JoinPath(workfolderpath, u8"ampRaster");
|
||||||
|
createNewFolerPath(outampfolder);
|
||||||
|
for (long i = 0; i < xmlfilelist.count(); i++) {
|
||||||
|
|
||||||
|
QString filename = getFileNameWidthoutExtend(xmlfilelist[i].canonicalFilePath());
|
||||||
|
QString l2bfilename = filename + "_amp";
|
||||||
|
QString folderpath = getParantFromPath(xmlfilelist[i].canonicalFilePath());
|
||||||
|
SARSimulationImageL1Dataset slcl1(RasterLevel::RasterSLC);
|
||||||
|
slcl1.Open(folderpath, filename);
|
||||||
|
|
||||||
|
|
||||||
|
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
|
||||||
|
l1B.OpenOrNew(workfolderpath, l2bfilename, slcl1.getrowCount(), slcl1.getcolCount());
|
||||||
|
QString srcxmlpath = slcl1.getxmlFilePath();
|
||||||
|
QString tarxmlpath = l1B.getxmlFilePath();
|
||||||
|
copyAndReplaceFile(srcxmlpath, tarxmlpath);
|
||||||
|
l1B.loadFromXml();
|
||||||
|
QString imgfilepath = slcl1.getImageRasterPath();
|
||||||
|
Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath()); // 转振幅
|
||||||
|
}
|
||||||
|
|
||||||
|
// step 5. 创建正射查找表
|
||||||
|
QString L1AXmlPath = xmlfilelist[0].canonicalFilePath();
|
||||||
|
QString looktablefolderpath = JoinPath(workfolderpath, u8"looktableRaster");
|
||||||
|
if (GF3RDProcess(L1AXmlPath, inDEMPath, looktablefolderpath, pixelresultionDegreee, pixelresultionDegreee) == SUCCESS) {
|
||||||
|
qDebug()<<(u8"正射表生成成功");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << (u8"正射表生成失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << u8"step 4. 创建正射查找表 ok";
|
||||||
|
// step 6. 影像正射
|
||||||
|
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"目标文件夹发现了多个查找表,不符合规则"));
|
||||||
|
return ErrorCode::METAXMLFOUNDERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// step 6.1 影像入射角
|
||||||
|
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");
|
||||||
|
|
||||||
|
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 outstringpath = JoinPath(outworkpath, outname);
|
||||||
|
if (GF3OrthSLC(intempHH2VV, looktableRasterPath, outstringpath) == SUCCESS) {
|
||||||
|
qDebug() << (u8"正射生成成功");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << (u8"正射生成失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ErrorCode::SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -31,4 +31,10 @@ ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3OrthSLC( QString inRasterPath, QSt
|
||||||
// 正射处理流程
|
// 正射处理流程
|
||||||
ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy);
|
ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy);
|
||||||
|
|
||||||
|
|
||||||
|
// 正射+校正处理流程
|
||||||
|
ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString outworkspacefolderpath, double pixelresultionDegreee, bool excutehh2vv = false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -19,7 +19,7 @@
|
||||||
/// <param name="in_IncidencAngleRasterPath"></param>
|
/// <param name="in_IncidencAngleRasterPath"></param>
|
||||||
/// <param name="out_SigmaVVRasterPath"></param>
|
/// <param name="out_SigmaVVRasterPath"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath)
|
int GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath, SIGMATYPE sigmatype)
|
||||||
{
|
{
|
||||||
// step 1 检查输入合法性
|
// step 1 检查输入合法性
|
||||||
{
|
{
|
||||||
|
@ -77,8 +77,10 @@ int GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRast
|
||||||
for (int64_t i = 0; i < pixel_count64; i++)
|
for (int64_t i = 0; i < pixel_count64; i++)
|
||||||
{
|
{
|
||||||
double sigmaHH = sigmaHHRasterData.get()[i];
|
double sigmaHH = sigmaHHRasterData.get()[i];
|
||||||
double incidenceAngle = incidenceAngleData.get()[i];
|
sigmaHH = converSigma2amp(sigmaHH,sigmatype);
|
||||||
double sigmaVV = sigmaHH * polartionConver_d(sigmaHH, incidenceAngle, 1.0, false);
|
double incidenceAngle = incidenceAngleData.get()[i];// ½Ç¶È
|
||||||
|
sigmaHH = 20 * log10(sigmaHH);
|
||||||
|
double sigmaVV = polartionConver_d(sigmaHH, incidenceAngle, 1.0, false); // Êä³ödBÖµ
|
||||||
outSigmaVVRasterData.get()[i] = sigmaVV;
|
outSigmaVVRasterData.get()[i] = sigmaVV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#define __GF3CALIBRATIONANDORTHLIB__H__
|
#define __GF3CALIBRATIONANDORTHLIB__H__
|
||||||
#include "gf3calibrationandorthlib_global.h"
|
#include "gf3calibrationandorthlib_global.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "BaseConstVariable.h"
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,10 +23,7 @@
|
||||||
/// <param name="out_SigmaVVRasterPath"></param>
|
/// <param name="out_SigmaVVRasterPath"></param>
|
||||||
/// <param name="isVVPolar"></param>
|
/// <param name="isVVPolar"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int GF3CALIBRATIONANDORTHLIB_EXPORT GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath,QString in_IncidencAngleRasterPath,QString out_SigmaVVRasterPath);
|
int GF3CALIBRATIONANDORTHLIB_EXPORT GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath, SIGMATYPE sigmatype= SIGMATYPE::AMPVALUE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,14 @@ __host__ __device__ float polartionConver_f(float insig, float inangle, float al
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPUComputePolarizationConver_f(float* insig, float* inangle, float* alpha, bool isvv, int count, float* outsig)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPUComputePolarizationConver_d(double* insig, double* inangle, double* alpha, bool isvv, int count, double* outsig)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
__host__ __device__ double polartionConver_d(double insig, double inangle, double alpha , bool isvv )
|
__host__ __device__ double polartionConver_d(double insig, double inangle, double alpha , bool isvv )
|
||||||
{
|
{
|
||||||
|
@ -78,8 +86,8 @@ __host__ __device__ double polartionConver_d(double insig, double inangle, doubl
|
||||||
double osig = 0.0;
|
double osig = 0.0;
|
||||||
if (isvv) { // C: VV->HH
|
if (isvv) { // C: VV->HH
|
||||||
osig = insig_linear * rpol;
|
osig = insig_linear * rpol;
|
||||||
// 返回线性值
|
// ·µ»ØdBÖµ
|
||||||
return osig;
|
return 10.0 * log10(osig);
|
||||||
} else { // L: HH->VV
|
} else { // L: HH->VV
|
||||||
osig = insig_linear / rpol;
|
osig = insig_linear / rpol;
|
||||||
// ·µ»ØdBÖµ
|
// ·µ»ØdBÖµ
|
||||||
|
|
|
@ -1 +1,84 @@
|
||||||
#include "GF3Util.h"
|
#include "GF3Util.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
GF3TargzFilenameClass getFilename(QString filename)
|
||||||
|
{
|
||||||
|
return GF3TargzFilenameClass(filename);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GF3TargzFilenameClass::GF3TargzFilenameClass(QString filename)
|
||||||
|
{
|
||||||
|
// GF3_KAS_FSI_020253_E110.8_N25.5_20200614_L1A_HHHV_L10004871459.tar.gz
|
||||||
|
QStringList filelist = filename.split("_");
|
||||||
|
|
||||||
|
this->sateName = filelist[0];
|
||||||
|
this->RevStateName = filelist[1];
|
||||||
|
this->ImageMode = filelist[2];
|
||||||
|
this->OribtName = filelist[3];
|
||||||
|
this->CenterLon = filelist[4].left(1).toDouble();
|
||||||
|
this->CenterLat = filelist[5].left(1).toDouble();
|
||||||
|
this->DateName = filelist[6];
|
||||||
|
this->levelName = filelist[7];
|
||||||
|
this->PolarName = filelist[8];
|
||||||
|
this->ProductName = filelist[9];
|
||||||
|
if (this->ProductName.contains(".")) {
|
||||||
|
this->ProductName = this->ProductName.split(".")[0];
|
||||||
|
}else{}
|
||||||
|
}
|
||||||
|
|
||||||
|
GF3TargzFilenameClass::~GF3TargzFilenameClass()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getSateName() const
|
||||||
|
{
|
||||||
|
return sateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getRevStateName() const
|
||||||
|
{
|
||||||
|
return RevStateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getImageMode() const
|
||||||
|
{
|
||||||
|
return ImageMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getOribtName() const
|
||||||
|
{
|
||||||
|
return OribtName;
|
||||||
|
}
|
||||||
|
|
||||||
|
double GF3TargzFilenameClass::getCenterLon() const
|
||||||
|
{
|
||||||
|
return CenterLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
double GF3TargzFilenameClass::getCenterLat() const
|
||||||
|
{
|
||||||
|
return CenterLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getDateName() const
|
||||||
|
{
|
||||||
|
return DateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getLevelName() const
|
||||||
|
{
|
||||||
|
return levelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getPolarName() const
|
||||||
|
{
|
||||||
|
return PolarName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GF3TargzFilenameClass::getProductName() const
|
||||||
|
{
|
||||||
|
return ProductName;
|
||||||
|
}
|
||||||
|
|
|
@ -2,10 +2,44 @@
|
||||||
#ifndef __GF3UTIL_H__
|
#ifndef __GF3UTIL_H__
|
||||||
#define __GF3UTIL_H__
|
#define __GF3UTIL_H__
|
||||||
#include "gf3calibrationandorthlib_global.h"
|
#include "gf3calibrationandorthlib_global.h"
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class GF3CALIBRATIONANDORTHLIB_EXPORT GF3TargzFilenameClass {
|
||||||
|
// GF3_KAS_FSI_020253_E110.8_N25.5_20200614_L1A_HHHV_L10004871459.tar.gz
|
||||||
|
|
||||||
|
public:
|
||||||
|
GF3TargzFilenameClass(QString filename);
|
||||||
|
~GF3TargzFilenameClass();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString sateName;
|
||||||
|
QString RevStateName;
|
||||||
|
QString ImageMode;
|
||||||
|
QString OribtName;
|
||||||
|
double CenterLon;
|
||||||
|
double CenterLat;
|
||||||
|
QString DateName;
|
||||||
|
QString levelName;
|
||||||
|
QString PolarName;
|
||||||
|
QString ProductName;
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString getSateName() const; //{ return sateName; }
|
||||||
|
QString getRevStateName() const;// { return RevStateName; }
|
||||||
|
QString getImageMode() const; //{ return ImageMode; }
|
||||||
|
QString getOribtName() const; //{ return OribtName; }
|
||||||
|
double getCenterLon() const; //{ return CenterLon; }
|
||||||
|
double getCenterLat() const; //{ return CenterLat; }
|
||||||
|
QString getDateName() const; //{ return DateName; }
|
||||||
|
QString getLevelName() const; //{ return levelName; }
|
||||||
|
QString getPolarName() const;// { return PolarName; }
|
||||||
|
QString getProductName() const; //{ return ProductName; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GF3TargzFilenameClass GF3CALIBRATIONANDORTHLIB_EXPORT getFilename(QString filename);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,15 @@
|
||||||
<CopyLocalProjectReference>true</CopyLocalProjectReference>
|
<CopyLocalProjectReference>true</CopyLocalProjectReference>
|
||||||
<CopyLocalDebugSymbols>true</CopyLocalDebugSymbols>
|
<CopyLocalDebugSymbols>true</CopyLocalDebugSymbols>
|
||||||
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
|
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
|
||||||
|
<IncludePath>..\GF3CalibrationAndOrthLib;..\GPUBaseLib;..\BaseCommonLibrary\ToolAbstract;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary;.;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -110,6 +114,17 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="QGF3StripBatchProcessDialog.ui" />
|
<QtUic Include="QGF3StripBatchProcessDialog.ui" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
|
||||||
|
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\GF3CalibrationAndOrthLib\GF3CalibrationAndOrthLib.vcxproj">
|
||||||
|
<Project>{886f7829-af74-4f23-b3be-29b7b3c9843c}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
|
||||||
|
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#include "QGF3StripBatchProcessDialog.h"
|
#include "QGF3StripBatchProcessDialog.h"
|
||||||
#include "ui_QGF3StripBatchProcessDialog.h"
|
#include "ui_QGF3StripBatchProcessDialog.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include "FileOperator.h"
|
||||||
|
#include "GeoOperator.h"
|
||||||
|
#include "BaseTool.h"
|
||||||
|
#include "GF3CalibrationAndGeocodingClass.h"
|
||||||
|
|
||||||
QGF3StripBatchProcessDialog::QGF3StripBatchProcessDialog(QWidget *parent)
|
QGF3StripBatchProcessDialog::QGF3StripBatchProcessDialog(QWidget *parent)
|
||||||
: QDialog(parent), ui(new Ui::QGF3StripBatchProcessDialogClass)
|
: QDialog(parent), ui(new Ui::QGF3StripBatchProcessDialogClass)
|
||||||
|
@ -24,7 +29,32 @@ QGF3StripBatchProcessDialog::~QGF3StripBatchProcessDialog()
|
||||||
|
|
||||||
void QGF3StripBatchProcessDialog::onaccept()
|
void QGF3StripBatchProcessDialog::onaccept()
|
||||||
{
|
{
|
||||||
|
QString demPath = "";
|
||||||
|
// 获取默认DEM数据
|
||||||
|
if (ui->checkBoxDEM->isChecked()) {
|
||||||
|
QString demdirPath = QApplication::applicationDirPath();// DEM所在文件夹
|
||||||
|
demPath = JoinPath(demdirPath,"SRTM_90m_DEM_V4.tif");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
demPath = ui->lineEdit_DEM->text();
|
||||||
|
}
|
||||||
|
// 获取分辨率
|
||||||
|
double resolutionMeter = ui->doubleSpinBox->value();// 分辨率转度
|
||||||
|
double resoiutionDegree = getPixelSpacingInDegree(resolutionMeter);// 米 -> 度
|
||||||
|
QString workspacedirpath = ui->lineEditWorkDir->text();
|
||||||
|
this->ui->progressBar->setValue(0);
|
||||||
|
this->ui->progressBar->setMaximum(ui->listWidgetMetaxml->count());
|
||||||
|
for (long i = 0; i < ui->listWidgetMetaxml->count(); i++) {
|
||||||
|
QString inTargzFilePath = ui->listWidgetMetaxml->item(i)->text();
|
||||||
|
|
||||||
|
GF3MainOrthProcess(demPath,
|
||||||
|
inTargzFilePath,
|
||||||
|
workspacedirpath,
|
||||||
|
resoiutionDegree,
|
||||||
|
true);
|
||||||
|
|
||||||
|
this->ui->progressBar->setValue(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGF3StripBatchProcessDialog::onreject()
|
void QGF3StripBatchProcessDialog::onreject()
|
||||||
|
|
|
@ -224,12 +224,30 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QLabel" name="label_info">
|
||||||
<property name="standardButtons">
|
<property name="text">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="value">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|
|
@ -9,11 +9,91 @@
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include "QGF3StripBatchProcessDialog.h"
|
#include "QGF3StripBatchProcessDialog.h"
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
|
// ×Ô¶¨ÒåÏûÏ¢´¦ÀíÆ÷º¯Êý
|
||||||
|
void customMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||||
|
{
|
||||||
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
|
const char* file = context.file ? context.file : "";
|
||||||
|
const char* function = context.function ? context.function : "";
|
||||||
|
QString dateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
|
||||||
|
QFile outFile("application.log");
|
||||||
|
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||||
|
QTextStream ts(&outFile);
|
||||||
|
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case QtDebugMsg:
|
||||||
|
{
|
||||||
|
QString logMessage = QString("%1 Debug: %2 (%3:%4, %5)")
|
||||||
|
.arg(dateTime) // Assuming dateTime is a QDateTime object and needs to be converted to string
|
||||||
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
|
.arg(file)
|
||||||
|
.arg(context.line)
|
||||||
|
.arg(function);
|
||||||
|
ts << logMessage << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QtInfoMsg:
|
||||||
|
{
|
||||||
|
QString logMessage = QString("%1 Info: %2 (%3:%4, %5)")
|
||||||
|
.arg(dateTime)
|
||||||
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
|
.arg(file)
|
||||||
|
.arg(context.line)
|
||||||
|
.arg(function);
|
||||||
|
ts << logMessage << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QtWarningMsg:
|
||||||
|
{
|
||||||
|
QString logMessage = QString("%1 Warning: %2 (%3:%4, %5)")
|
||||||
|
.arg(dateTime)
|
||||||
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
|
.arg(file)
|
||||||
|
.arg(context.line)
|
||||||
|
.arg(function);
|
||||||
|
ts << logMessage << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QtCriticalMsg:
|
||||||
|
{
|
||||||
|
QString logMessage = QString("%1 Critical: %2 (%3:%4, %5)")
|
||||||
|
.arg(dateTime)
|
||||||
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
|
.arg(file)
|
||||||
|
.arg(context.line)
|
||||||
|
.arg(function);
|
||||||
|
ts << logMessage << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QtFatalMsg:
|
||||||
|
{
|
||||||
|
QString logMessage = QString("%1 Fatal: %2 (%3:%4, %5)")
|
||||||
|
.arg(dateTime)
|
||||||
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
|
.arg(file)
|
||||||
|
.arg(context.line)
|
||||||
|
.arg(function);
|
||||||
|
ts << logMessage << "\n";
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
qInstallMessageHandler(customMessageHandler);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
showQGF3StripBatchProcessDialog(nullptr);
|
showQGF3StripBatchProcessDialog(nullptr);
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
Loading…
Reference in New Issue