diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj b/BaseCommonLibrary/BaseCommonLibrary.vcxproj index d7c78f9..002db1e 100644 --- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj +++ b/BaseCommonLibrary/BaseCommonLibrary.vcxproj @@ -220,11 +220,13 @@ pch.h true true - NotSet + NoExtensions true stdcpp14 stdc11 true + false + MaxSpeed Windows diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h index f16210d..67114db 100644 --- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h +++ b/BaseCommonLibrary/BaseTool/BaseConstVariable.h @@ -15,6 +15,9 @@ +/** 定义常见文件格式*********/ +#define ENVI_FILE_FORMAT_FILTER u8"ALL File(*.*);;ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)" +#define XML_FILE_FORMAT_FILTER u8"ALL File(*.*);;XML File(*.xml);;tiff影像(*.tiff)" // @@ -136,6 +139,14 @@ struct Point3 { void setZ(double iz) { z = iz; } }; +struct Point_3d { + double x; + double y; + double z; +}; + + + struct DemBox { double min_lon; double max_lon; @@ -154,7 +165,7 @@ struct Vector3_single { /*********************************************** FEKO仿真参数 ********************************************************************/ -struct SatellitePos { +extern "C" struct SatellitePos { double time; double Px ; double Py ; @@ -165,7 +176,7 @@ struct SatellitePos { }; -struct SatelliteAntPos { +extern "C" struct SatelliteAntPos { double time; // 0 double Px; double Py; @@ -188,7 +199,7 @@ struct SatelliteAntPos { }; -struct PatternImageDesc { +extern "C" struct PatternImageDesc { long phinum; long thetanum; double startTheta; diff --git a/BaseCommonLibrary/BaseTool/BaseTool.cpp b/BaseCommonLibrary/BaseTool/BaseTool.cpp index 64d6252..5ea4ed0 100644 --- a/BaseCommonLibrary/BaseTool/BaseTool.cpp +++ b/BaseCommonLibrary/BaseTool/BaseTool.cpp @@ -38,7 +38,10 @@ #include // 包含SSE指令集头文件 #include // 包含SSE2指令集头文件 #include // 包含OpenMP头文件 - +#include +#include +#include +#include QString longDoubleToQStringScientific(long double value) { std::ostringstream stream; @@ -702,3 +705,71 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0) } + +QDateTime parseCustomDateTime(const QString& dateTimeStr) { + // 手动解析日期时间字符串 + int year = dateTimeStr.left(4).toInt(); + int month = dateTimeStr.mid(5, 2).toInt(); + int day = dateTimeStr.mid(8, 2).toInt(); + int hour = dateTimeStr.mid(11, 2).toInt(); + int minute = dateTimeStr.mid(14, 2).toInt(); + int second = dateTimeStr.mid(17, 2).toInt(); + int msec = dateTimeStr.mid(20, 6).toInt(); // 只取毫秒的前三位,因为QDateTime支持到毫秒 + + // 创建 QDate 和 QTime 对象 + QDate date(year, month, day); + QTime time(hour, minute, second, msec ); // 转换为微秒,但QTime只支持毫秒精度 + + // 构造 QDateTime 对象 + QDateTime result(date, time); + + return result; +} + + +bool isLeapYear(int year) { + return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); +} + +int daysInMonth(int year, int month) { + if (month == 2) return isLeapYear(year) ? 29 : 28; + else if (month == 4 || month == 6 || month == 9 || month == 11) return 30; + else return 31; +} + + +TimestampMicroseconds parseAndConvert( std::string dateTimeStr) { + // 解析年、月、日、时、分、秒和微秒 + int year = std::stoi(dateTimeStr.substr(0, 4)); + int month = std::stoi(dateTimeStr.substr(5, 2)); + int day = std::stoi(dateTimeStr.substr(8, 2)); + int hour = std::stoi(dateTimeStr.substr(11, 2)); + int minute = std::stoi(dateTimeStr.substr(14, 2)); + int second = std::stoi(dateTimeStr.substr(17, 2)); + int microsec = std::stoi(dateTimeStr.substr(20, 6)); + + // 计算从1970年至目标年份前一年的总天数 + long long totalDays = 0; + for (int y = 1970; y < year; ++y) { + totalDays += isLeapYear(y) ? 366 : 365; + } + + // 加上目标年份从1月到上一个月的天数 + for (int m = 1; m < month; ++m) { + totalDays += daysInMonth(year, m); + } + + // 加上本月的天数 + totalDays += day - 1; + + // 转换为总秒数,再加上小时、分钟、秒 + long long totalSeconds = totalDays * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second; + + // 转换为毫秒和微秒 + long long msecsSinceEpoch = totalSeconds * 1000 + microsec / 1000; + int microseconds = microsec % 1000; + + return { msecsSinceEpoch, microseconds }; +} + + diff --git a/BaseCommonLibrary/BaseTool/BaseTool.h b/BaseCommonLibrary/BaseTool/BaseTool.h index 9bc6296..6ad57ff 100644 --- a/BaseCommonLibrary/BaseTool/BaseTool.h +++ b/BaseCommonLibrary/BaseTool/BaseTool.h @@ -31,7 +31,8 @@ #include #include #include - +#include +#include ///////////////////////////////////// 基础数学函数 ///////////////////////////////////////////////////////////// @@ -101,7 +102,7 @@ Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr); - +QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr); /// /// list 应该是按照从小到大的顺序排好 /// @@ -132,6 +133,19 @@ void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowc Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg); Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0); + +struct TimestampMicroseconds { + boost::int64_t msecsSinceEpoch; // 自1970-01-01T00:00:00 UTC以来的毫秒数 + int microseconds; // 额外的微秒(精确到微秒) +}; + + +bool BASECONSTVARIABLEAPI isLeapYear(int year); +int BASECONSTVARIABLEAPI daysInMonth(int year, int month); + +TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr); + + /** 模板函数类 ***********************************************************************************************************/ inline double calculate_MuhlemanSigma(double eta_deg) { diff --git a/BaseCommonLibrary/BaseTool/FileOperator.cpp b/BaseCommonLibrary/BaseTool/FileOperator.cpp index d2b1343..6d6ba6c 100644 --- a/BaseCommonLibrary/BaseTool/FileOperator.cpp +++ b/BaseCommonLibrary/BaseTool/FileOperator.cpp @@ -93,7 +93,8 @@ QString getFileNameFromPath(const QString& path) QString getFileNameWidthoutExtend(QString path) { QFileInfo fileInfo(path); - QString fileNameWithoutExtension = fileInfo.baseName(); // 获取无后缀文件名 + QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 获取无后缀文件名 + qDebug() << u8"File name without extension: " << fileNameWithoutExtension; return fileNameWithoutExtension; } diff --git a/BaseCommonLibrary/BaseTool/FileOperator.h b/BaseCommonLibrary/BaseTool/FileOperator.h index 72d542a..b016ede 100644 --- a/BaseCommonLibrary/BaseTool/FileOperator.h +++ b/BaseCommonLibrary/BaseTool/FileOperator.h @@ -16,7 +16,7 @@ #include #include #include - + bool BASECONSTVARIABLEAPI isDirectory(const QString& path); bool BASECONSTVARIABLEAPI isExists(const QString& path); @@ -29,7 +29,7 @@ unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input); /// /// /// -std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr); +std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr); QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path); @@ -41,11 +41,11 @@ QString BASECONSTVARIABLEAPI getFileExtension(QString path); int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len); -char* read_textfile(char* text_path, int* length); +char* read_textfile(char* text_path, int* length); -bool BASECONSTVARIABLEAPI exists_test(const QString& name); +bool BASECONSTVARIABLEAPI exists_test(const QString& name); -size_t BASECONSTVARIABLEAPI fsize(FILE* fp); +size_t BASECONSTVARIABLEAPI fsize(FILE* fp); QString BASECONSTVARIABLEAPI getParantFromPath(const QString& path); void BASECONSTVARIABLEAPI copyFile(const QString& sourcePath, const QString& destinationPath); diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp index 9784c3a..ce49a3e 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp +++ b/BaseCommonLibrary/BaseTool/GeoOperator.cpp @@ -18,7 +18,9 @@ #include #include #include "GeoOperator.h" - +#include // OGRSpatialReference ڿռοת +#include // GDALWarp +#include Landpoint operator +(const Landpoint& p1, const Landpoint& p2) @@ -135,6 +137,44 @@ Landpoint XYZ2LLA(const Landpoint& XYZ) { +void XYZ2BLH_FixedHeight(double x, double y, double z,double ati, Landpoint& point) { + const double a = 6378137.0; // WGS84 + const double f = 1.0 / 298.257223563; + const double e2 = 2 * f - f * f; // һƫƽ + + // 㾭L () + const double L_rad = std::atan2(y, x); + point.lon = L_rad * 180.0 / M_PI; // תΪ + + const double p = std::sqrt(x * x + y * y); + const double H = ati; // ʹ֪߶ + + // ʼγȹ㣨֪߶H + double B_rad = std::atan2(z, p * (1 - e2 * (a / (a + H)))); + + // γB̶H + for (int i = 0; i < 10; ++i) { // ֪Hʱ + const double sin_B = std::sin(B_rad); + const double N = a / std::sqrt(1 - e2 * sin_B * sin_B); + const double delta = e2 * N / (N + H); // ߶ȹ̶ʱ + + const double B_new = std::atan2(z, p * (1 - delta)); + + if (std::abs(B_new - B_rad) < 1e-9) { + B_rad = B_new; + break; + } + B_rad = B_new; + } + + point.lat = B_rad * 180.0 / M_PI; // ת + + // ȷΧ [-180, 180] + point.lon = std::fmod(point.lon + 360.0, 360.0); + if (point.lon > 180.0) point.lon -= 360.0; + point.ati = ati; +} + double getAngle(const Landpoint& a, const Landpoint& b) { @@ -408,3 +448,53 @@ double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slop return angle; } } + +bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(int sourceEPSG, double resolutionMeters, double refLon, double refLat, double& degreePerPixelX, double& degreePerPixelY){ + // ʼԴϵƽͶӰĿϵWGS84 γȣ + OGRSpatialReference sourceSRS, targetSRS; + sourceSRS.importFromEPSG(sourceEPSG); // Դϵȷ EPSG + targetSRS.importFromEPSG(4326); // ĿΪ WGS84 γ + + // תγ -> ƽ + OGRCoordinateTransformation* toPlane = OGRCreateCoordinateTransformation(&targetSRS, &sourceSRS); + if (!toPlane) return false; + + // ο㾭γתΪƽ + double x = refLon, y = refLat; + if (!toPlane->Transform(1, &x, &y)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + return false; + } + + // תƽ -> γ + OGRCoordinateTransformation* toGeo = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); + if (!toGeo) { + OGRCoordinateTransformation::DestroyCT(toPlane); + return false; + } + + // 㶫ֱʣȱ仯 + double eastX = x + resolutionMeters, eastY = y; + double eastLon = eastX, eastLat = eastY; + if (!toGeo->Transform(1, &eastLon, &eastLat)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return false; + } + degreePerPixelX = (eastLon - refLon) / resolutionMeters; // ȷÿ׶Ӧ + + // 㱱ֱʣγȱ仯 + double northX = x, northY = y + resolutionMeters; + double northLon = northX, northLat = northY; + if (!toGeo->Transform(1, &northLon, &northLat)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return false; + } + degreePerPixelY = (northLat - refLat) / resolutionMeters; // γȷÿ׶Ӧ + + // ͷԴ + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return true; +} diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h index 6d4eb8a..66ce525 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.h +++ b/BaseCommonLibrary/BaseTool/GeoOperator.h @@ -30,6 +30,7 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint); /// 经纬度--degree Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ); +void BASECONSTVARIABLEAPI XYZ2BLH_FixedHeight(double x, double y, double z, double ati, Landpoint& point); Landpoint BASECONSTVARIABLEAPI operator +(const Landpoint& p1, const Landpoint& p2); @@ -123,4 +124,24 @@ CartesianCoordinates BASECONSTVARIABLEAPI sphericalToCartesian(const Spheric double BASECONSTVARIABLEAPI getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector); + +/** + * @brief 将平面坐标分辨率(米)转换为经纬度分辨率(度) + * @param sourceEPSG 平面坐标系 EPSG 码(如 UTM Zone 50N 对应 32650) + * @param resolutionMeters 输入分辨率(单位:米) + * @param refLon 参考点经度(十进制度,用于计算局部转换系数) + * @param refLat 参考点纬度(十进制度,用于计算局部转换系数) + * @param[out] degreePerPixelX 经度方向分辨率(度/像素) + * @param[out] degreePerPixelY 纬度方向分辨率(度/像素) + * @return 是否转换成功 + */ +bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees( + int sourceEPSG, + double resolutionMeters, + double refLon, + double refLat, + double& degreePerPixelX, + double& degreePerPixelY +); + #endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 060df9a..b16127d 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -89,7 +89,7 @@ enum GDALREADARRCOPYMETHOD { /// \param long 经度 /// \param lat 纬度 /// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误 -long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState); +long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState= ProjectStripDelta::Strip_6); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); @@ -135,10 +135,10 @@ GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah); struct RasterExtend { - double min_x; //纬度 - double min_y;//经度 - double max_x;//纬度 - double max_y;//经度 + double min_x; + double min_y; + double max_x; + double max_y; }; @@ -174,8 +174,6 @@ public: // 方法 virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); - - virtual void saveImage(); virtual void setNoDataValue(double nodatavalue, int band_ids); virtual void setNoDataValuei(int nodatavalue, int band_ids); @@ -197,6 +195,10 @@ public: // 方法 virtual RasterExtend getExtend(); + + + + public: QString img_path; // 图像文件 int height; // 高 @@ -236,6 +238,10 @@ public: Eigen::MatrixXcd data; }; + +bool BASECONSTVARIABLEAPI CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath); + + // 创建影像 gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); gdalImage BASECONSTVARIABLEAPI CreategdalImageFloat(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); @@ -310,6 +316,24 @@ void BASECONSTVARIABLEAPI testOutDataArr(QString filename, long* data, long row void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRasterPath, QString LookTableRasterPath, QString SARIntensityPath, long min_rid, long max_rid, long min_cid, long max_cid, std::function processBarShow = {}); +bool BASECONSTVARIABLEAPI ConvertVrtToEnvi(QString vrtPath, QString outPath); + + + + +void BASECONSTVARIABLEAPI MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol); +ErrorCode BASECONSTVARIABLEAPI Complex2PhaseRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI Complex2dBRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath); + + +ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); + + +void BASECONSTVARIABLEAPI CloseAllGDALRaster(); + + //--------------------- 图像文件读写 ------------------------------ diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp index 32711fb..5debe6f 100644 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp +++ b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp @@ -15,6 +15,8 @@ #include #include #include +#include "SARSimulationImageL1.h" +#include namespace RasterToolBase { long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) @@ -268,4 +270,7 @@ namespace RasterToolBase { return CoordinateSystemType::UNKNOW; } } -} // namespace RasterToolBase \ No newline at end of file +}; // namespace RasterToolBase + + + diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.h b/BaseCommonLibrary/BaseTool/RasterToolBase.h index bc6842f..254d4bb 100644 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.h +++ b/BaseCommonLibrary/BaseTool/RasterToolBase.h @@ -12,40 +12,42 @@ #include "BaseConstVariable.h" #include "gdal_priv.h" #include +#include "LogInfoCls.h" + namespace RasterToolBase { - static bool GDALAllRegisterEnable=false; + static bool GDALAllRegisterEnable = false; - enum ProjectStripDelta{ + enum ProjectStripDelta { Strip_6, // 6度带 Strip_3 }; - enum CoordinateSystemType{ // 坐标系类型 + enum CoordinateSystemType { // 坐标系类型 GeoCoordinateSystem, ProjectCoordinateSystem, UNKNOW }; - struct PointRaster{ // 影像坐标点 + struct PointRaster { // 影像坐标点 double x; double y; double z; }; - struct PointXYZ{ - double x,y,z; + struct PointXYZ { + double x, y, z; }; - struct PointGeo{ - double lon,lat,ati; + struct PointGeo { + double lon, lat, ati; }; - struct PointImage{ - double pixel_x,pixel_y; + struct PointImage { + double pixel_x, pixel_y; }; /// 根据经纬度获取 @@ -56,14 +58,14 @@ namespace RasterToolBase { /// \param lat 纬度 /// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误 long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, - ProjectStripDelta stripState = ProjectStripDelta::Strip_3); + ProjectStripDelta stripState = ProjectStripDelta::Strip_3); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat); - QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode) ; + QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode); long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath); @@ -72,9 +74,23 @@ namespace RasterToolBase { CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE); +};// namespace RasterProjectConvertor + + + + +// 遥感类常用数据 + + + + + + + + + -} // namespace RasterProjectConvertor #endif // LAMPCAE_RASTERTOOLBASE_H diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp index 16134d2..2fbfbb8 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp @@ -106,7 +106,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam this->saveToXml(); } - if (this->Rasterlevel!=RasterL2||QFile(this->GPSPointFilePath).exists() == false) { + if (this->Rasterlevel==RasterL2||QFile(this->GPSPointFilePath).exists() == false) { // ļ omp_lock_t lock; omp_init_lock(&lock); @@ -122,7 +122,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam omp_destroy_lock(&lock); } - if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { + else if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { // ļ omp_lock_t lock; @@ -140,7 +140,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam } - if (this->Rasterlevel != RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { + else if (this->Rasterlevel == RasterLevel::RasterL1B || QFile(this->ImageRasterPath).exists() == false) { // ļ omp_lock_t lock; @@ -150,11 +150,11 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL)); + std::shared_ptr poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL)); GDALFlushCache((GDALDatasetH)poDstDS.get()); poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // + omp_unset_lock(&lock); + omp_destroy_lock(&lock); } @@ -203,7 +203,7 @@ ErrorCode SARSimulationImageL1Dataset::Open(QString xmlPath) QFileInfo fileInfo(xmlPath); QString fileName = fileInfo.fileName(); // ȡļ QString fileSuffix = fileInfo.suffix(); // ȡ׺ - QString fileNameWithoutSuffix = fileInfo.baseName(); // ȡ׺ļ + QString fileNameWithoutSuffix = fileInfo.completeBaseName(); // ȡ׺ļ QString directoryPath = fileInfo.path(); // ȡļ· if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") { return this->Open(directoryPath, fileNameWithoutSuffix); @@ -246,12 +246,13 @@ void SARSimulationImageL1Dataset::saveToXml() xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount)); xmlWriter.writeTextElement("ColCount", QString::number(this->colCount)); - xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear)); - xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar)); - xmlWriter.writeTextElement("Rref", QString::number(this->Rref)); - xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq)); - xmlWriter.writeTextElement("Fs", QString::number(this->Fs)); - xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle)); + xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear, 'e', 18)); + xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar, 'e', 18)); + xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18)); + xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18)); + xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18)); + xmlWriter.writeTextElement("PRF", QString::number(this->prf, 'e', 18)); + xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18)); xmlWriter.writeTextElement("LookSide", this->LookSide); // sateantpos @@ -259,60 +260,60 @@ void SARSimulationImageL1Dataset::saveToXml() for (long i = 0; i < this->sateposes.count(); i++) { xmlWriter.writeStartElement("AntPosParam"); - xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time)); // time - xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px)); // Px - xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py)); // Py - xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz)); // Pz - xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx)); // Vx - xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy)); // Vy - xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz)); // Vz - xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX)); // AntDirectX - xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY)); // AntDirectY - xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ)); // AntDirectZ - xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx)); // AVx - xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy)); // AVy - xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz)); // AVz - xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon)); // lon - xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat)); // lat - xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati)); // ati + xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time, 'e', 18)); // time + xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px, 'e', 18)); // Px + xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py, 'e', 18)); // Py + xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz, 'e', 18)); // Pz + xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx, 'e', 18)); // Vx + xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy, 'e', 18)); // Vy + xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz, 'e', 18)); // Vz + xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX, 'e', 18)); // AntDirectX + xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY, 'e', 18)); // AntDirectY + xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ, 'e', 18)); // AntDirectZ + xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx, 'e', 18)); // AVx + xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy, 'e', 18)); // AVy + xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz, 'e', 18)); // AVz + xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon, 'e', 18)); // lon + xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat, 'e', 18)); // lat + xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati, 'e', 18)); // ati xmlWriter.writeEndElement(); // } - xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime)); - xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime)); + xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime, 'e', 18)); + xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime, 'e', 18)); - xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange)); - xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange)); - xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth)); - xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime)); + xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange, 'e', 18)); + xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange, 'e', 18)); + xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth, 'e', 18)); + xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime, 'e', 18)); xmlWriter.writeStartElement("DopplerCentroidCoefficients"); - xmlWriter.writeTextElement("d0", QString::number(this->d0)); - xmlWriter.writeTextElement("d1", QString::number(this->d1)); - xmlWriter.writeTextElement("d2", QString::number(this->d2)); - xmlWriter.writeTextElement("d3", QString::number(this->d3)); - xmlWriter.writeTextElement("d4", QString::number(this->d4)); + xmlWriter.writeTextElement("d0", QString::number(this->d0, 'e', 18)); + xmlWriter.writeTextElement("d1", QString::number(this->d1, 'e', 18)); + xmlWriter.writeTextElement("d2", QString::number(this->d2, 'e', 18)); + xmlWriter.writeTextElement("d3", QString::number(this->d3, 'e', 18)); + xmlWriter.writeTextElement("d4", QString::number(this->d4, 'e', 18)); xmlWriter.writeEndElement(); // DopplerCentroidCoefficients xmlWriter.writeStartElement("DopplerRateValuesCoefficients"); - xmlWriter.writeTextElement("r0", QString::number(this->r0)); - xmlWriter.writeTextElement("r1", QString::number(this->r1)); - xmlWriter.writeTextElement("r2", QString::number(this->r2)); - xmlWriter.writeTextElement("r3", QString::number(this->r3)); - xmlWriter.writeTextElement("r4", QString::number(this->r4)); + xmlWriter.writeTextElement("r0", QString::number(this->r0, 'e', 18)); + xmlWriter.writeTextElement("r1", QString::number(this->r1, 'e', 18)); + xmlWriter.writeTextElement("r2", QString::number(this->r2, 'e', 18)); + xmlWriter.writeTextElement("r3", QString::number(this->r3, 'e', 18)); + xmlWriter.writeTextElement("r4", QString::number(this->r4, 'e', 18)); xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients - xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center)); - xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center)); - xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft)); - xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft)); - xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight)); - xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight)); - xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft)); - xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft)); - xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight)); - xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight)); + xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center, 'e', 18)); + xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center, 'e', 18)); + xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft, 'e', 18)); + xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft, 'e', 18)); + xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight, 'e', 18)); + xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight, 'e', 18)); + xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft, 'e', 18)); + xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft, 'e', 18)); + xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight, 'e', 18)); + xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight, 'e', 18)); xmlWriter.writeEndElement(); // Parameters xmlWriter.writeEndDocument(); @@ -371,6 +372,9 @@ ErrorCode SARSimulationImageL1Dataset::loadFromXml() else if (xmlReader.name() == "Fs") { this->Fs = xmlReader.readElementText().toDouble(); } + else if (xmlReader.name() == "PRF") { + this->prf = xmlReader.readElementText().toDouble(); + } else if(xmlReader.name() == "ImageStartTime"){ this->startImageTime = xmlReader.readElementText().toDouble(); } @@ -873,6 +877,7 @@ QVector SARSimulationImageL1Dataset::getDopplerParams() result[2] = d2; result[3] = d3; result[4] = d4; + return result; } @@ -888,11 +893,13 @@ void SARSimulationImageL1Dataset::setDopplerParams(double id0, double id1, doubl QVector SARSimulationImageL1Dataset::getDopplerCenterCoff() { QVector result(5); - result[0]=r0; - result[1]=r1; - result[2]=r2; - result[3]=r3; - result[4]=r4; + result[0] = r0; + result[1] = r1; + result[2] = r2; + result[3] = r3; + result[4] = r4; + + return result; } diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h index c2abecf..6d8325a 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h @@ -143,9 +143,11 @@ public: double getDopplerParametersReferenceTime(); void setDopplerParametersReferenceTime(double v); + // ղ QVector getDopplerParams(); void setDopplerParams(double d0, double d1, double d2, double d3, double d4); + // ϵ QVector getDopplerCenterCoff(); void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4); @@ -208,3 +210,9 @@ private: }; + + + + + + diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp index bc8a0a9..7d0df86 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp @@ -121,20 +121,48 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start int datarows = data.rows(); int datacols = data.cols(); - double* databuffer = new double[data.size() * 2]; - for (int i = 0; i < data.rows(); i++) { - for (int j = 0; j < data.cols(); j++) { - databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real(); - databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag(); + if (this->getDataType() == GDT_CFloat64) + { + + double* databuffer = new double[data.size() * 2]; + for (int i = 0; i < data.rows(); i++) { + for (int j = 0; j < data.cols(); j++) { + databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real(); + databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag(); + } } + + // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, + // datarows, GDT_Float32,band_ids, num,0,0,0); + poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, + databuffer, datacols, datarows, GDT_CFloat64, 0, 0); + GDALFlushCache(poDstDS); + delete databuffer; + + } + else if (this->getDataType() == GDT_CFloat32) { + + float* databuffer = new float[data.size() * 2]; + for (int i = 0; i < data.rows(); i++) { + for (int j = 0; j < data.cols(); j++) { + databuffer[i * data.cols() * 2 + j * 2] = float(data(i, j).real()); + databuffer[i * data.cols() * 2 + j * 2 + 1] =float( data(i, j).imag()); + } + } + + // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, + // datarows, GDT_Float32,band_ids, num,0,0,0); + poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, + databuffer, datacols, datarows, GDT_CFloat32, 0, 0); + GDALFlushCache(poDstDS); + delete databuffer; + } + else { + throw std::exception("gdalImageComplex::saveImage: data type error"); } - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, GDT_CFloat64, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; + + GDALClose((GDALDatasetH)poDstDS); GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH omp_unset_lock(&lock); // @@ -265,24 +293,46 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col, // ȡݼĵһ GDALRasterBand* poBand; poBand = poDataset->GetRasterBand(1); - + rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; + cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; // ȡϢǸ int nXSize = cols_count; poBand->GetXSize(); int nYSize = rows_count; poBand->GetYSize(); - - double* databuffer = new double[nXSize * nYSize * 2]; - poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, - rows_count, GDT_CFloat64, 0, 0); - GDALClose((GDALDatasetH)poDataset); Eigen::MatrixXcd rasterData(nYSize, nXSize); // ʹEigenMatrixXcd - for (size_t i = 0; i < nYSize; i++) { - for (size_t j = 0; j < nXSize; j++) { - rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], - databuffer[i * nXSize * 2 + j * 2 + 1]); + if (this->getDataType() == GDT_CFloat64) + { + long long pixelCount =long long( nXSize) *long long( nYSize); + double* databuffer = new double[pixelCount * 2]; + poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0); + GDALClose((GDALDatasetH)poDataset); + + for (long long i = 0; i < nYSize; i++) { + for (long long j = 0; j < nXSize; j++) { + rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], + databuffer[i * nXSize * 2 + j * 2 + 1]); + } } + + delete[] databuffer; + } + else if(this->getDataType()==GDT_CFloat32) + { + long long pixelCount = long long(nXSize) * long long(nYSize); + float* databuffer = new float[pixelCount * 2]; + poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat32, 0, 0); + GDALClose((GDALDatasetH)poDataset); + + for (long long i = 0; i < nYSize; i++) { + for (long long j = 0; j < nXSize; j++) { + rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], + databuffer[i * nXSize * 2 + j * 2 + 1]); + } + } + + delete[] databuffer; } - delete[] databuffer; + return rasterData; } diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp index bce0668..9fe8bfd 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp @@ -1228,8 +1228,8 @@ RasterExtend gdalImage::getExtend() double x1 = this->gt(0, 0); double y1 = this->gt(1, 0); - double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); - double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); + double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); // + double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); // γ double x3 = this->gt(0, 0) + (0) * gt(0, 1) + (this->height - 1) * gt(0, 2); double y3 = this->gt(1, 0) + (0) * gt(1, 1) + (this->height - 1) * gt(1, 2); @@ -1401,6 +1401,15 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, datetype, NULL); // ������ + + if (NULL == poDstDS) + { + qDebug() << "Create image failed!"; + throw "Create image failed!"; + exit(1); + } + + if (need_gt) { if (!projection.isEmpty()) { poDstDS->SetProjection(projection.toUtf8().constData()); @@ -1470,6 +1479,51 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba } +bool CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath) { + // עGDAL + GDALAllRegister(); + + // ӰAֻģʽ + GDALDataset* ds_a = (GDALDataset*)GDALOpen(RasterAPath.toUtf8().constData(), GA_ReadOnly); + if (ds_a == nullptr) { + std::cerr << "޷ӰA" << std::endl; + return false; + } + + // ȡAķͶӰϢ + double geotransform[6]; + ds_a->GetGeoTransform(geotransform); // 任 + const char* projection = ds_a->GetProjectionRef(); // WKTʽͶӰ + + // ӰBģʽ + GDALDataset* ds_b = (GDALDataset*)GDALOpen(RasterBPath.toUtf8().constData(), GA_Update); + if (ds_b == nullptr) { + std::cerr << "޷ӰB" << std::endl; + GDALClose(ds_a); + return false; + } + + // ÷ + if (ds_b->SetGeoTransform(geotransform) != CE_None) { + std::cerr << "÷ʧ" << std::endl; + } + + // ͶӰϵ + if (ds_b->SetProjection(projection) != CE_None) { + std::cerr << "ͶӰʧ" << std::endl; + } + + // ͷԴ + GDALClose(ds_a); + GDALClose(ds_b); + + return true; + + + + + +} diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index 67c620a..ee94390 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "ImageOperatorBase.h" #include "BaseTool.h" #include "GeoOperator.h" @@ -25,8 +25,12 @@ #include #include #include -#include // OGRSpatialReference ڿռοת -#include // GDALWarp +#include // OGRSpatialReference 用于空间参考转换 +#include // 用于 GDALWarp 操作 + +#include "gdal_priv.h" +#include "cpl_conv.h" +#include std::shared_ptr OpenDataset(const QString& in_path, GDALAccess rwmode) @@ -105,13 +109,13 @@ GDALDataType getGDALDataType(QString fileptah) CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - fileptah.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� + fileptah.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� + omp_unset_lock(&lock); // 锟酵放伙拷斤拷 + omp_destroy_lock(&lock); // 劫伙拷斤拷 return gdal_datatype; } @@ -124,14 +128,14 @@ GDALDataType getGDALDataType(QString fileptah) int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype, double memey_size) { - // С + // 计算大小 int size_meta = 0; if (gdal_datatype == GDT_Byte) { size_meta = 1; } else if (gdal_datatype == GDT_UInt16) { - size_meta = 2; // ֻ˫ܹͨ + size_meta = 2; // 只有双通道才能构建 复数矩阵 } else if (gdal_datatype == GDT_UInt16) { size_meta = 2; @@ -172,7 +176,7 @@ int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype else { } int block_num = int(memey_size / (size_meta * block_width)); - block_num = block_num > height ? height : block_num; // + block_num = block_num > height ? height : block_num; // 行数 block_num = block_num < 1 ? 1 : block_num; return block_num; } @@ -203,84 +207,85 @@ int ENVI2TIFF(QString in_envi_path, QString out_tiff_path) void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) { - // עGDAL + // 注册所有GDAL驱动 GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // դļ + // 打开输入栅格文件 GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly); if (!srcDataset) { - // ļʧ - // qDebug() << "޷ļ" << inRasterPath; + // 错误处理:输出文件打开失败 + // qDebug() << "无法打开输入文件:" << inRasterPath; return; } - // Ŀϵ + // 创建目标坐标系 OGRSpatialReference targetSRS; if (targetSRS.importFromEPSG(outepsgcode) != OGRERR_NONE) { GDALClose(srcDataset); - // qDebug() << "ЧEPSG룺" << outepsgcode; + // qDebug() << "无效的EPSG代码:" << outepsgcode; return; } GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType(); - // ȡĿϵWKTʾ + // 获取目标坐标系的WKT表示 char* targetSRSWkt = nullptr; targetSRS.exportToWkt(&targetSRSWkt); bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 || datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64); - // ͶӰݼWarped VRT + // 创建重投影后的虚拟数据集(Warped VRT) GDALDataset* warpedVRT = flag ? (GDALDataset*)GDALAutoCreateWarpedVRT( srcDataset, - nullptr, // ϵĬʹԴݣ - targetSRSWkt, // Ŀϵ - GRA_NearestNeighbour, // ز˫Բֵ - 0.0, // 0ʾԶ㣩 - nullptr // ѡ + nullptr, // 输入坐标系(默认使用源数据) + targetSRSWkt, // 目标坐标系 + GRA_NearestNeighbour, // 重采样方法:双线性插值 + 0.0, // 最大误差(0表示自动计算) + nullptr // 其他选项 ) : (GDALDataset*)GDALAutoCreateWarpedVRT( srcDataset, - nullptr, // ϵĬʹԴݣ - targetSRSWkt, // Ŀϵ - GRA_Bilinear, // ز˫Բֵ - 0.0, // 0ʾԶ㣩 - nullptr // ѡ + nullptr, // 输入坐标系(默认使用源数据) + targetSRSWkt, // 目标坐标系 + GRA_Bilinear, // 重采样方法:双线性插值 + 0.0, // 最大误差(0表示自动计算) + nullptr // 其他选项 ); - CPLFree(targetSRSWkt); // ͷWKTڴ + CPLFree(targetSRSWkt); // 释放WKT内存 if (!warpedVRT) { GDALClose(srcDataset); - qDebug() << u8"ͶӰתVRTʧ"; + qDebug() << u8"创建投影转换VRT失败"; return; } - // ȡGeoTIFFʽ + // 获取输出驱动(GeoTIFF格式) QString filesuffer = getFileExtension(outRasterPath).toLower(); bool isTiff = filesuffer.contains("tif"); GDALDriver* driver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); if (!driver) { GDALClose(warpedVRT); GDALClose(srcDataset); - // qDebug() << "޷ȡGeoTIFF"; + // qDebug() << "无法获取GeoTIFF驱动"; return; } - // դļ + // 创建输出栅格文件 GDALDataset* dstDataset = driver->CreateCopy( - outRasterPath.toUtf8().constData(), // ļ· - warpedVRT, // ݼVRT - false, // Ƿϸ - nullptr, // ѡ - nullptr, // Ȼص - nullptr // ص + outRasterPath.toUtf8().constData(), // 输出文件路径 + warpedVRT, // 输入数据集(VRT) + false, // 是否严格复制 + nullptr, // 创建选项 + nullptr, // 进度回调 + nullptr // 回调参数 ); if (!dstDataset) { - // qDebug() << "ļʧܣ" << outRasterPath; + // qDebug() << "创建输出文件失败:" << outRasterPath; GDALClose(warpedVRT); GDALClose(srcDataset); return; } - // ͷԴ + // 释放资源 GDALClose(dstDataset); GDALClose(warpedVRT); GDALClose(srcDataset); @@ -290,7 +295,7 @@ void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long o void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample) { GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); + GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile.toLocal8Bit().constData(), GA_ReadOnly); if (pDSrc == NULL) { qDebug() << u8"do not open In Raster file: " << pszSrcFile; @@ -320,11 +325,11 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr char* pszSrcWKT = NULL; pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - // ���û��ͶӰ����?���һ�?1?7 + // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 if (strlen(pszSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //������ ����120�� + // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pszSrcWKT); } @@ -332,12 +337,12 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr char* pdstSrcWKT = NULL; pdstSrcWKT = const_cast(pDRef->GetProjectionRef()); - // ���û��ͶӰ����?���һ�?1?7 + // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 if (strlen(pdstSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //������ ����120�� + // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pdstSrcWKT); } @@ -369,7 +374,7 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); qDebug() << "no proj "; - //(û��ͶӰ��Ӱ��������߲�??1?7) + //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) if (hTransformArg == NULL) { qDebug() << "hTransformArg create failure"; GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); @@ -392,8 +397,8 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // ʹпõCPU - CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // ûСΪ500MB + CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 + CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB // psWo->papszWarpOptions = CSLDuplicate(NULL); psWo->eWorkingDataType = dataType; @@ -440,20 +445,20 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, QString OutrasterCPath) { - // עGDAL + // 注册所有GDAL驱动 GDALAllRegister(); - // 򿪲οդB + // 打开参考栅格B GDALDataset* refDS = (GDALDataset*)GDALOpen(RefrasterBPath.toUtf8().constData(), GA_ReadOnly); if (!refDS) { - qDebug() << "޷򿪲οդB" << RefrasterBPath; + qDebug() << "无法打开参考栅格B:" << RefrasterBPath; return; } - // ȡοդĵ任ͶӰͳߴ + // 获取参考栅格的地理变换、投影和尺寸 double geotransform[6]; if (refDS->GetGeoTransform(geotransform) != CE_None) { - qDebug() << "ȡοդĵ任ʧܡ"; + qDebug() << "获取参考栅格的地理变换失败。"; GDALClose(refDS); return; } @@ -461,28 +466,28 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q const char* proj = refDS->GetProjectionRef(); int cols = refDS->GetRasterXSize(); int rows = refDS->GetRasterYSize(); - GDALClose(refDS); // ȡϢرղοդ + GDALClose(refDS); // 获取信息后关闭参考栅格 - // դA + // 打开输入栅格A GDALDataset* srcDS = (GDALDataset*)GDALOpen(InrasterAPath.toUtf8().constData(), GA_ReadOnly); if (!srcDS) { - qDebug() << "޷դA" << InrasterAPath; + qDebug() << "无法打开输入栅格A:" << InrasterAPath; return; } - // ȡդIJ + // 获取输入栅格的波段数和数据类型 int nBands = srcDS->GetRasterCount(); if (nBands == 0) { - qDebug() << "դûвݡ"; + qDebug() << "输入栅格没有波段数据。"; GDALClose(srcDS); return; } GDALDataType dataType = srcDS->GetRasterBand(1)->GetRasterDataType(); - // դC + // 创建输出栅格C GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (!driver) { - qDebug() << "޷ȡGeoTIFF"; + qDebug() << "无法获取GeoTIFF驱动。"; GDALClose(srcDS); return; } @@ -496,16 +501,16 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q nullptr ); if (!dstDS) { - qDebug() << "޷դ" << OutrasterCPath; + qDebug() << "无法创建输出栅格:" << OutrasterCPath; GDALClose(srcDS); return; } - // դĵ任ͶӰ + // 设置输出栅格的地理变换和投影 dstDS->SetGeoTransform(geotransform); dstDS->SetProjection(proj); - // GDAL Warpѡ + // 配置GDAL Warp选项 GDALWarpOptions* psWO = GDALCreateWarpOptions(); psWO->hSrcDS = srcDS; psWO->hDstDS = dstDS; @@ -516,9 +521,9 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q psWO->panSrcBands[i] = i + 1; psWO->panDstBands[i] = i + 1; } - psWO->eResampleAlg = GRA_NearestNeighbour; // ʹز + psWO->eResampleAlg = GRA_NearestNeighbour; // 使用最近邻重采样 - // ʼת + // 初始化坐标转换器 psWO->pfnTransformer = GDALGenImgProjTransform; psWO->pTransformerArg = GDALCreateGenImgProjTransformer( srcDS, GDALGetProjectionRef(srcDS), @@ -526,17 +531,17 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q FALSE, 0.0, 1 ); if (!psWO->pTransformerArg) { - qDebug() << "תʧܡ"; + qDebug() << "创建坐标转换器失败。"; GDALDestroyWarpOptions(psWO); GDALClose(srcDS); GDALClose(dstDS); return; } - // ִWarp + // 执行Warp操作 GDALWarpOperation oWarp; if (oWarp.Initialize(psWO) != CE_None) { - qDebug() << "ʼWarpʧܡ"; + qDebug() << "初始化Warp操作失败。"; GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); GDALDestroyWarpOptions(psWO); GDALClose(srcDS); @@ -546,79 +551,80 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q CPLErr eErr = oWarp.ChunkAndWarpImage(0, 0, cols, rows); if (eErr != CE_None) { - qDebug() << "ִWarpʧܡ"; + qDebug() << "执行Warp操作失败。"; } - // Դ + // 清理资源 GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); GDALDestroyWarpOptions(psWO); GDALClose(srcDS); GDALClose(dstDS); - qDebug() << "زɣѱ" << OutrasterCPath; + qDebug() << "重采样完成,结果已保存至:" << OutrasterCPath; } void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat) { - // ʼ GDAL + // 初始化 GDAL 库 GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // դݼ + // 打开栅格数据集 GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); if (poDataset == nullptr) { - std::cerr << "Failed to open input raster." << std::endl; + qDebug() << "Failed to open input raster." ; return; } - // ȡդݵĵοϢ + // 获取栅格数据的地理参考信息 double adfGeoTransform[6]; if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; + qDebug() << "Failed to get geotransform." ; GDALClose(poDataset); return; } - // ȡӰͶӰϢ + // 获取输入影像的投影信息 const char* projection = poDataset->GetProjectionRef(); - // ݾγȼüӦդ + // 根据经纬度计算出裁剪区域对应的栅格像素坐标 int xMin = (int)((minLon - adfGeoTransform[0]) / adfGeoTransform[1]); int xMax = (int)((maxLon - adfGeoTransform[0]) / adfGeoTransform[1]); int yMin = (int)((maxLat - adfGeoTransform[3]) / adfGeoTransform[5]); int yMax = (int)((minLat - adfGeoTransform[3]) / adfGeoTransform[5]); - // üĿդݼ + // 创建裁剪区域的目标栅格数据集 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; + qDebug() << "Failed to get GTiff driver." ; GDALClose(poDataset); return; } - // դݼָߴ + // 创建输出栅格数据集,指定尺寸 int width = xMax - xMin; int height = yMax - yMin; GDALDataset* poOutDataset = poDriver->Create(outputFile, width, height, poDataset->GetRasterCount(), GDT_Float32, nullptr); if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; + qDebug() << "Failed to create output raster." ; GDALClose(poDataset); return; } - // դͶӰϢ͵任 + // 设置输出栅格的投影信息和地理变换 poOutDataset->SetProjection(projection); double newGeoTransform[6] = { adfGeoTransform[0] + xMin * adfGeoTransform[1], adfGeoTransform[1], 0.0, adfGeoTransform[3] + yMin * adfGeoTransform[5], 0.0, adfGeoTransform[5] }; poOutDataset->SetGeoTransform(newGeoTransform); - // ѭȡԴݲдĿݼ + // 循环读取源数据并写入目标数据集 for (int i = 0; i < poDataset->GetRasterCount(); ++i) { GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - // ȡԴ + // 读取源数据 int* pData = new int[width * height]; poBand->RasterIO(GF_Read, xMin, yMin, width, height, pData, width, height, GDT_Int32, 0, 0); - // дĿ + // 写入目标数据 poOutBand->RasterIO(GF_Write, 0, 0, width, height, pData, width, height, GDT_Int32, 0, 0); delete[] pData; @@ -626,28 +632,30 @@ void cropRasterByLatLon(const char* inputFile, const char* outputFile, double mi qDebug() << "Raster cropped and saved to: " << outputFile; - // - GDALClose(poDataset); - GDALClose(poOutDataset); + // 清理 + + GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); + GDALClose((GDALDatasetH)(GDALDatasetH)poOutDataset); + GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH } ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p) { - // Դϵԭʼϵ + // 创建源坐标系(原始坐标系) OGRSpatialReference sourceSRS; - sourceSRS.importFromEPSG(sourceEPSG); // ʹ EPSG ָϵ + sourceSRS.importFromEPSG(sourceEPSG); // 使用 EPSG 编码来指定坐标系 - // ĿϵĿϵ + // 创建目标坐标系(目标坐标系) OGRSpatialReference targetSRS; - targetSRS.importFromEPSG(targetEPSG); // WGS84 ϵ EPSG:4326 + targetSRS.importFromEPSG(targetEPSG); // WGS84 坐标系 EPSG:4326 - // 任 + // 创建坐标变换对象 OGRCoordinateTransformation* transform = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); if (transform == nullptr) { qDebug() << "Failed to create coordinate transformation."; return ErrorCode::FAIL; } - // ת + // 转换坐标 double transformedX = x; double transformedY = y; if (transform->Transform(1, &transformedX, &transformedY)) { @@ -658,7 +666,7 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG qDebug() << "Coordinate transformation failed."; } - // + // 清理 delete transform; p.x = transformedX; p.y = transformedY; @@ -668,23 +676,23 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG) { - // ʼ GDAL + // 初始化 GDAL 库 GDALAllRegister(); - // Դդļ + // 打开源栅格文件 GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); if (poSrcDS == nullptr) { qDebug() << "Failed to open input file:" << inputFile; return; } - // ȡԴդĻϢ + // 获取源栅格的基本信息 int nXSize = poSrcDS->GetRasterXSize(); int nYSize = poSrcDS->GetRasterYSize(); int nBands = poSrcDS->GetRasterCount(); GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType(); - // Ŀդļ + // 创建目标栅格文件 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { qDebug() << "GTiff driver not available."; @@ -699,7 +707,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP return; } - // ĿդĿռοϵͳ + // 设置目标栅格的空间参考系统 OGRSpatialReference oSRS; oSRS.importFromEPSG(targetEPSG); @@ -708,10 +716,10 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP poDstDS->SetProjection(pszWKT); CPLFree(pszWKT); - // Ԫ + // 复制元数据 poDstDS->SetMetadata(poSrcDS->GetMetadata()); - // ÿε + // 复制每个波段的数据 for (int i = 1; i <= nBands; ++i) { GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(i); GDALRasterBand* poDstBand = poDstDS->GetRasterBand(i); @@ -726,7 +734,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP CPLFree(pafScanline); } - // رݼ + // 关闭数据集 GDALClose(poSrcDS); GDALClose(poDstDS); @@ -735,81 +743,56 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY) { - // ʼGDAL + // 初始化GDAL GDALAllRegister(); - // դļ + // 打开输入栅格文件 GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputRaster, GA_ReadOnly); if (poDataset == nullptr) { - std::cerr << "Failed to open raster file." << std::endl; + qDebug() << "Failed to open raster file." ; return; } - // ȡԭʼդĿռο + // 获取原始栅格的空间参考 double adfGeoTransform[6]; if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; + qDebug() << "Failed to get geotransform." ; GDALClose(poDataset); return; } - // ȡԭʼդijߴ + // 获取原始栅格的尺寸 int nXSize = poDataset->GetRasterXSize(); int nYSize = poDataset->GetRasterYSize(); - // Ŀդijߴ - double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX; - double targetYSize = (adfGeoTransform[5] * nYSize) / targetPixelSizeY; + // 计算目标栅格的尺寸 + double targetXSize = ceil((adfGeoTransform[1] * nXSize) / targetPixelSizeX); + double targetYSize = ceil(std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY)); - // Ŀݼդ + // 创建目标数据集(输出栅格) GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; + qDebug() << "Failed to get GTiff driver." ; GDALClose(poDataset); return; } - // ݼ - GDALDataset* poOutDataset = poDriver->Create(outputRaster, (int)targetXSize, (int)targetYSize, poDataset->GetRasterCount(), GDT_Float32, nullptr); - if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; - GDALClose(poDataset); - return; - } - - // ݼĵ任ϵ + // 设置输出数据集的地理变换(坐标系) double targetGeoTransform[6] = { adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY }; - poOutDataset->SetGeoTransform(targetGeoTransform); - - // ݼͶӰϢ - poOutDataset->SetProjection(poDataset->GetProjectionRef()); - - // ز - for (int i = 0; i < poDataset->GetRasterCount(); i++) { - GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); - GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - - // ʹGDALزѡһʵزʽ - poOutBand->RasterIO(GF_Write, 0, 0, (int)targetXSize, (int)targetYSize, - nullptr, (int)targetXSize, (int)targetYSize, - poBand->GetRasterDataType(), 0, 0, nullptr); - } - - // رݼ - GDALClose(poDataset); - GDALClose(poOutDataset); - + GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); + GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH + ResampleGDAL(inputRaster, outputRaster, targetGeoTransform, targetXSize, targetYSize,GRA_Bilinear); qDebug() << "Resampling completed."; } std::shared_ptr GetCenterPointInRaster(QString filepath) { qDebug() << "============= GetCenterPointInRaster ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // ȡϵͳĬϱı - // QByteArray byteArray = codec->fromUnicode(filepath); // QStringתΪQByteArray - //,ӦûԶͷ const char* charArray = byteArray.constData(); // - // ȡQByteArrayconst char*ָ + // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 + // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray + //,这个应该会自动释放 const char* charArray = byteArray.constData(); // + // 获取QByteArray的const char*指针 GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); @@ -817,7 +800,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) GDALDataset* poDataset = (GDALDataset*)GDALOpen(filepath.toUtf8().data(), GA_ReadOnly); if (nullptr == poDataset || NULL == poDataset) { qDebug() << "Could not open dataset"; - return nullptr; // ʾȡʧ + return nullptr; // 表示读取失败 } double x, y, z; @@ -834,7 +817,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) double dfWidth = poDataset->GetRasterXSize(); double dfHeight = poDataset->GetRasterYSize(); - // ĵ꣨꣩ + // 计算中心点坐标(像素坐标) double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0 + dfHeight * adfGeoTransform[2] / 2.0; double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0 @@ -851,7 +834,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) y = dfCenterY; } else { - // ǵϵתWGS84 + // 如果不是地理坐标系,转换到WGS84 OGRSpatialReference oSRS_WGS84; oSRS_WGS84.SetWellKnownGeogCS("WGS84"); @@ -899,10 +882,10 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) long GetEPSGFromRasterFile(QString filepath) { qDebug() << "============= GetEPSGFromRasterFile ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // ȡϵͳĬϱı - // QByteArray byteArray = codec->fromUnicode(filepath); // QStringתΪQByteArray - //,ӦûԶͷ const char* charArray = byteArray.constData(); // - // ȡQByteArrayconst char*ָ + // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 + // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray + //,这个应该会自动释放 const char* charArray = byteArray.constData(); // + // 获取QByteArray的const char*指针 { if (QFile(filepath).exists()) { @@ -913,9 +896,9 @@ long GetEPSGFromRasterFile(QString filepath) } GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עGDAL + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动 // qDebug()<GetProjectionRef(); qDebug() << QString::fromUtf8(pszProjection); - // SpatialReference + // 创建SpatialReference对象 OGRSpatialReference oSRS; if (oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) { qDebug() << ("Error: Unable to import projection information.\n"); @@ -945,7 +928,7 @@ long GetEPSGFromRasterFile(QString filepath) return -1; } - long epsgCode = atoi(epscodestr); // ȡEPSG + long epsgCode = atoi(epscodestr); // 获取EPSG代码 if (epsgCode != 0) { GDALClose(poDataset); @@ -963,14 +946,16 @@ long GetEPSGFromRasterFile(QString filepath) -long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState) +long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) { long EPSGCode = 0; switch (stripState) { case ProjectStripDelta::Strip_3: { + EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip3(lon, lat); break; }; case ProjectStripDelta::Strip_6: { + EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip6(lon, lat); break; } default: { @@ -983,16 +968,16 @@ long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stri } long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) { - // EPSG 4534 ~ 4554 3 ȴ - // жǷ йΧ - // ľȷΧ 75E ~ 135E ʵʷΧ 73.5E ~ 136.5E, - // γȷΧ 3N ~ 54Nſ 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // й + // EPSG 4534 ~ 4554 3 度带 + // 首先判断是否是在 中国带宽范围 + // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E, + // 纬度范围 3N ~ 54N,放宽到 0N~ 60N + if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 long code = trunc((lon - 73.5) / 3) + 4534; return code; } - else { // й ʹ ˹ - bool isSouth = lat < 0; // жϱΪʾʵӦÿҪϸµ߼ + else { // 非中国境内 使用 高斯克吕格 + bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑 long prefix = isSouth ? 327000 : 326000; // std::string prefix = isSouth ? "327" : "326"; lon = fmod(lon + 360.0, 360.0); @@ -1004,18 +989,18 @@ long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) } long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat) { - // EPSG 4502 ~ 4512 6ȴ - // жǷ йΧ - // ľȷΧ 75E ~ 135E ʵʷΧ 72.0E ~ 138E, - // γȷΧ 3N ~ 54Nſ 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // й + // EPSG 4502 ~ 4512 6度带 + // 首先判断是否是在 中国带宽范围 + // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E, + // 纬度范围 3N ~ 54N,放宽到 0N~ 60N + if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 long code = trunc((lon - 72.0) / 6) + 4502; return code; } - else { // й ʹ UTM// ȷţ6ȴ1ʼ60ÿ6һ + else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带 int zone = static_cast((lon + 180.0) / 6.0) + 1; - bool isSouth = lon < 0; // жǷϰ - long epsgCodeBase = isSouth ? 32700 : 32600; // EPSG + bool isSouth = lon < 0; // 判断是否在南半球 + long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码 long prefix = static_cast(epsgCodeBase + zone); return prefix; } @@ -1027,13 +1012,13 @@ QString GetProjectionNameFromEPSG(long epsgCode) qDebug() << "============= GetProjectionNameFromEPSG ======================"; OGRSpatialReference oSRS; - // EPSG + // 设置EPSG代码 if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { qDebug() << "epsgcode not recognition"; return ""; } - // ȡϵƣ + // 获取并输出坐标系的描述(名称) const char* pszName = oSRS.GetAttrValue("GEOGCS"); if (pszName) { qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode) @@ -1046,19 +1031,19 @@ QString GetProjectionNameFromEPSG(long epsgCode) } // char* wkt = NULL; - // // תΪWKTʽ + // // 转换为WKT格式 // oSRS.exportToWkt(&wkt); // // qDebug() << wkt; // - // // WKTнͶӰƣ򻯴ʵʿҪӵ߼׼ȷȡ + // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称 // std::string wktStr(wkt); - // long start = wktStr.find("PROJCS[\"") + 8; // ҵ"PROJCS["ĵһ˫λ - // // startλÿʼһ˫ţ֮ݼΪͶӰ + // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置 + // // 从start位置开始找下一个双引号,这之间的内容即为投影名称 // int end = wktStr.find('\"', start); // QString projName = QString::fromStdString(wktStr.substr(start, end - start)); // - // // ͷWKTַڴ + // // 释放WKT字符串内存 // CPLFree(wkt); // return projName; @@ -1111,11 +1096,11 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int char* pszSrcWKT = NULL; pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - // ���û��ͶӰ����?���һ�?1?7 + // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 if (strlen(pszSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //������ ����120�� + // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pszSrcWKT); } @@ -1124,7 +1109,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); qDebug() << "no proj " << Qt::endl; - //(û��ͶӰ��Ӱ��������߲�??1?7) + //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) if (hTransformArg == NULL) { GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); return -3; @@ -1152,8 +1137,8 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int pDDst->SetGeoTransform(gt); GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // ʹпõCPU - CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // ûСΪ500MB + CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 + CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // 设置缓存大小为500MB // psWo->papszWarpOptions = CSLDuplicate(NULL); psWo->eWorkingDataType = dataType; psWo->eResampleAlg = eResample; @@ -1361,7 +1346,7 @@ int alignRaster(QString inputPath, QString referencePath, QString outputPath, GD -/** 2025.03.25 ĺ Eigenʹ****************************/ +/** 2025.03.25 下面的函数存在 Eigen使用****************************/ @@ -1392,8 +1377,8 @@ int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path) Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); gdalImage image_tiff = - CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // עﱣ - // ļ + CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 注意这里保留仿真结果 + // 保存二进制文件 Eigen::MatrixXd real_img = data.array().real(); Eigen::MatrixXd imag_img = data.array().imag(); image_tiff.saveImage(real_img, 0, 0, 1); @@ -1430,23 +1415,30 @@ void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long m ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath) { - gdalImage demds(dempath); - gdalImage demxyz = CreategdalImage(demxyzpath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true);// X,Y,Z + QString DEMPath = dempath; + QString XYZPath = demxyzpath; + QString SLOPERPath = demsloperPath; - // ֿ㲢תΪXYZ + + + gdalImage demds(DEMPath); + gdalImage demxyz = CreategdalImageDouble(XYZPath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true, false);// X,Y,Z + + // 分块计算并转换为XYZ + + //Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); + //Eigen::MatrixXd demR = demArr; - Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); - Eigen::MatrixXd demR = demArr; - Landpoint LandP{ 0,0,0 }; - Point3 GERpoint{ 0,0,0 }; double R = 0; double dem_row = 0, dem_col = 0, dem_alt = 0; - long line_invert = 1000; + long line_invert = Memory1MB / 8.0 / demds.width * 1000; + + - double rowidx = 0; - double colidx = 0; for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) { + qDebug() << "dem -> XYZ [" << max_rows_ids*100.0/ demds.height << "] %" ; + Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1); Eigen::MatrixXd xyzdata_x = demdata.array() * 0; Eigen::MatrixXd xyzdata_y = demdata.array() * 0; @@ -1455,12 +1447,17 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri int datarows = demdata.rows(); int datacols = demdata.cols(); +#pragma omp parallel for for (int i = 0; i < datarows; i++) { + Landpoint LandP{ 0,0,0 }; + Point3 GERpoint{ 0,0,0 }; + double rowidx = 0; + double colidx = 0; for (int j = 0; j < datacols; j++) { rowidx = i + max_rows_ids; colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // ȡ - LLA2XYZ(LandP, GERpoint); // γתΪϵ + demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 获取地理坐标 + LLA2XYZ(LandP, GERpoint); // 经纬度转换为地心坐标系 xyzdata_x(i, j) = GERpoint.x; xyzdata_y(i, j) = GERpoint.y; xyzdata_z(i, j) = GERpoint.z; @@ -1469,35 +1466,39 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri demxyz.saveImage(xyzdata_x, max_rows_ids, 0, 1); demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2); demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3); + } - // - gdalImage demsloperxyz = CreategdalImage(demsloperPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true);// X,Y,Z,cosangle + // 计算坡向角 + + + + gdalImage demsloperxyz = CreategdalImageDouble(SLOPERPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true, false);// X,Y,Z,cosangle line_invert = 1000; long start_ids = 0; long dem_rows = 0, dem_cols = 0; - for (start_ids = 1; start_ids < demds.height; start_ids = start_ids + line_invert) { Eigen::MatrixXd demdata = demds.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); long startlineid = start_ids; + Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 2); Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3); Eigen::MatrixXd demsloper_angle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 4); - Landpoint p0, p1, p2, p3, p4, pslopeVector, pp; - Vector3D slopeVector; - - dem_rows = demsloper_y.rows(); - dem_cols = demsloper_y.cols(); - double sloperAngle = 0; - Vector3D Zaxis = { 0,0,1 }; - - double rowidx = 0, colidx = 0; + dem_rows = demsloper_x.rows(); + dem_cols = demsloper_x.cols(); +#pragma omp parallel for for (long i = 1; i < dem_rows - 1; i++) { + Landpoint p0, p1, p2, p3, p4, pslopeVector, pp; + Vector3D slopeVector; + double sloperAngle = 0; + Vector3D Zaxis = { 0,0,1 }; + + double rowidx = 0, colidx = 0; for (long j = 1; j < dem_cols - 1; j++) { rowidx = i + startlineid; colidx = j; @@ -1507,27 +1508,31 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri demds.getLandPoint(rowidx + 1, colidx, demdata(i + 1, j), p3); demds.getLandPoint(rowidx, colidx + 1, demdata(i, j + 1), p4); - pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // ʸ + pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 地面坡向矢量 slopeVector = { pslopeVector.lon,pslopeVector.lat,pslopeVector.ati }; pp = LLA2XYZ(p0); Zaxis.x = pp.lon; Zaxis.y = pp.lat; Zaxis.z = pp.ati; - sloperAngle = getCosAngle(slopeVector, Zaxis); // + sloperAngle = getCosAngle(slopeVector, Zaxis); // 地面坡向角 demsloper_x(i, j) = slopeVector.x; demsloper_y(i, j) = slopeVector.y; demsloper_z(i, j) = slopeVector.z; demsloper_angle(i, j) = sloperAngle; + } } + demsloperxyz.saveImage(demsloper_x, start_ids - 1, 0, 1); demsloperxyz.saveImage(demsloper_y, start_ids - 1, 0, 2); demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3); demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4); + } + return ErrorCode::SUCCESS; } @@ -1549,7 +1554,7 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath, Eigen::MatrixXd SARData = SARIntensity.getData(0, 0, SARIntensity.height, SARIntensity.width, 1); SARData = SARData.array() * 0; - // ֿ鴦 + // 分块处理 for (int yOff = 0; yOff < looktableds.height; yOff += blockYSize) { processBarShow(yOff, looktableds.height); @@ -1575,9 +1580,293 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath, } -/* ĺᵼ±󣬿Eigen bugأŲ飬̫ʱ䣬ҲһŲ + + + + + + +/**​ +* @brief 将VRT文件转换为ENVI格式(生成.dat和.hdr文件) +* @param inputVrtPath 输入VRT文件路径 +* @param outputEnviPath 输出ENVI数据文件路径(不含扩展名,自动生成.dat和.hdr) +* @param papszOptions GDAL创建选项(如压缩参数、存储顺序等,默认NULL) +* @return 成功返回true,失败返回false +*/ +bool ConvertVrtToEnvi(QString vrtPath, QString outPath) { + + GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注绞斤拷斤拷锟?1锟?7 + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); + + const char* inputVrtPath = vrtPath.toUtf8().constData(); + const char* outputEnviPath = outPath.toUtf8().constData(); + + // 注册所有GDAL驱动[7](@ref) + GDALAllRegister(); + + // 打开输入VRT文件[1,3](@ref) + GDALDataset* poVRTDataset = (GDALDataset*)GDALOpen(inputVrtPath, GA_ReadOnly); + if (!poVRTDataset) { + qDebug() << "错误:无法打开VRT文件 " << inputVrtPath ; + return false; + } + + // 获取ENVI驱动[4,7](@ref) + GDALDriver* poENVIDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); + if (!poENVIDriver) { + qDebug() << "错误:ENVI驱动未加载" ; + GDALClose(poVRTDataset); + return false; + } + + // 构造输出文件名(强制添加.dat后缀)[4](@ref) + std::string outputPath = std::string(outputEnviPath) + ".dat"; + + // 执行格式转换(自动生成.hdr头文件)[4,7](@ref) + GDALDataset* poENVIDataset = poENVIDriver->CreateCopy( + outputPath.c_str(), // 输出路径 + poVRTDataset, // 输入数据集 + FALSE, // 非严格模式(允许格式调整) + nullptr, // 用户自定义选项(如压缩参数) + nullptr, nullptr // 进度条和参数(暂不启用) + ); + + // 检查转换结果 + bool success = (poENVIDataset != nullptr); + if (!success) { + qDebug() << "错误:ENVI文件创建失败" ; + } + else { + GDALClose(poENVIDataset); + } + + // 关闭输入数据集 + GDALClose(poVRTDataset); + return success; +} + + + + +// 遥感类 +ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy) +{ + double gridlat = gridy / 110000.0; + double gridlon = gridx / 100000.0; + + long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); + if (espgcode == 4326) { + resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); + return ErrorCode::SUCCESS; + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"请输入WGS84坐标的DEM影像"); + return ErrorCode::FAIL; + } +} + +void BASECONSTVARIABLEAPI CloseAllGDALRaster() +{ + GDALDestroyDriverManager(); + return ; +} + + + +ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); + + long blocklines = Memory1GB * 2 / 8 / inimg.width; + blocklines = blocklines < 100 ? 100 : blocklines; + + long startrow = 0; + for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { + + Eigen::MatrixXd imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); + Eigen::MatrixXcd imgArr = inimg.getDataComplex(startrow, 0, blocklines, inimg.width, 1); + imgArrb1 = imgArr.array().abs(); + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << u8"影像写入到:" << outRasterPath; + return ErrorCode::SUCCESS; +} + +ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); + + + long blocklines = Memory1GB * 2 / 8 / inimg.width; + blocklines = blocklines < 100 ? 100 : blocklines; + Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); + Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); + + long startrow = 0; + for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { + + imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArrb1 = imgArr.array().arg(); + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << "影像写入到:" << outRasterPath; + return ErrorCode::SUCCESS; +} + +ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); + + + long blocklines = Memory1GB * 2 / 8 / inimg.width; + blocklines = blocklines < 100 ? 100 : blocklines; + Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); + Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); + + long startrow = 0; + for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { + + imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArrb1 = imgArr.array().abs().log10() * 20.0; + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << "影像写入到:" << outRasterPath; + return ErrorCode::SUCCESS; +} + + + +ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath) +{ + gdalImage inimg(inPath); + gdalImage dBimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); + + long blocklines = Memory1GB * 2 / 8 / inimg.width; + blocklines = blocklines < 100 ? 100 : blocklines; + Eigen::MatrixXd imgArrdB = Eigen::MatrixXd::Zero(blocklines, dBimg.width); + Eigen::MatrixXd imgArr = Eigen::MatrixXd::Zero(blocklines, inimg.width); + + long startrow = 0; + for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { + + imgArrdB = dBimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); + imgArrdB = imgArr.array().log10() * 20.0; + dBimg.saveImage(imgArrdB, startrow, 0, 1); + } + qDebug() << "影像写入到:" << outRasterPath; + return ErrorCode::SUCCESS; +} + + + +void MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol) +{ + gdalImage inRaster(inRasterPath); + + int outRows = inRaster.height / looklineNumrow; + int outCols = inRaster.width / looklineNumCol; + int bandnum = 1; + QString project = inRaster.projection; + Eigen::MatrixXd inRasterGt = inRaster.gt; + GDALDataType datetype = inRaster.getDataType(); + + gdalImage outRaster = CreategdalImage(outRasterPath, outRows, outCols, 1, inRasterGt, project, true, true, true, datetype); + + Eigen::MatrixXd inRasterArr = inRaster.getData(0, 0, inRaster.height, inRaster.width, 1); + Eigen::MatrixXd outRasterArr = outRaster.getData(0, 0, outRows, outCols, 1); + + + // 多视处理 +#pragma omp parallel for collapse(2) + for (int row = 0; row < outRows; ++row) { + for (int col = 0; col < outCols; ++col) { + // 计算输入矩阵的窗口位置[2,3](@ref) + const int inputRow = row * looklineNumrow; + const int inputCol = col * looklineNumCol; + + // 动态计算实际窗口大小(处理边界情况)[3](@ref) + const int actualRows = (row == outRows - 1) ? + (inRaster.height - inputRow) : looklineNumrow; + const int actualCols = (col == outCols - 1) ? + (inRaster.width - inputCol) : looklineNumCol; + + // 提取当前窗口数据块[7](@ref) + Eigen::MatrixXd window = inRasterArr.block(inputRow, inputCol, actualRows, actualCols); + + // 计算多视平均值(自动处理数据类型转换)[2,7](@ref) + double sum = 0.0; + if constexpr (std::is_integral_v) { + sum = window.cast().sum(); // 整型数据转换为双精度计算 + } + else { + sum = window.sum(); + } + outRasterArr(row, col) = sum / (actualRows * actualCols); + } + } + + // 可选:处理残留边界(当输入尺寸不是整数倍时) + if ((inRaster.height % looklineNumrow != 0) || (inRaster.width % looklineNumCol != 0)) { + // 底部边界处理[3](@ref) + const int residualRowStart = outRows * looklineNumrow; + const int residualRowSize = inRaster.height - residualRowStart; + if (residualRowSize > 0) { +#pragma omp parallel for + for (int col = 0; col < outCols; ++col) { + const int inputCol = col * looklineNumCol; + const int actualCols = (col == outCols - 1) ? + (inRaster.width - inputCol) : looklineNumCol; + + Eigen::MatrixXd window = inRasterArr.block(residualRowStart, inputCol, + residualRowSize, actualCols); + outRasterArr(outRows - 1, col) = window.mean(); + } + } + + // 右侧边界处理[3](@ref) + const int residualColStart = outCols * looklineNumCol; + const int residualColSize = inRaster.width - residualColStart; + if (residualColSize > 0) { +#pragma omp parallel for + for (int row = 0; row < outRows; ++row) { + const int inputRow = row * looklineNumrow; + const int actualRows = (row == outRows - 1) ? + (inRaster.height - inputRow) : looklineNumrow; + + Eigen::MatrixXd window = inRasterArr.block(inputRow, residualColStart, + actualRows, residualColSize); + outRasterArr(row, outCols - 1) = window.mean(); + } + } + } + + // 保存结果 + outRaster.saveImage(outRasterArr, 0, 0, 1); + +} + + + + + + + + + + + + + +/* 启动下面的函数,会导致编译器错误,可能与Eigen 库 本身的bug相关,不建议排查,太费时间,而且不一定能排查出来 * -*** +*** Eigen::Matrix ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype) @@ -1601,7 +1890,7 @@ Eigen::Matrix ReadCompl } bool _flag = false; Eigen::Matrix data_mat( - line_num * width, 2); // ǿ + line_num * width, 2); // 必须强制行优先 if (gdal_datatype == GDT_Byte) { Eigen::MatrixX real_mat(line_num * width, 1); Eigen::MatrixX imag_mat(line_num * width, 1); @@ -1751,14 +2040,14 @@ Eigen::Matrix ReadCompl } else { } - // + // 保存数据 if (_flag) { return data_mat; } else { return Eigen::Matrix( - 0, 0); // ǿ; + 0, 0); // 必须强制行优先; } } @@ -1767,10 +2056,10 @@ ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype, int band_idx) { - // 飬ʹeigen о㣬ټ + // 构建矩阵块,使用eigen 进行矩阵计算,加速计算 bool _flag = false; Eigen::Matrix data_mat( - line_num * width, 1); // ǿ + line_num * width, 1); // 必须强制行优先 if (gdal_datatype == GDT_Byte) { Eigen::MatrixX real_mat(line_num * width, 1); rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp index 302abc3..a20a9c5 100644 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp +++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp @@ -32,5 +32,10 @@ QString QToolAbstract::getToolName() } void QToolAbstract::excute() +{ + this->run(); +} + +void QToolAbstract::run() { } diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h index 5f00324..fda74f6 100644 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h +++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h @@ -27,6 +27,8 @@ public slots: public: QVector toolPath; QString toolname; +public: + virtual void run(); }; /* diff --git a/GPUBaseLib/GPUTool/GPUTool.cuh b/GPUBaseLib/GPUTool/GPUTool.cuh index 6c513e3..c2bd1d4 100644 --- a/GPUBaseLib/GPUTool/GPUTool.cuh +++ b/GPUBaseLib/GPUTool/GPUTool.cuh @@ -20,13 +20,15 @@ /** CUDA ò ************************************************************************************/ #define BLOCK_SIZE 256 #define SHAREMEMORY_BYTE 49152 -#define SHAREMEMORY_FLOAT_HALF 6144 -#define SHAREMEMORY_FLOAT_HALF_STEP 24 +#define SHAREMEMORY_FLOAT_HALF_STEP 2 +#define SHAREMEMORY_FLOAT_HALF 512 + #define SHAREMEMORY_DEM_STEP 768 #define SHAREMEMORY_Reflect 612 + enum LAMPGPUDATETYPE { LAMP_LONG, LAMP_FLOAT, diff --git a/LAMPDataProcess.sln b/LAMPDataProcess.sln index 1f54f80..0559e59 100644 --- a/LAMPDataProcess.sln +++ b/LAMPDataProcess.sln @@ -38,10 +38,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "Rast EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginToolboxLibrary", "pluginToolboxLibrary\pluginToolboxLibrary.vcxproj", "{667625A5-8DE2-4373-99F0-8BAD2CCED011}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -172,18 +172,6 @@ Global {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.Build.0 = Release|x64 {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64 {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.ActiveCfg = Debug|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.Build.0 = Debug|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|x64.ActiveCfg = Debug|x64 @@ -196,6 +184,18 @@ Global {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x64.Build.0 = Release|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.ActiveCfg = Release|Win32 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.Build.0 = Release|Win32 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp index eb4f02a..2cebd5e 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp @@ -14,7 +14,7 @@ #include "FileOperator.h" #include "RasterWidgetMessageShow.h" - +#include "ImageOperatorBase.h" #pragma execution_character_set("utf-8") @@ -46,7 +46,7 @@ RasterMainWidget::RasterMainWidget(QWidget *parent) mLayerList(), mLeftTop(), mRightBottom() { - this->setWindowTitle(tr(u8"LAMP影像处理软件")); + this->setWindowTitle(tr(u8"大场景仿真组件")); mUi->setupUi(dynamic_cast(this)); setupWindow(); setupTaskWindow(); @@ -59,6 +59,14 @@ RasterMainWidget::RasterMainWidget(QWidget *parent) //mUi->layerList->setCurrentItem(mLayerList.first()); + connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered())); + + this->mUi->toolBar->hide(); + this->mUi->dockWidget_Map->hide(); + this->mUi->dockWidget->hide(); + this->mUi->statusbar->hide(); + this->mUi->dockWidget_2->hide(); + this->mUi->dockWidget_3->hide(); } @@ -341,6 +349,11 @@ void RasterMainWidget::on_addPlaneaction_triggered() mMapConvas->selectTool("addplane_tool"); } +void RasterMainWidget::onactioncloseAllRasterFile_triggered() +{ + CloseAllGDALRaster(); +} + QTableWidget* RasterMainWidget::getTaskTable() { return this->mUi->taskTable; diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h index a64eb49..f4f3316 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h @@ -77,7 +77,7 @@ namespace LAMPMainWidget { private slots: void on_drawArea_triggered(); void on_addPlaneaction_triggered(); - + void onactioncloseAllRasterFile_triggered(); private: Ui::RasterMainWidget* mUi; MapCanvas* mMapConvas; diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui index af85019..e317cec 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui @@ -31,111 +31,15 @@ - - - - - - 0 - 0 - - - - 0 - - - - 地图 - - - - - - - - - - 任务 - - - - - 0 - 0 - 1431 - 871 - - - - - - - - - - - - + - - - - 0 - 0 - 906 - 23 - - - - - 项目 - - - - - 编辑 - - - - - 视图 - - - - - 图层 - - - - - 设置 - - - - - 工具 - - - - - 帮助 - - - - - - - - - - - - - + + false + toolBar @@ -377,6 +281,85 @@ p, li { white-space: pre-wrap; } + + + Qt::LeftToRight + + + 地图窗口 + + + 1 + + + + + + 10 + 0 + 502 + 274 + + + + + 0 + 0 + + + + 0 + + + + 地图 + + + + + + + + + + 任务 + + + + + 0 + 0 + 1431 + 871 + + + + + + + + + + + + + + + + 0 + 0 + 906 + 23 + + + + + 工具 + + + + + 使用教程 @@ -513,6 +496,11 @@ p, li { white-space: pre-wrap; } 飞机 + + + 释放影像文件 + + diff --git a/RasterProcessToolWidget/ToolBoxWidget.cpp b/RasterProcessToolWidget/ToolBoxWidget.cpp index 5bb44ae..d0a9ae4 100644 --- a/RasterProcessToolWidget/ToolBoxWidget.cpp +++ b/RasterProcessToolWidget/ToolBoxWidget.cpp @@ -25,6 +25,7 @@ ToolBoxWidget::ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows, QWid ui->setupUi(this); setContextMenuPolicy(Qt::CustomContextMenu); // Ҽݲ˵ QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*))); + QObject::connect(this, SIGNAL(addBoxToolItemInPathSIGNAL(QVector , QToolAbstract* )), this, SLOT(addBoxToolItemInPathSLOT(QVector, QToolAbstract * ))); } @@ -122,6 +123,37 @@ void ToolBoxWidget::addBoxToolItemSLOT(QToolAbstract* item) } +void ToolBoxWidget::addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item) +{ + QString toolName = item->getToolName(); + + QTreeWidgetItem* parentItem = findOrCreateParentItem(xnodepath); + + // øǷѾ toolButton + if (parentItem && ui->treeWidgetToolBox->itemWidget(parentItem, 0) == nullptr) { + + toollist.append(QToolboxTreeWidgetItem(ui->treeWidgetToolBox, parentItem, item)); + + + //QTreeWidgetItem* actionItem = new QTreeWidgetItem(parentItem); + //parentItem->addChild(actionItem); + //actionItem->setText(0,toolName); + //QIcon icon(QString::fromUtf8(":/ToolBoxWidget/toolicon")); + //QPushButton* button = new QPushButton(ui->treeWidgetToolBox); + //button->setIcon(icon); + //button->setText(toolName); + //button->setLayoutDirection(Qt::LeftToRight); + //button->setStyleSheet("QPushButton { text-align: left; }"); + //ui->treeWidgetToolBox->setItemWidget(actionItem, 0, button); + //connect(button, SIGNAL(clicked()), item, SLOT(excute())); + //item->setParent(ui->treeWidgetToolBox); + //qDebug() << "ToolButton bound to parent:" << actionItem->text(0); + } + else { + qDebug() << "ToolButton already bound to parent:" << parentItem->text(0); + } +} + // ·һ򴴽 QTreeWidgetItem* ToolBoxWidget::findOrCreateParentItem( QVector& path) { QTreeWidgetItem* currentItem = nullptr; @@ -171,7 +203,17 @@ QTreeWidgetItem* ToolBoxWidget::findChildItemByName(QTreeWidgetItem* parentItem, return childItem; } } - return nullptr; + + + // ûҵµĶڵ + QTreeWidgetItem* newItem = new QTreeWidgetItem(parentItem); + QIcon icon(QString::fromUtf8(":/RasterProcessTool/toolboxIcon")); + newItem->setIcon(0, icon); + newItem->setTextAlignment(0, Qt::AlignLeft); + newItem->setText(0, name); + parentItem->addChild(newItem); + return newItem; + // return nullptr; } void ToolBoxWidget::OpenToolboxManagerWidget() diff --git a/RasterProcessToolWidget/ToolBoxWidget.h b/RasterProcessToolWidget/ToolBoxWidget.h index 39f7c48..fc84b7b 100644 --- a/RasterProcessToolWidget/ToolBoxWidget.h +++ b/RasterProcessToolWidget/ToolBoxWidget.h @@ -49,9 +49,11 @@ private: signals: void addBoxToolItemSIGNAL(QToolAbstract* item); + void addBoxToolItemInPathSIGNAL(QVector xnodepath, QToolAbstract* item); public slots: void addBoxToolItemSLOT(QToolAbstract* item); + void addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item); QTreeWidgetItem* findOrCreateParentItem( QVector& path); QTreeWidgetItem* findOrCreateTopLevelItem( QString& name); QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name); diff --git a/Toolbox/BaseToolbox/BaseToolbox.cpp b/Toolbox/BaseToolbox/BaseToolbox.cpp index 1bad4fa..22ed9c8 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox.cpp @@ -13,6 +13,9 @@ #include "QResampleRefrenceRaster.h" #include "QtLookTableCorrectOffsetDialog.h" #include "QtCreateGPSPointsDialog.h" +#include "RasterVRT2ENVIdataDialog.h" + +#include "SARSatalliteSimulationWorkflow.h" // 󳡾 GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent) { @@ -115,6 +118,19 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QResampleRefrenceRasterToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new RasterVRT2ENVIdataDialogToolButton(toolbox)); + + + // 󳡾 +#ifdef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + initBaseToolSARSateSimulationWorkflow(toolbox); +#endif // __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + + + + + + } QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent) @@ -215,4 +231,21 @@ void QCreateGPSPointsToolButton::excute() { QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog; dialog->show(); -} \ No newline at end of file +} + +RasterVRT2ENVIdataDialogToolButton::RasterVRT2ENVIdataDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8""); + this->toolname = QString(u8"vrtļתenviݸʽ"); +} + +RasterVRT2ENVIdataDialogToolButton::~RasterVRT2ENVIdataDialogToolButton() +{ +} + +void RasterVRT2ENVIdataDialogToolButton::run() +{ + RasterVRT2ENVIdataDialog* dialog = new RasterVRT2ENVIdataDialog; + dialog->show(); +} diff --git a/Toolbox/BaseToolbox/BaseToolbox.h b/Toolbox/BaseToolbox/BaseToolbox.h index 5c15ea7..42a024b 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.h +++ b/Toolbox/BaseToolbox/BaseToolbox.h @@ -10,6 +10,8 @@ namespace LAMPMainWidget { class ToolBoxWidget; +extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + class BASETOOLBOX_EXPORT GF3ImportDataToolButton : public QToolAbstract { Q_OBJECT public: @@ -132,4 +134,18 @@ public slots: }; -extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + + + + +class BASETOOLBOX_EXPORT RasterVRT2ENVIdataDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + RasterVRT2ENVIdataDialogToolButton(QWidget* parent = nullptr); + ~RasterVRT2ENVIdataDialogToolButton(); +public : + virtual void run() override; + +}; + + diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 5384b55..1ace8fc 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -60,12 +60,12 @@ tools_qt5 - core + core;gui;widgets debug tools_qt5 - core + core;gui;widgets debug @@ -122,6 +122,7 @@ true stdcpp14 stdc11 + Disabled @@ -207,10 +208,13 @@ + + + @@ -225,6 +229,7 @@ + @@ -246,6 +251,7 @@ + diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters index 03e37b6..dbe0ff5 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters @@ -106,6 +106,12 @@ BaseToolbox + + BaseToolbox + + + Source Files + @@ -147,6 +153,12 @@ BaseToolbox + + BaseToolbox + + + Header Files + @@ -185,5 +197,8 @@ BaseToolbox + + BaseToolbox + \ No newline at end of file diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp index 76188ba..aadbd71 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp @@ -26,7 +26,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub double quayCoff = Qualifyvalue * 1.0 / 32767; double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20)); - qDebug() << "ϵ:\t" << quayCoff / caliCoff; + qDebug() << u8"ϵ:\t" << quayCoff / caliCoff; long startrow = 0; for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { @@ -37,7 +37,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff; outraster.saveImage(imgArr, startrow, 0, 1); } - qDebug() << "Ӱд뵽" << outRasterPath; + qDebug() << u8"Ӱд뵽" << outRasterPath; return ErrorCode::SUCCESS; } @@ -80,29 +80,29 @@ ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterP QString outRasterpath = l1dataset.getImageRasterPath(); ErrorCode errorcode = ErrorCode::SUCCESS; - qDebug() << ":\t" << inRasterPath; + qDebug() << u8":\t" << inRasterPath; switch (polsartype) { case POLARHH: - qDebug() << "HH"; + qDebug() << u8"HH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst); break; case POLARHV: - qDebug() << "HH"; + qDebug() << u8"HH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst); break; case POLARVH: - qDebug() << "VH"; + qDebug() << u8"VH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst); break; case POLARVV: - qDebug() << "VV"; + qDebug() << u8"VV"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst); break; default: break; } - qDebug() << "״̬\t" << QString::fromStdString(errorCode2errInfo(errorcode)); + qDebug() << u8"״̬\t" << QString::fromStdString(errorCode2errInfo(errorcode)); return errorcode; } @@ -115,7 +115,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath) // ȡ·ڵĿ¼ QDir directory(absPath); if (!directory.exists()) { - qDebug() << "Directory does not exist:" << directory.absolutePath(); + qDebug() << u8"Directory does not exist:" << directory.absolutePath(); return QVector(0); } @@ -124,7 +124,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath) filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF"; QStringList files = directory.entryList(filters, QDir::Files); - qDebug() << "TIFF Files in the directory" << directory.absolutePath() << ":"; + qDebug() << u8"TIFF Files in the directory" << directory.absolutePath() << ":"; QVector filepath(0); for (long i = 0; i < files.count(); i++) { @@ -144,7 +144,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName) if (match.hasMatch()) { polarization = match.captured(1); polarization = polarization.toLower().replace("_", ""); - qDebug() << "Polarization extracted:" << polarization; + qDebug() << u8"Polarization extracted:" << polarization; if (polarization == "hh") { return POLARTYPEENUM::POLARHH; } @@ -162,7 +162,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName) } } else { - qDebug() << "No polarization found in the path."; + qDebug() << u8"No polarization found in the path."; return POLARTYPEENUM::POLARUNKOWN; } @@ -199,7 +199,7 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) break; } if (errorcode == ErrorCode::SUCCESS) { - return errorcode; + continue; } else { QMessageBox::warning(nullptr, u8"", u8"ݵ"); @@ -209,94 +209,10 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) return errorcode; } -ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); - imgArrb1 = imgArr.array().abs(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "Ӱд뵽" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); - imgArrb1 = imgArr.array().arg(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "Ӱд뵽" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); - imgArrb1 = imgArr.array().abs().log10() * 20.0; - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "Ӱд뵽" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy) -{ - double gridlat = gridy / 110000.0; - double gridlon = gridx / 100000.0; - - long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); - if (espgcode == 4326) { - resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); - return ErrorCode::SUCCESS; - } - else { - QMessageBox::warning(nullptr, u8"", u8"WGS84DEMӰ"); - return ErrorCode::FAIL; - } -} - ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4) { - double dt = 1e-6; + double dt = 1e-4; double inct = 0; bool antfalg = false; double timeR2 = 0; @@ -315,21 +231,24 @@ ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, dou for (int i = 0; i < 50; i++) { polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg); R1 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2)); - dplerTheory1 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R1); - dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; + //dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0)); + dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + 0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0)); + dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; // GF3 㹫ʽ dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4; timeR2 = timeR + dt; polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg); R2 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2)); - dplerTheory2 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R2); - dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; - dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4; - - inct = dt * (dplerTheory2 - dplerNumber1) / (dplerTheory1 - dplerTheory2); - if (std::abs(dplerTheory1 - dplerTheory2) < 1e-9 || std::abs(inct) < dt) { + //dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0)); + dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx +0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0)); + //dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; // GF3 㹫ʽ + //dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4; + + inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1); + if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) { break; } + inct = std::abs(inct) < 10 ?inct:inct*1e-2; timeR = timeR - inct; } R = R1; // б @@ -349,7 +268,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z gdalImage localincangleRaster; if (localincAngleFlag) { - localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z + localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 1, demxyz.gt, demxyz.projection, true, true);// X,Y,Z } @@ -363,44 +282,64 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out double d3 = dopplers[3]; double d4 = dopplers[4]; - double fs = l1dataset.getFs();// Fs - double prf = (l1dataset.getEndImageTime() - l1dataset.getStartImageTime()) / (l1dataset.getrowCount() - 1);// PRF + double fs = l1dataset.getFs()*1e6;// Fs + double prf = l1dataset.getPRF();// PRF double nearRange = l1dataset.getNearRange(); double imagestarttime = l1dataset.getStartImageTime(); + double imageendtime = l1dataset.getEndImageTime(); double refrange = l1dataset.getRefRange(); - double lamda = (LIGHTSPEED*1e-6)/ l1dataset.getCenterFreq(); + double lamda = (LIGHTSPEED*1.0e-9)/ l1dataset.getCenterFreq(); + // ӡ + qDebug() << "Fs:\t" << fs; + qDebug() << "prf:\t" << prf; + qDebug() << "nearRange:\t" << nearRange; + qDebug() << "imagestarttime:\t" << imagestarttime; + qDebug() << "imageendtime:\t" << imageendtime; + qDebug() << "refrange:\t" << refrange; + qDebug() << "lamda:\t" << lamda; + //ӡ۲ + qDebug() << u8"-----------------------------------"; + qDebug() << u8"ղ\n"; + qDebug() << u8"d0:\t" << d0; + qDebug() << u8"d1:\t" << d1; + qDebug() << u8"d2:\t" << d2; + qDebug() << u8"d3:\t" << d3; + qDebug() << u8"d4:\t" << d4; + qDebug() << u8"-----------------------------------"; // ģ GF3PolyfitSatelliteOribtModel polyfitmodel; QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos(); - polyfitmodel.setSatelliteOribtStartTime(imagestarttime); + polyfitmodel.setSatelliteOribtStartTime((imagestarttime+imageendtime)/2); for (long i = 0; i < antposes.size(); i++) { - SatelliteOribtNode node; - node.time = antposes[i].time; - node.Px = antposes[i].Px; - node.Py = antposes[i].Py; - node.Pz = antposes[i].Pz; - node.Vx = antposes[i].Vx; - node.Vy = antposes[i].Vy; - node.Vz = antposes[i].Vz; - polyfitmodel.addOribtNode(node); + if (antposes[i].time > imagestarttime - 5 && antposes[i].time < imageendtime + 5) { + SatelliteOribtNode node; + node.time = antposes[i].time; + node.Px = antposes[i].Px; + node.Py = antposes[i].Py; + node.Pz = antposes[i].Pz; + node.Vx = antposes[i].Vx; + node.Vy = antposes[i].Vy; + node.Vz = antposes[i].Vz; + polyfitmodel.addOribtNode(node); + } } polyfitmodel.polyFit(3, false); qDebug() << "-----------------------------------"; - qDebug() << "satellite polyfit model params:\n"; + qDebug() << u8"satellite polyfit model params:\n"; qDebug() << polyfitmodel.getSatelliteOribtModelParamsString(); qDebug() << "-----------------------------------"; // ʼұ //1.ֿ long cpucore_num = std::thread::hardware_concurrency(); - long blockline = Memory1MB * 500 / 8 / cpucore_num / 4 / l1dataset.getcolCount(); - blockline = blockline < 50 ? 50 : blockline; + long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 8000; + blocklineinit = blocklineinit < 50 ? 50 : blocklineinit; //2. - long colcount = l1dataset.getcolCount(); - long rowcount = l1dataset.getrowCount(); + long colcount = rasterRC.width;//l1dataset.getcolCount(); + long rowcount = rasterRC.height;//l1dataset.getrowCount(); long startRId = 0; long processNumber = 0; @@ -417,33 +356,41 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out -#pragma omp parallel for num_threads(cpucore_num-1) - for (startRId = 0; startRId < rowcount; startRId = startRId + blockline) { + + for (startRId = 0; startRId < rowcount; startRId = startRId + blocklineinit) { + long blockline = blocklineinit; + if (startRId + blockline > rowcount) { + blockline = rowcount - startRId; + } Eigen::MatrixXd sar_r = rasterRC.getData(startRId, 0, blockline, colcount, 1); Eigen::MatrixXd sar_c = rasterRC.getData(startRId, 0, blockline, colcount, 2); Eigen::MatrixXd dem_x = demxyz.getData(startRId, 0, blockline, colcount, 1); Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2); Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3); - // ص - double timeR = 0; + long blockrows = sar_r.rows(); long blockcols = sar_r.cols(); - double tx = 0; - double ty = 0; - double tz = 0; - double R = 0; - double slopex=0, slopey=0, slopez=0; - SatelliteOribtNode node{0,0,0,0,0,0,0,0}; - bool antflag = false; + +#pragma omp parallel for for (long i = 0; i < blockrows; i++) { + // ص + double timeR = 0; + double tx = 0; + double ty = 0; + double tz = 0; + double R = 0; + double slopex = 0, slopey = 0, slopez = 0; + SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 }; + bool antflag = false; for (long j = 0; j < blockcols; j++) { + tx = dem_x(i, j); ty = dem_y(i, j); tz = dem_z(i, j); if (RD_PSTN(refrange,lamda, timeR,R,tx,ty,tz,slopex,slopey,slopez,polyfitmodel,node,d0,d1,d2,d3,d4) == ErrorCode::SUCCESS) { - sar_r(i, j) = timeR * prf; - sar_c(i, j) = ((R - nearRange) / 2 / LIGHTSPEED) * fs; + sar_r(i, j) =( timeR+ (imagestarttime + imageendtime) / 2 -imagestarttime) * prf; + sar_c(i, j) = ((R - nearRange) * 2 / LIGHTSPEED) * fs; } else { sar_r(i, j) = -1; @@ -452,6 +399,14 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out } } + // + omp_set_lock(&lock); + rasterRC.saveImage(sar_r, startRId, 0, 1); + rasterRC.saveImage(sar_c, startRId, 0, 2); + + omp_unset_lock(&lock); + + Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181; if (localincAngleFlag) { Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1); @@ -461,7 +416,20 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out double Rst_x = 0, Rst_y = 0, Rst_z = 0, localangle = 0; double slopeR = 0; +#pragma omp parallel for for (long i = 0; i < blockrows; i++) { + // ص + double timeR = 0; + double tx = 0; + double ty = 0; + double tz = 0; + double R = 0; + double slopex = 0, slopey = 0, slopez = 0; + SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 }; + bool antflag = false; + + + for (long j = 0; j < blockcols; j++) { timeR = sar_r(i, j) / prf; slopex = demslope_x(i, j); @@ -482,18 +450,25 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out Angle_Arr(i, j) = localangle; } } + + // + omp_set_lock(&lock); + + if (localincAngleFlag) { + localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); + } + else {} + + omp_unset_lock(&lock); + } + // omp_set_lock(&lock); - rasterRC.saveImage(sar_r, startRId, 0, 1); - rasterRC.saveImage(sar_c, startRId, 0, 2); - if (localincAngleFlag) { - localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); - } - else {} + processNumber = processNumber + blockrows; - qDebug() << "\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t"; + qDebug() << u8"\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t"; if (progressDialog.maximum() <= processNumber) { processNumber = progressDialog.maximum() - 1; } @@ -511,16 +486,17 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out gdalImage slcRaster(inRasterPath);// gdalImage looktableRaster(inlooktablePath);// - gdalImage outRaster(outRasterPath);// + gdalImage outRaster = CreategdalImage(outRasterPath, looktableRaster.height, looktableRaster.width, 1, looktableRaster.gt, looktableRaster.projection, true, true);// X,Y,Z + //gdalImage outRaster(outRasterPath);// if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) { - qDebug() << "look table size is not same as outRaster size"<< looktableRaster.height <<"!="< SearchGF3DataTiff(QString inMetaxmlPath); POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName); ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath); -// תʵ -ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath); -//תλ -ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath); -ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath); - -ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); // RD 㷨 ErrorCode RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4); @@ -36,6 +29,3 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out // 䴦 ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy); - - - diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp index b350012..735d954 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp @@ -66,7 +66,7 @@ QString GF3PolyfitSatelliteOribtModel::getSatelliteOribtModelParamsString() result += QString::number(this->polyfitVz[i], 'e', 6) + "\n"; } result += "------------------------------------------------------\n"; - + printf("%s\n", result.toUtf8().constData()); return result; } diff --git a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp index 90b6580..ea9936f 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp @@ -5,6 +5,7 @@ #include "BaseTool.h" #include "SARSimulationImageL1.h" #include "GF3CalibrationAndGeocodingClass.h" +#include "RasterToolBase.h" QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) : QDialog(parent) @@ -15,7 +16,8 @@ QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) QObject::connect(ui.radioButtonAmp,SIGNAL(toggled(bool)),this,SLOT(radioButtonAmptoggled(bool))); QObject::connect(ui.radioButtonPhase, SIGNAL(toggled(bool)), this, SLOT(radioButtonPhasetoggled(bool))); QObject::connect(ui.radioButtonSigma0, SIGNAL(toggled(bool)), this, SLOT(radioButtonSigma0toggled(bool))); - QObject::connect(ui.buttonBox, SIGNAL(accept()), this, SLOT(onaccept())); + QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); + QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); //toggled(bool ) } @@ -46,19 +48,19 @@ void QComplex2AmpPhase::onaccept() slcl1.Open(folderpath, filename); QString l2bfilename = filename + ui.lineEditHZ->text(); SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B); - slcl1.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount()); + l1B.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount()); QString srcxmlpath = slcl1.getxmlFilePath(); QString tarxmlpath = l1B.getxmlFilePath(); copyAndReplaceFile(srcxmlpath, tarxmlpath); l1B.loadFromXml(); if (ui.radioButtonAmp->isChecked()) { - Complex2AmpRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath()); } else if (ui.radioButtonPhase->isChecked()) { - Complex2PhaseRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2PhaseRaster(imgfilepath, l1B.getImageRasterPath()); } else if (ui.radioButtonSigma0->isChecked()) { - Complex2dBRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2dBRaster(imgfilepath, l1B.getImageRasterPath()); } progressDialog.setValue(i); } diff --git a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp index 12793e3..e6146f0 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp @@ -7,10 +7,9 @@ QImportGF3StripL1ADataset::QImportGF3StripL1ADataset(QWidget *parent) { ui.setupUi(this); - QListWidget* listWidgetMetaxml; - QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(clicked)),this,SLOT(onpushButtonAddClicked(bool))); - QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonRemoveClicked(bool))); - QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); + QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool))); + QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool))); + QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); diff --git a/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp b/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp index 6e4ad79..62a5ad5 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp @@ -14,10 +14,10 @@ QOrthSlrRaster::QOrthSlrRaster(QWidget *parent) connect(ui.pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool))); connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool))); - connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); - connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); + connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); + connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); - QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onreject())); + QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); } QOrthSlrRaster::~QOrthSlrRaster() @@ -61,7 +61,7 @@ void QOrthSlrRaster::onpushButtonAddClicked(bool) this, // tr(u8"ѡxmlļ"), // QString(), // Ĭ· - tr(u8"xml Files (*.xml);;All Files (*)") // ļ + tr(ENVI_FILE_FORMAT_FILTER) // ļ ); // ûѡļ diff --git a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp index 2ad3480..c9ec7cc 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp @@ -10,8 +10,8 @@ QRDOrthProcessClass::QRDOrthProcessClass(QWidget *parent) connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool))); connect(ui.pushButtonRemove,SIGNAL(clicked(bool)),this,SLOT(onpushButtonRemoveClicked(bool))); - connect(ui.pushButtonDEMSelect,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool))); - connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); + connect(ui.pushButtonWorkSpace,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool))); + connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); // QDialogButtonBox* buttonBox; diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp new file mode 100644 index 0000000..85964ab --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp @@ -0,0 +1,77 @@ +#include "RasterVRT2ENVIdataDialog.h" +#include "ui_RasterVRT2ENVIdataDialog.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageOperatorBase.h" + +RasterVRT2ENVIdataDialog::RasterVRT2ENVIdataDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::RasterVRT2ENVIdataDialogClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonVRTSelect, SIGNAL(clicked()), this, SLOT(onpushButtonVRTSelect_clicked())); + connect(ui->pushButtonENVIDatSelect, SIGNAL(clicked()), this, SLOT(onpushButtonENVIDatSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + +} + +RasterVRT2ENVIdataDialog::~RasterVRT2ENVIdataDialog() +{} + +void RasterVRT2ENVIdataDialog::onpushButtonVRTSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡL1Bļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditVRTPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void RasterVRT2ENVIdataDialog::onpushButtonENVIDatSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡENVIDataļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditENVIDatPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void RasterVRT2ENVIdataDialog::onbuttonBox_accepted() +{ + QString vrtrasterpath = ui->lineEditVRTPath->text(); + QString envidatapath = ui->lineEditENVIDatPath->text(); + + ConvertVrtToEnvi(vrtrasterpath, envidatapath); + + + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); +} + +void RasterVRT2ENVIdataDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h new file mode 100644 index 0000000..b4123c8 --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +namespace Ui { + class RasterVRT2ENVIdataDialogClass; +} + + +class RasterVRT2ENVIdataDialog : public QDialog +{ + Q_OBJECT + +public: + RasterVRT2ENVIdataDialog(QWidget *parent = nullptr); + ~RasterVRT2ENVIdataDialog(); + + +public slots: + void onpushButtonVRTSelect_clicked(); + void onpushButtonENVIDatSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); +private: + Ui::RasterVRT2ENVIdataDialogClass* ui; +}; diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui new file mode 100644 index 0000000..9e76517 --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui @@ -0,0 +1,126 @@ + + + RasterVRT2ENVIdataDialogClass + + + + 0 + 0 + 396 + 156 + + + + RasterVRT2ENVIdataDialog + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + vrt文件地址: + + + + + + + + 0 + 30 + + + + 输出dat地址: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp index 4cae6ee..5c8ae39 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp @@ -5,24 +5,41 @@ bool SatelliteGF3xmlParser::loadFile(const QString& filename) { QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Cannot open file:" << filename; + qWarning() << u8"Cannot open file:" << filename; return false; } QDomDocument doc; if (!doc.setContent(&file)) { file.close(); - qWarning() << "Failed to parse the file into a DOM tree."; + qWarning() << u8"Failed to parse the file into a DOM tree."; return false; } file.close(); xml = doc; + + this->parseAdditionalData(); + this->parseImageInfo(); + this->parsePlatform(); + this->parseGPS(); + + //ʱ + double tempreftime = start + (end - start) / 2; + for (long i = 0;i < antposs.size();i++) + { + antposs[i].time = antposs[i].time - tempreftime; + } + + start = start- tempreftime; + end = end- tempreftime; + + return true; } void SatelliteGF3xmlParser::parsePlatform() { - QDomElement platform = xml.firstChildElement("root").firstChildElement("platform"); + QDomElement platform = xml.firstChildElement("product").firstChildElement("platform"); if (!platform.isNull()) { CenterTime = platform.firstChildElement("CenterTime").text(); Rs = platform.firstChildElement("Rs").text().toDouble(); @@ -37,24 +54,24 @@ void SatelliteGF3xmlParser::parsePlatform() { Vys = platform.firstChildElement("Vys").text().toDouble(); Vzs = platform.firstChildElement("Vzs").text().toDouble(); - qDebug() << "Platform Data:"; - qDebug() << "CenterTime:" << CenterTime; - qDebug() << "Rs:" << Rs; - qDebug() << "satVelocity:" << satVelocity; - qDebug() << "RollAngle:" << RollAngle; - qDebug() << "PitchAngle:" << PitchAngle; - qDebug() << "YawAngle:" << YawAngle; - qDebug() << "Xs:" << Xs; - qDebug() << "Ys:" << Ys; - qDebug() << "Zs:" << Zs; - qDebug() << "Vxs:" << Vxs; - qDebug() << "Vys:" << Vys; - qDebug() << "Vzs:" << Vzs; + qDebug() << u8"Platform Data:"; + qDebug() << u8"CenterTime:" << CenterTime; + qDebug() << u8"Rs:" << Rs; + qDebug() << u8"satVelocity:" << satVelocity; + qDebug() << u8"RollAngle:" << RollAngle; + qDebug() << u8"PitchAngle:" << PitchAngle; + qDebug() << u8"YawAngle:" << YawAngle; + qDebug() << u8"Xs:" << Xs; + qDebug() << u8"Ys:" << Ys; + qDebug() << u8"Zs:" << Zs; + qDebug() << u8"Vxs:" << Vxs; + qDebug() << u8"Vys:" << Vys; + qDebug() << u8"Vzs:" << Vzs; } } void SatelliteGF3xmlParser::parseGPS() { - QDomElement GPS = xml.firstChildElement("root").firstChildElement("GPS"); + QDomElement GPS = xml.firstChildElement("product").firstChildElement("GPS"); if (!GPS.isNull()) { QDomNodeList GPSParams = GPS.elementsByTagName("GPSParam"); for (int i = 0; i < GPSParams.count(); ++i) { @@ -69,37 +86,52 @@ void SatelliteGF3xmlParser::parseGPS() { QString yVelocity = GPSParam.firstChildElement("yVelocity").text(); QString zVelocity = GPSParam.firstChildElement("zVelocity").text(); - QDateTime dateTime = QDateTime::fromString(TimeStamp, "yyyy-MM-dd HH:mm:ss.zzzzzz"); - satepos.time = dateTime.toMSecsSinceEpoch() / 1000.0; - satepos.Px = xPosition.toDouble(); - satepos.Py = yPosition.toDouble(); - satepos.Pz = zPosition.toDouble(); - satepos.Vx = xVelocity.toDouble(); - satepos.Vy = yVelocity.toDouble(); - satepos.Vz = zVelocity.toDouble(); + + TimestampMicroseconds dateTime = parseAndConvert(TimeStamp.toStdString()); + satepos.time = dateTime.msecsSinceEpoch / 1000.0 + dateTime.microseconds / 100000.0; + satepos.Px = xPosition.toDouble(); + satepos.Py = yPosition.toDouble(); + satepos.Pz = zPosition.toDouble(); + satepos.Vx = xVelocity.toDouble(); + satepos.Vy = yVelocity.toDouble(); + satepos.Vz = zVelocity.toDouble(); this->antposs.append(satepos); - qDebug() << "\nGPS Param Data:"; - qDebug() << "TimeStamp:" << TimeStamp; - qDebug() << "xPosition:" << xPosition; - qDebug() << "yPosition:" << yPosition; - qDebug() << "zPosition:" << zPosition; - qDebug() << "xVelocity:" << xVelocity; - qDebug() << "yVelocity:" << yVelocity; - qDebug() << "zVelocity:" << zVelocity; + qDebug() << u8"\nGPS Param Data:"; + qDebug() << u8"TimeStamp:" << TimeStamp; + qDebug() << u8"xPosition:" << xPosition; + qDebug() << u8"yPosition:" << yPosition; + qDebug() << u8"zPosition:" << zPosition; + qDebug() << u8"xVelocity:" << xVelocity; + qDebug() << u8"yVelocity:" << yVelocity; + qDebug() << u8"zVelocity:" << zVelocity; } } } void SatelliteGF3xmlParser::parseImageInfo() { - QDomElement imageinfo = xml.firstChildElement("root").firstChildElement("imageinfo"); + QDomElement imageinfo = xml.firstChildElement("product").firstChildElement("imageinfo"); if (!imageinfo.isNull()) { QDomElement imagingTime = imageinfo.firstChildElement("imagingTime"); - ; - start = QDateTime::fromString(imagingTime.firstChildElement("start").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch()/1000.0; - end = QDateTime::fromString(imagingTime.firstChildElement("end").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch() / 1000.0; - + + QString starttimestr = imagingTime.firstChildElement("start").text().trimmed(); + QString endtimestr = imagingTime.firstChildElement("end").text().trimmed(); + + TimestampMicroseconds starttime = parseAndConvert(starttimestr.toStdString()); + TimestampMicroseconds endtime = parseAndConvert(endtimestr.toStdString()); + + start = starttime.msecsSinceEpoch / 1000.0 + starttime.microseconds / 100000.0; + end = endtime.msecsSinceEpoch / 1000.0 + endtime.microseconds / 100000.0; + + // ӡstarttime,endtime + qDebug() << u8"ʼʱ(parse)" << starttime.msecsSinceEpoch << "\t" << starttime.microseconds; + qDebug() << u8"ʱ(parse)" << endtime.msecsSinceEpoch << "\t" << endtime.microseconds; + + qDebug() << u8"ʼʱ䣺" << start <<"\t"<< starttimestr; + qDebug() << u8"ʱ䣺" << end << "\t" << endtimestr; + + nearRange = imageinfo.firstChildElement("nearRange").text().toDouble(); refRange = imageinfo.firstChildElement("refRange").text().toDouble(); eqvFs = imageinfo.firstChildElement("eqvFs").text().toDouble(); @@ -154,35 +186,36 @@ void SatelliteGF3xmlParser::parseImageInfo() { incidenceAngleNearRange = imageinfo.firstChildElement("incidenceAngleNearRange").text().toDouble(); incidenceAngleFarRange = imageinfo.firstChildElement("incidenceAngleFarRange").text().toDouble(); - qDebug() << "\nImage Info Data:"; - qDebug() << "Start:" << start; - qDebug() << "End:" << end; - qDebug() << "Near Range:" << nearRange; - qDebug() << "Ref Range:" << refRange; - qDebug() << "Eqv Fs:" << eqvFs; - qDebug() << "Eqv PRF:" << eqvPRF; - qDebug() << "Center Latitude:" << latitude_center << ", Longitude:" << longitude_center; - qDebug() << "Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft; - qDebug() << "Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight; - qDebug() << "Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft; - qDebug() << "Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight; - qDebug() << "Width:" << width; - qDebug() << "Height:" << height; - qDebug() << "Width Space:" << widthspace; - qDebug() << "Height Space:" << heightspace; - qDebug() << "Scene Shift:" << sceneShift; - qDebug() << "Image Bit:" << imagebit; - qDebug() << "HH Qualify Value:" << HH_QualifyValue; - qDebug() << "HV Qualify Value:" << HV_QualifyValue; - qDebug() << "HH Echo Saturation:" << HH_echoSaturation; - qDebug() << "HV Echo Saturation:" << HV_echoSaturation; - qDebug() << "incidenceAngleNearRange:" << incidenceAngleNearRange; - qDebug() << "incidenceAngleFarRange:" << incidenceAngleFarRange; + qDebug() << u8"\nImage Info Data:"; + qDebug() << u8"Start:" << start; + qDebug() << u8"End:" << end; + qDebug() << u8"Near Range:" << nearRange; + qDebug() << u8"Ref Range:" << refRange; + qDebug() << u8"Eqv Fs:" << eqvFs; + qDebug() << u8"Eqv PRF:" << eqvPRF; + qDebug() << u8"Center Latitude:" << latitude_center << ", Longitude:" << longitude_center; + qDebug() << u8"Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft; + qDebug() << u8"Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight; + qDebug() << u8"Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft; + qDebug() << u8"Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight; + qDebug() << u8"Width:" << width; + qDebug() << u8"Height:" << height; + qDebug() << u8"Width Space:" << widthspace; + qDebug() << u8"Height Space:" << heightspace; + qDebug() << u8"Scene Shift:" << sceneShift; + qDebug() << u8"Image Bit:" << imagebit; + qDebug() << u8"HH Qualify Value:" << HH_QualifyValue; + qDebug() << u8"HV Qualify Value:" << HV_QualifyValue; + qDebug() << u8"HH Echo Saturation:" << HH_echoSaturation; + qDebug() << u8"HV Echo Saturation:" << HV_echoSaturation; + qDebug() << u8"incidenceAngleNearRange:" << incidenceAngleNearRange; + qDebug() << u8"incidenceAngleFarRange:" << incidenceAngleFarRange; } } void SatelliteGF3xmlParser::parseAdditionalData() { - QDomElement calibrationConst = xml.firstChildElement("root").firstChildElement("CalibrationConst"); + QDomElement processinfo = xml.firstChildElement("product").firstChildElement("processinfo"); + QDomElement calibrationConst = processinfo.firstChildElement("CalibrationConst"); if (!calibrationConst.isNull()) { bool HH_CalibrationConstISNULL=false; @@ -201,50 +234,50 @@ void SatelliteGF3xmlParser::parseAdditionalData() { - qDebug() << "\nCalibration Const Data:"; - qDebug() << "HH Calibration Const:" << HH_CalibrationConst; - qDebug() << "HV Calibration Const:" << HV_CalibrationConst; - qDebug() << "VH Calibration Const:" << VH_CalibrationConst; - qDebug() << "VV Calibration Const:" << VV_CalibrationConst; + qDebug() << u8"\nCalibration Const Data:"; + qDebug() << u8"HH Calibration Const:" << HH_CalibrationConst; + qDebug() << u8"HV Calibration Const:" << HV_CalibrationConst; + qDebug() << u8"VH Calibration Const:" << VH_CalibrationConst; + qDebug() << u8"VV Calibration Const:" << VV_CalibrationConst; } - AzFdc0 = xml.firstChildElement("root").firstChildElement("AzFdc0").text().toDouble(); - AzFdc1 = xml.firstChildElement("root").firstChildElement("AzFdc1").text().toDouble(); + AzFdc0 = processinfo.firstChildElement("AzFdc0").text().toDouble(); + AzFdc1 = processinfo.firstChildElement("AzFdc1").text().toDouble(); + QDomElement sensorNode = xml.firstChildElement("product").firstChildElement("sensor"); + sensorID = sensorNode.firstChildElement("sensorID").text(); + imagingMode = sensorNode.firstChildElement("imagingMode").text(); + lamda = sensorNode.firstChildElement("lamda").text().toDouble(); + RadarCenterFrequency = sensorNode.firstChildElement("RadarCenterFrequency").text().toDouble(); - sensorID = xml.firstChildElement("root").firstChildElement("sensorID").text(); - imagingMode = xml.firstChildElement("root").firstChildElement("imagingMode").text(); - lamda = xml.firstChildElement("root").firstChildElement("lamda").text().toDouble(); - RadarCenterFrequency = xml.firstChildElement("root").firstChildElement("RadarCenterFrequency").text().toDouble(); + TotalProcessedAzimuthBandWidth = processinfo.firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble(); + DopplerParametersReferenceTime = processinfo.firstChildElement("DopplerParametersReferenceTime").text().toDouble(); - TotalProcessedAzimuthBandWidth = xml.firstChildElement("root").firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble(); - DopplerParametersReferenceTime = xml.firstChildElement("root").firstChildElement("DopplerParametersReferenceTime").text().toDouble(); - - QDomElement dopplerCentroidCoefficients = xml.firstChildElement("root").firstChildElement("DopplerCentroidCoefficients"); + QDomElement dopplerCentroidCoefficients = processinfo.firstChildElement("DopplerCentroidCoefficients"); d0 = dopplerCentroidCoefficients.firstChildElement("d0").text().toDouble(); d1 = dopplerCentroidCoefficients.firstChildElement("d1").text().toDouble(); d2 = dopplerCentroidCoefficients.firstChildElement("d2").text().toDouble(); d3 = dopplerCentroidCoefficients.firstChildElement("d3").text().toDouble(); d4 = dopplerCentroidCoefficients.firstChildElement("d4").text().toDouble(); - QDomElement dopplerRateValuesCoefficients = xml.firstChildElement("root").firstChildElement("DopplerRateValuesCoefficients"); + QDomElement dopplerRateValuesCoefficients = processinfo.firstChildElement("DopplerRateValuesCoefficients"); r0 = dopplerRateValuesCoefficients.firstChildElement("r0").text().toDouble(); r1 = dopplerRateValuesCoefficients.firstChildElement("r1").text().toDouble(); r2 = dopplerRateValuesCoefficients.firstChildElement("r2").text().toDouble(); r3 = dopplerRateValuesCoefficients.firstChildElement("r3").text().toDouble(); r4 = dopplerRateValuesCoefficients.firstChildElement("r4").text().toDouble(); - DEM = xml.firstChildElement("root").firstChildElement("DEM").text().toDouble(); + DEM = processinfo.firstChildElement("DEM").text().toDouble(); - qDebug() << "\nAdditional Data:"; - qDebug() << "AzFdc0:" << AzFdc0; - qDebug() << "AzFdc1:" << AzFdc1; - qDebug() << "Sensor ID:" << sensorID; - qDebug() << "Imaging Mode:" << imagingMode; - qDebug() << "Lambda:" << lamda; - qDebug() << "Radar Center Frequency:" << RadarCenterFrequency; - qDebug() << "Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth; - qDebug() << "Doppler Parameters Reference Time:" << DopplerParametersReferenceTime; - qDebug() << "Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4; - qDebug() << "Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4; - qDebug() << "DEM:" << DEM; + qDebug() << u8"\nAdditional Data:"; + qDebug() << u8"AzFdc0:" << AzFdc0; + qDebug() << u8"AzFdc1:" << AzFdc1; + qDebug() << u8"Sensor ID:" << sensorID; + qDebug() << u8"Imaging Mode:" << imagingMode; + qDebug() << u8"Lambda:" << lamda; + qDebug() << u8"Radar Center Frequency:" << RadarCenterFrequency; + qDebug() << u8"Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth; + qDebug() << u8"Doppler Parameters Reference Time:" << DopplerParametersReferenceTime; + qDebug() << u8"Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4; + qDebug() << u8"Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4; + qDebug() << u8"DEM:" << DEM; } diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp new file mode 100644 index 0000000..a7d7db9 --- /dev/null +++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp @@ -0,0 +1,90 @@ +#include "SARSatalliteSimulationWorkflow.h" +#include "QtCreateGPSPointsDialog.h" +#include "QResampleRefrenceRaster.h" +#include "DEMLLA2XYZTool.h" + + +void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox) +{ + // 1. иɹڵ + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04"}, new TLE2SatePositionVelocityToolButton(toolbox)); + + // 3. Ӱ + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04"}, new QAligendLandClsAndDEMToolButton(toolbox)); + + + // 4. عʸӰ + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + + + + + + +} + +TLE2SatePositionVelocityToolButton::TLE2SatePositionVelocityToolButton(QWidget* parent) +{ + this->toolname = QString(u8" иɹڵ"); +} + +TLE2SatePositionVelocityToolButton::~TLE2SatePositionVelocityToolButton() +{ +} + +void TLE2SatePositionVelocityToolButton::run() +{ + QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog; + dialog->setWindowTitle(u8"иɹڵ"); + dialog->show(); +} + +QAligendLandClsAndDEMToolButton::QAligendLandClsAndDEMToolButton(QWidget* parent) +{ + this->toolname = QString(u8" Ӱ"); +} + +QAligendLandClsAndDEMToolButton::~QAligendLandClsAndDEMToolButton() +{ +} + +void QAligendLandClsAndDEMToolButton::run() +{ + QResampleRefrenceRaster* dialog = new QResampleRefrenceRaster; + dialog->setWindowTitle(u8"ΣݵդزӰ"); + dialog->show(); +} + +QDEMLLA2XYZSloperVectorToolButton::QDEMLLA2XYZSloperVectorToolButton(QWidget* parent) +{ + this->toolname = QString(u8" ɵĿʸ"); +} + +QDEMLLA2XYZSloperVectorToolButton::~QDEMLLA2XYZSloperVectorToolButton() +{ +} + +void QDEMLLA2XYZSloperVectorToolButton::run() +{ + DEMLLA2XYZTool* dialog = new DEMLLA2XYZTool(); + dialog->setWindowTitle(u8"ݵդɵĿʸ"); + dialog->show(); +} diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h new file mode 100644 index 0000000..9f447b9 --- /dev/null +++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h @@ -0,0 +1,64 @@ +#pragma once + + +#ifndef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ +#define __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + + +/** + * \file SARSatalliteSimulationWorkflow.h + * \brief 󳡾洦˵ + * + * \author 30453 + * \date April 2025 + * + **/ +#include "basetoolbox_global.h" +#include "ToolBoxWidget.h" + + +extern "C" BASETOOLBOX_EXPORT void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox); + + + + +class BASETOOLBOX_EXPORT TLE2SatePositionVelocityToolButton : public QToolAbstract { + Q_OBJECT +public: + TLE2SatePositionVelocityToolButton(QWidget* parent = nullptr); + ~TLE2SatePositionVelocityToolButton(); +public: + virtual void run() override; + +}; + + + +class BASETOOLBOX_EXPORT QAligendLandClsAndDEMToolButton : public QToolAbstract { + Q_OBJECT +public: + QAligendLandClsAndDEMToolButton(QWidget* parent = nullptr); + ~QAligendLandClsAndDEMToolButton(); +public : + virtual void run() override; + +}; + +class BASETOOLBOX_EXPORT QDEMLLA2XYZSloperVectorToolButton : public QToolAbstract { + Q_OBJECT +public: + QDEMLLA2XYZSloperVectorToolButton(QWidget* parent = nullptr); + ~QDEMLLA2XYZSloperVectorToolButton(); +public: + virtual void run() override; + +}; + + + + + +#endif + + + diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu index 6d6e7ef..2252520 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu @@ -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 << > > ( + 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); diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh index 1ce140e..a697719 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh @@ -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 +); \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp new file mode 100644 index 0000000..38004a5 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp @@ -0,0 +1,95 @@ +#include "QLookTableResampleFromWGS84ToRange.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include +#include +#include "ui_QLookTableResampleFromWGS84ToRange.h" +#include "ImageNetOperator.h" + +QLookTableResampleFromWGS84ToRange::QLookTableResampleFromWGS84ToRange(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QLookTableResampleFromWGS84ToRangeClass) +{ + ui->setupUi(this); + + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected())); + connect(ui->pushButtonLookTableWGS84Select, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableWGS84SelectClicked(bool))); + connect(ui->pushButtonLookTableRangeSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableRangeSelectClicked(bool))); + connect(ui->pushButtonLookTableCountSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableCountSelectClicked(bool))); +} + +QLookTableResampleFromWGS84ToRange::~QLookTableResampleFromWGS84ToRange() +{} + +void QLookTableResampleFromWGS84ToRange::onaccepted() +{ + QString looktableWGS84Ptah = ui->lineEditLookTableWGS84Path->text(); + QString looktableRangePtah = ui->lineEditLookTableRangePath->text(); + QString looktableCountPtah = ui->lineEditLookTableCountPath->text(); + + long Oriheight = ui->spinBoxRowCount->value(); + long OriWidth = ui->spinBoxColCount->value(); + + ReflectTable_WGS2Range(looktableWGS84Ptah, looktableRangePtah, looktableCountPtah, Oriheight, OriWidth); + QMessageBox::information(nullptr, u8"ʾ", u8""); +} + +void QLookTableResampleFromWGS84ToRange::onrejected() +{ + this->close(); +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableWGS84SelectClicked(bool) +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"ѡWGS84ļ"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditLookTableWGS84Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableRangeSelectClicked(bool) +{ + QString fileNames = QFileDialog::getSaveFileName( + this, + tr(u8"бƽļ"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditLookTableRangePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableCountSelectClicked(bool) +{ + QString fileNames = QFileDialog::getSaveFileName( + this, + tr(u8"ͳƲƽļ"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditLookTableCountPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h new file mode 100644 index 0000000..6f90bf2 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h @@ -0,0 +1,30 @@ +#pragma once + +#include + + +namespace Ui { + class QLookTableResampleFromWGS84ToRangeClass; +} + +class QLookTableResampleFromWGS84ToRange : public QDialog +{ + Q_OBJECT + +public: + QLookTableResampleFromWGS84ToRange(QWidget *parent = nullptr); + ~QLookTableResampleFromWGS84ToRange(); + + +public slots: + + void onaccepted(); + void onrejected(); + void onpushButtonLookTableWGS84SelectClicked(bool); + void onpushButtonLookTableRangeSelectClicked(bool); + void onpushButtonLookTableCountSelectClicked(bool); + + +private: + Ui::QLookTableResampleFromWGS84ToRangeClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui new file mode 100644 index 0000000..42e6ae2 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui @@ -0,0 +1,201 @@ + + + QLookTableResampleFromWGS84ToRangeClass + + + + 0 + 0 + 747 + 293 + + + + QLookTableResampleFromWGS84ToRange + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 行数 + + + + + + + + 0 + 30 + + + + 查找表(斜距) + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 查找表(WGS84) + + + + + + + + 0 + 30 + + + + 查找表采样点数 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 列数 + + + + + + + + 0 + 30 + + + + 999999999 + + + + + + + + 0 + 30 + + + + 999999999 + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu new file mode 100644 index 0000000..c5e94a2 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu @@ -0,0 +1,204 @@ +#include "GPUBaseTool.h" +#include "GPUBPTool.cuh" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BaseConstVariable.h" +#include "GPUBPImageNet.cuh" + +#ifndef MAX_ITER +#define EPSILON 1e-12 +#define MAX_ITER 50 +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + + +__global__ void kernel_TimeBPImageGridNet( + double* antPx, double* antPy, double* antPz, + double* antDirx, double* antDiry, double* antDirz, + double* imgx, double* imgy, double* imgz, + long prfcount, long freqpoints, double meanH, + double Rnear, double dx) { + + long idx = blockIdx.x * blockDim.x + threadIdx.x; + long pixelcount = prfcount * freqpoints; + long prfid = idx / freqpoints; + long Rid = idx % freqpoints; + if (idx < pixelcount) { + // + Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // λ (m) + Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // ߷ + double H = meanH; // ƽ߳ + double R = Rnear + dx * Rid; // Ŀ + // У + if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) { + //printf("\n HΧ%.1f km\n R>0\n", WGS84_A * 0.1 / 1000); + imgx[idx] = 0; + imgy[idx] = 0; + imgz[idx] = 0; + return; + //printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f,imgP=[%f ,%f , %f ];Rextend\n", + // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,imgx[idx],imgy[idx],imgz[idx]); + // У + //return; + } + + // Step 1: 㽻T + Vector3 T = compute_T(S, ray, H); + if (isnan(T.x)) { + imgx[idx] = 0; + imgy[idx] = 0; + imgz[idx] = 0; + //printf("idx=%d;prfid=%d;Rid=%d;Tnan\n", + // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,T.x,T.y,T.z, imgx[idx], imgy[idx], imgz[idx]); + return; + } + + // Step 2: ĿP + + Vector3 P;// = compute_P(S, T, R, H); + { // P + Vector3 ex, ey, ez; // ƽ + Vector3 ST = vec_normalize(vec_sub(T, S));// S->T + Vector3 SO = vec_normalize(vec_sub(Vector3{ 0, 0, 0 }, S)); // S->O + + + Vector3 st1 = vec_sub(T, S); + double R0 = sqrt(st1.x * st1.x + st1.y * st1.y + st1.z * st1.z); + ez = vec_normalize(vec_cross(SO, ST)); // Z + ey = vec_normalize(vec_cross(ez, SO)); // Y ST ͬ --ǵؼԼȻģ + ex = vec_normalize(SO); //X + + + + double h2 = (WGS84_A + H) * (WGS84_A + H); + double b2 = WGS84_B * WGS84_B; + double R2 = R * R; + double A = R2 * ((ex.x * ex.x + ex.y * ex.y) / h2 + (ex.z * ex.z) / b2); + double B = R2 * ((ex.x * ey.x + ex.y * ey.y) / h2 + (ex.z * ey.z) / b2) * 2; + double C = R2 * ((ey.x * ey.x + ey.y * ey.y) / h2 + (ey.z * ey.z) / b2); + double D = 1 - ((S.x * S.x + S.y * S.y) / h2 + (S.z * S.z) / b2); + double E = 2 * R * ((S.x * ex.x + S.y * ex.y) / h2 + (S.z * ex.z) / b2); + double F = 2 * R * ((S.x * ey.x + S.y * ey.y) / h2 + (S.z * ey.z) / b2); + double Q0 = angleBetweenVectors(SO, ST, false); + double dQ = 0; + double fQ = 0; + double dfQ = 0; + double Q = R < R0 ? Q0 - 1e-3 : Q0 + 1e-3; + + //printf("A=%f;B=%f;C=%f;D=%f;E=%f;F=%f;Q=%f;\ + // S=[%f , %f ,%f ];\ + // T=[%f , %f ,%f ];\ + // ex=[%f , %f ,%f ];\ + // ey=[%f , %f ,%f ];\ + // ez=[%f , %f ,%f ];\ + //ray=[%f ,%f ,%f ];\ + //H=%f;R=%f;;\n",A,B,C,D,E,F,Q, + // S.x,S.y,S.z, + // T.x,T.y,T.z , + // ex.x,ex.y,ex.z, + // ey.x,ey.y,ey.z, + // ez.x,ez.y,ez.z, + // ray.x, ray.y, ray.z, + // H, R); + // return; + + // ţٵ + for (int iter = 0; iter < MAX_ITER * 10; ++iter) { + fQ = A * cos(Q) * cos(Q) + B * sin(Q) * cos(Q) + C * sin(Q) * sin(Q) + E * cos(Q) + F * sin(Q) - D; + dfQ = (C - A) * sin(2 * Q) + B * cos(2 * Q) - E * sin(Q) + F * cos(Q); + dQ = fQ / dfQ; + if (abs(dQ) < 1e-8) { + //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;break\n", iter, Q0, Q, dQ, fQ, dfQ); + break; + } + else { + dQ = (abs(dQ) < d2r * 3) ? dQ : (abs(dQ) / dQ * d2r * 3); + Q = Q - dQ; + //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;\n", iter, Q0, Q, dQ, fQ, dfQ); + } + + } + //printf("check Q0=%f;Q=%f;\n", Q0, Q); + double t1 = R * cos(Q); + double t2 = R * sin(Q); + P = Vector3{ + S.x + t1 * ex.x + t2 * ey.x, //Ϊ t3=0 + S.y + t1 * ex.y + t2 * ey.y, + S.z + t1 * ex.z + t2 * ey.z, + }; + double check = (P.x * P.x + P.y * P.y) / ((WGS84_A + H) * (WGS84_A + H)) + + P.z * P.z / (WGS84_B * WGS84_B); + if (isnan(Q) || isinf(Q) || fabs(check - 1.0) > 1e-6) { + P = Vector3{ 0,0,0 }; + imgx[idx] = 0; + imgy[idx] = 0; + imgz[idx] = 0; + return; + } + } + + double Rt = sqrt(pow(S.x - T.x, 2) + pow(S.y - T.y, 2) + pow(S.z - T.z, 2)); + double Rp = sqrt(pow(S.x - P.x, 2) + pow(S.y - P.y, 2) + pow(S.z - P.z, 2)); + double Rop = sqrt(pow(P.x, 2) + pow(P.y, 2) + pow(P.z, 2)); + + if (!isnan(P.x) && (Rop > WGS84_A * 0.3) && (Rop < WGS84_A * 3)) { + + imgx[idx] = P.x; + imgy[idx] = P.y; + imgz[idx] = P.z; + return; + //printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; \n", + // idx, S.x, S.y, S.z, H, R, Rp, Rt,T.x, T.y, T.z, P.x, P.y, P.z); + } + else { + imgx[idx] = 0; + imgy[idx] = 0; + imgz[idx] = 0; + printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; ERROR\n", + idx, S.x, S.y, S.z, H, R, Rp, Rt, T.x, T.y, T.z, P.x, P.y, P.z); + return; + } + } + +} + + + + + + + + + + + + +void TIMEBPCreateImageGrid(double* antPx, double* antPy, double* antPz, + double* antDirx, double* antDiry, double* antDirz, + double* imgx, double* imgy, double* imgz, + long prfcount, long freqpoints, double meanH, + double Rnear, double dx +) +{ + long pixelcount = prfcount * freqpoints; + int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; + + kernel_TimeBPImageGridNet << > > ( + antPx, antPy, antPz, + antDirx, antDiry, antDirz, + imgx, imgy, imgz, + prfcount, freqpoints, meanH, + Rnear, dx); + PrintLasterError("TIMEBPCreateImageGrid"); + cudaDeviceSynchronize(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh new file mode 100644 index 0000000..e62e525 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh @@ -0,0 +1,28 @@ +#ifndef __GPUBPIMAGENET_CUH___ +#define __GPUBPIMAGENET_CUH___ + + +#include "BaseConstVariable.h" +#include "GPUTool.cuh" +#include +#include +#include +#include +#include "GPUTool.cuh" +#include "GPUBPTool.cuh" + + + + + +extern "C" void TIMEBPCreateImageGrid( + double* antPx, double* antPy, double* antPz, // S + double* antDirx, double* antDiry, double* antDirz, // + double* imgx, double* imgy, double* imgz, + long prfcount, long freqpoints, double meanH, + double Rnear, double dx +); + + + +#endif \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp new file mode 100644 index 0000000..cd5078d --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -0,0 +1,1118 @@ +#include "ImageNetOperator.h" +#include "LogInfoCls.h" +#include "PrintMsgToQDebug.h" +#include +#include "ImageOperatorBase.h" +#include "GPUBaseTool.h" +#include "GPUBPImageNet.cuh" +#include "BaseTool.h" +#include "BaseConstVariable.h" + + +void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, + double& NearRange, double& RangeResolution, int64_t& RangeNum) +{ + qDebug() << "---------------------------------------------------------------------------------"; + qDebug() << u8"ֳƽбͶӰ"; + gdalImage antimg(InEchoGPSDataPath); + qDebug() << u8"1. زGPSļ\t"; + qDebug() << u8"ļ·\t" << InEchoGPSDataPath; + qDebug() << u8"GPS \t" << antimg.height; + qDebug() << u8"ļ\t" << antimg.width; + qDebug() << u8"2.б"; + qDebug() << u8"룺\t" << NearRange; + qDebug() << u8"ֱʣ\t" << RangeResolution; + qDebug() << u8"\t" << RangeNum; + qDebug() << u8"3.ļ"; + gdalImage outimgll = CreategdalImageDouble(outImageLLPath, antimg.height,RangeNum, 3,true,true); + gdalImage outimgxyz = CreategdalImageDouble(outImageXYZPath, antimg.height, RangeNum, 3, true, true); + qDebug() << u8"ƽļγȣ·\t" << outImageLLPath; + qDebug() << u8"ƽļXYZ·\t" << outImageXYZPath; + qDebug() << u8"4.ʼXYZ"; + long prfcount = antimg.height; + long rangeNum = RangeNum; + double Rnear = NearRange; + double dx = RangeResolution; + + long blockRangeCount = Memory1GB / sizeof(double) / 4 / prfcount *6; + blockRangeCount = blockRangeCount < 1 ? 1 : blockRangeCount; + + std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos =readDataArr(antimg,0,0,prfcount, colnum,1,GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + 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]; // + 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;// һ + } + antpos.reset(); + } + + std::shared_ptr d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + + 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); + 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); + + + for (long startcolidx = 0; startcolidx < RangeNum; startcolidx = startcolidx + blockRangeCount) { + + long tempechocol = blockRangeCount; + if (startcolidx + tempechocol >= RangeNum) { + tempechocol = RangeNum - startcolidx; + } + qDebug() << " imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << RangeNum; + + std::shared_ptr demx = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demy = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demz = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr 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]; + } + } + + std::shared_ptr d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + + 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); + + + 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(), + prfcount, tempechocol, 0, + Rnear + dx * startcolidx, dx // ޶ + ); + + 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]; + } + } + + outimgxyz.saveImage(demx, 0, startcolidx, prfcount, tempechocol, 1); + outimgxyz.saveImage(demy, 0, startcolidx, prfcount, tempechocol, 2); + outimgxyz.saveImage(demz, 0, startcolidx, prfcount, tempechocol, 3); + + // XYZתΪγ + std::shared_ptr demllx = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demlly = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demllz = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + +#pragma omp parallel for + for (long ii = 0; ii < prfcount; ii++) { + for (long jj = 0; jj < tempechocol; jj++) { + double x = demx.get()[ii * tempechocol + jj]; + double y = demy.get()[ii * tempechocol + jj]; + double z = demz.get()[ii * tempechocol + jj]; + Landpoint point; + XYZ2BLH_FixedHeight(x, y, z, 0, point); + demllx.get()[ii * tempechocol + jj] = point.lon; + demlly.get()[ii * tempechocol + jj] = point.lat; + demllz.get()[ii * tempechocol + jj] = point.ati; + } + } + + + outimgll.saveImage(demllx, 0, startcolidx, prfcount, tempechocol, 1); + outimgll.saveImage(demlly, 0, startcolidx, prfcount, tempechocol, 2); + outimgll.saveImage(demllz, 0, startcolidx, prfcount, tempechocol, 3); + + } + + qDebug() << u8"6."; + qDebug() << "---------------------------------------------------------------------------------"; +} + +bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) +{ + // DEMǷWGS84ϵ + //long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); + //if (demEPSG != 4326) { + // qDebug() << u8"DEMϵWGS84ϵ,ESPG:"<< demEPSG; + // return false; + //} + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + long imgheight = imgll.height; + long imgwidth = imgll.width; + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + + // ӡΧ + qDebug() << u8"ӰΧ"; + qDebug() << u8"Сȣ\t" << imglonArr.minCoeff(); + qDebug() << u8"󾭶ȣ\t" << imglonArr.maxCoeff(); + qDebug() << u8"Сγȣ\t" << imglatArr.minCoeff(); + qDebug() << u8"γȣ\t" << imglatArr.maxCoeff(); + qDebug() << u8"DEMΧ"; + RasterExtend demextend = demimg.getExtend(); + qDebug() << u8"Сȣ\t" << demextend.min_x; + qDebug() << u8"󾭶ȣ\t" << demextend.max_x; + qDebug() << u8"Сγȣ\t" << demextend.min_y; + qDebug() << u8"γȣ\t" << demextend.max_y; + qDebug() << u8"ӰС\t" << demimg.height << " * " << demimg.width; + + + + for (long i = 0; i < imgheight; i++) + { + for (long j = 0; j < imgwidth; j++) + { + double lon = imglonArr(i, j); // X + double lat = imglatArr(i, j); // Y + Landpoint point = demimg.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + double maxY = imglatArr.maxCoeff(); + + //ӡΧ + qDebug() << u8"dem ķΧ"; + qDebug() << u8"minX:"<demimg.width - 1 || minY<1 || maxY>demimg.height - 1) { + return false; + } + else { + return true; + } + + + +} + +bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath) +{ + + gdalImage antimg(InEchoGPSDataPath); + gdalImage imgll(ImageLLPath); + return antimg.height == imgll.height; + +} + + + +void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) +{ + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 4, true, true); // ȡγȡ̡߳б + + long imgheight = imgll.height; + long imgwidth = imgll.width; + + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); + Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); + + outimgll.saveImage(imglonArr, 0, 0, 1); + outimgll.saveImage(imglatArr, 0, 0, 2); + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + double maxY = imglatArr.maxCoeff(); + //ӡΧ + qDebug() << u8"dem ķΧ"; + qDebug() << u8"minX:" << minX << "\t" << demimg.width; + qDebug() << u8"maxX:" << maxX << "\t" << demimg.width; + qDebug() << u8"minY:" << minY << "\t" << demimg.height; + qDebug() << u8"maxY:" << maxY << "\t" << demimg.height; + qDebug() << u8"ͼУ\t" << demimg.height << " , " << demimg.width; + + + for (long i = 0; i < imgheight; i++) { + //printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight); + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati=Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + + } + } + outimgll.saveImage(imgatiArr, 0, 0, 3); + qDebug() << u8"ÿбֵ"; + + + gdalImage antimg(InEchoGPSDataPath); + qDebug() << u8"1. زGPSļ\t"; + qDebug() << u8"ļ·\t" << InEchoGPSDataPath; + qDebug() << u8"GPS \t" << antimg.height; + qDebug() << u8"ļ\t" << antimg.width; + + long prfcount = antimg.height; + + + std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(antimg, 0, 0, prfcount, colnum, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + 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]; // + 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;// һ + } + antpos.reset(); + } + + + +#pragma omp parallel for + for (long prfid = 0; prfid < prfcount; prfid++) { + double Px = Pxs.get()[prfid]; + double Py = Pys.get()[prfid]; + double Pz = Pzs.get()[prfid]; + double R = 0; + Landpoint LLA = {}; + Point3 XYZ = {}; + for (long j = 0; j < imgwidth; j++) { + LLA.lon = imglonArr(prfid, j); + LLA.lat = imglatArr(prfid, j); + LLA.ati = imgatiArr(prfid, j); + + LLA2XYZ(LLA, XYZ); + + R = sqrt(pow(Px - XYZ.x, 2) + + pow(Py - XYZ.y, 2) + + pow(Pz - XYZ.z, 2)); + imgRArr(prfid, j) = R; + } + } + + outimgll.saveImage(imgRArr, 0, 0, 4); + + qDebug() << u8"ֵ"; +} + + +void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) { + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + // ü + long imgheight = imgll.height; + long imgwidth = imgll.width; + + long minRow = -1; + long maxRow = imgheight; + long minCol = -1; + long maxCol = imgwidth; + + + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + // ʼɨ + + bool minRowFlag=true, maxRowFlag= true, minColFlag = true, maxColFlag = true; + + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + if (imglonArr(i, j) > 0 && minRowFlag) { + minRowFlag = false; + minRow = i; + break; + } + if (imglonArr(i, j) < imgheight) { + maxRow = i; + } + } + } + + for (long j = 0; j < imgwidth; j++) { + for (long i = 0; i < imgheight; i++) { + if (imglatArr(i, j) > 0 && minColFlag) { + minColFlag = false; + minCol = j; + break; + } + if (imglatArr(i, j) < imgheight) { + maxCol = j; + } + } + } + + + long RowCount = maxRow - minRow; + long ColCount = maxCol - minCol; + + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // ȡγȡ̡߳б + + imgheight = outimgll.height; + imgwidth = outimgll.width; + + imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); + imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); + + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + + Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); + Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); + + outimgll.saveImage(imglonArr, 0, 0, 1); + outimgll.saveImage(imglatArr, 0, 0, 2); + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + double maxY = imglatArr.maxCoeff(); + + //ӡΧ + qDebug() << u8"dem ķΧ"; + qDebug() << u8"minX:" << minX << "\t" << demimg.width; + qDebug() << u8"maxX:" << maxX << "\t" << demimg.width; + qDebug() << u8"minY:" << minY << "\t" << demimg.height; + qDebug() << u8"maxY:" << maxY << "\t" << demimg.height; + qDebug() << u8"ͼУ\t" << demimg.height << " , " << demimg.width; + + + for (long i = 0; i < imgheight; i++) { + //printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight); + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + } + } + + outimgll.saveImage(imgatiArr, 0, 0, 3); + qDebug() << u8"ÿбֵ"; + + + gdalImage antimg(InEchoGPSDataPath); + qDebug() << u8"1. زGPSļ\t"; + qDebug() << u8"ļ·\t" << InEchoGPSDataPath; + qDebug() << u8"GPS \t" << antimg.height; + qDebug() << u8"ļ\t" << antimg.width; + + long prfcount = antimg.height; + + + std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(antimg, 0, 0, prfcount, colnum, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + 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]; // + 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;// һ + } + antpos.reset(); + } + + + +#pragma omp parallel for + for (long prfid = minRow; prfid < maxRow; prfid++) { + double Px = Pxs.get()[prfid]; + double Py = Pys.get()[prfid]; + double Pz = Pzs.get()[prfid]; + double R = 0; + Landpoint LLA = {}; + Point3 XYZ = {}; + for (long j = 0; j < imgwidth; j++) { + LLA.lon = imglonArr(prfid-minRow, j); + LLA.lat = imglatArr(prfid - minRow, j); + LLA.ati = imgatiArr(prfid - minRow, j); + + LLA2XYZ(LLA, XYZ); + + R = sqrt(pow(Px - XYZ.x, 2) + + pow(Py - XYZ.y, 2) + + pow(Pz - XYZ.z, 2)); + imgRArr(prfid - minRow, j) = R; + } + } + + outimgll.saveImage(imgRArr, 0, 0, 4); + + qDebug() << u8"ֵ"; + +} + + +int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) +{ + gdalImage sim_rc(dem_rc_path); + gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// עﱣ + for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) { + Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); + Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2); + sim_sar = sim_sar.array() * 0 - 9999; + sim_sarc = sim_sar.array() * 0 - 9999; + sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1); + sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2); + } + sim_sar_img.setNoDataValue(-9999, 1); + sim_sar_img.setNoDataValue(-9999, 2); + int conver_lines = 5000; + int line_invert = 4000;// ص + int line_offset = 60; + // + omp_lock_t lock; + omp_init_lock(&lock); // ʼ + int allCount = 0; + + for (int max_rows_ids = 0; max_rows_ids < sim_rc.height; max_rows_ids = max_rows_ids + line_invert) { + Eigen::MatrixXd dem_r = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 1); + Eigen::MatrixXd dem_c = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 2); + int dem_rows_num = dem_r.rows(); + int dem_cols_num = dem_r.cols(); + // ²ֵγ + //Eigen::MatrixXd dem_lon = dem_r; + //Eigen::MatrixXd dem_lat = dem_c; + // ¾γȲ + + int temp_r, temp_c; + + int min_row = dem_r.minCoeff() + 1; + int max_row = dem_r.maxCoeff() + 1; + + if (max_row < 0) { + continue; + } + + int len_rows = max_row - min_row; + min_row = min_row < 0 ? 0 : min_row; + Eigen::MatrixXd sar_r = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 1); + Eigen::MatrixXd sar_c = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 2); + len_rows = sar_r.rows(); + + +#pragma omp parallel for num_threads(8) // NEW ADD + for (int i = 0; i < dem_rows_num - 1; i++) { + for (int j = 0; j < dem_cols_num - 1; j++) { + Point3 p, p1, p2, p3, p4; + Landpoint lp1, lp2, lp3, lp4; + lp1 = sim_rc.getLandPoint(i + max_rows_ids, j, 0); + lp2 = sim_rc.getLandPoint(i + max_rows_ids, j + 1, 0); + lp3 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j + 1, 0); + lp4 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j, 0); + + p1 = { dem_r(i,j),dem_c(i,j) }; + p2 = { dem_r(i,j + 1),dem_c(i,j + 1) }; + p3 = { dem_r(i + 1,j + 1),dem_c(i + 1,j + 1) }; + p4 = { dem_r(i + 1,j),dem_c(i + 1,j) }; + + //if (angle(i, j) >= 90 && angle(i, j + 1) >= 90 && angle(i + 1, j) >= 90 && angle(i + 1, j + 1) >= 90) { + // continue; + //} + + double temp_min_r = dem_r.block(i, j, 2, 2).minCoeff(); + double temp_max_r = dem_r.block(i, j, 2, 2).maxCoeff(); + double temp_min_c = dem_c.block(i, j, 2, 2).minCoeff(); + double temp_max_c = dem_c.block(i, j, 2, 2).maxCoeff(); + if ((int(temp_min_r) != int(temp_max_r)) && (int(temp_min_c) != int(temp_max_c))) { + for (int ii = int(temp_min_r); ii <= temp_max_r + 1; ii++) { + for (int jj = int(temp_min_c); jj < temp_max_c + 1; jj++) { + if (ii < min_row || ii - min_row >= len_rows || jj < 0 || jj >= OriWidth) { + continue; + } + p = { double(ii),double(jj),0 }; + //if (PtInRect(p, p1, p2, p3, p4)) { + p1.z = lp1.lon; + p2.z = lp2.lon; + p3.z = lp3.lon; + p4.z = lp4.lon; + + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + double mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_r(ii - min_row, jj) = p.z; + p1.z = lp1.lat; + p2.z = lp2.lat; + p3.z = lp3.lat; + p4.z = lp4.lat; + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_c(ii - min_row, jj) = p.z; + //} + } + } + + } + } + } + + omp_set_lock(&lock); //û + sim_sar_img.saveImage(sar_r, min_row, 0, 1); + sim_sar_img.saveImage(sar_c, min_row, 0, 2); + allCount = allCount + conver_lines; + qDebug() << "rows:\t" << allCount << "/" << sim_rc.height << "\t computing.....\t" ; + omp_unset_lock(&lock); //ͷŻ + + + } + + return 0; +} + + +int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { + gdalImageComplex echodata(L2echodataPath); + gdalImage looktable(RangeLooktablePath); + gdalImageComplex l1adata(L1AEchoDataPath); + Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); + + long blockHeight = Memory1GB / looktable.width / 8 * 2; + + for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) { + printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height); + blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow; + Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2); + Eigen::MatrixXcd l1aArr = l1adata.getDataComplex(0, 0, blockHeight, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + + long imgheight = blockHeight; + long imgwidth = looktable.width; +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + // ʵֵ + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).real(p0.ati); + } + //鲿ֵ + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).imag(p0.ati); + } + + } + } + + l1adata.saveImage(l1aArr, startRow, 0, 1); + } + + + + return 0; + +} + +int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath) +{ + gdalImage echodata(geodataPath); + gdalImage looktable(RangeLooktablePath); + gdalImage l1adata(RangeDataPath); + Eigen::MatrixXd echoArr = echodata.getData(0, 0, echodata.height, echodata.width, 1); + + long blockHeight = Memory1GB / looktable.width / 8 * 2; + + for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) { + printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height); + blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow; + Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2); + Eigen::MatrixXd l1aArr = l1adata.getData(0, 0, blockHeight, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + + long imgheight = blockHeight; + long imgwidth = looktable.width; +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j)=p0.ati; + } + } + } + + l1adata.saveImage(l1aArr, startRow, 0, 1); + } + + + + return 0; +} + +void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath) +{ + gdalImage LLimg(lonlatPath); + gdalImage demimg(DEMPath); + gdalImage LLRimg = CreategdalImageDouble(outllrpath, LLimg.height, LLimg.width, 3, true, true); + + long llimgheight = LLimg.height; + long llimgWidth = LLimg.width; + + Eigen::MatrixXd imglonArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 1); + Eigen::MatrixXd imglatArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 2); + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + + Eigen::MatrixXd outRArr = imglonArr.array() * 0; + + LLRimg.saveImage(imglonArr, 0, 0, 1); + LLRimg.saveImage(imglatArr, 0, 0, 2); + + + for (long i = 0; i < llimgheight; i++) { + for (long j = 0; j < llimgWidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + outRArr(i, j) = p0.ati; + + } + } + + LLRimg.saveImage(outRArr, 0, 0, 3); + + return; +} + +void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath) +{ + + gdalImage LLAimg(LLAPath); + gdalImage xyzimg = CreategdalImageDouble(outXYZPath, LLAimg.height, LLAimg.width, 3, true, true); + + long llimgheight = LLAimg.height; + long llimgWidth = LLAimg.width; + + Eigen::MatrixXd lonArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 1); + Eigen::MatrixXd latArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 2); + Eigen::MatrixXd atiArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 3); + + // ʹLLAץΪXYZ + Eigen::MatrixXd xArr = lonArr.array() * 0; + Eigen::MatrixXd yArr = lonArr.array() * 0; + Eigen::MatrixXd zArr = lonArr.array() * 0; + + + + for (long i = 0; i < llimgheight; i++) { + for (long j = 0; j < llimgWidth; j++) { + double lon = lonArr(i, j); + double lat = latArr(i, j); + double ati = atiArr(i, j); + Landpoint p{ lon,lat,ati }; + Landpoint XYZP=LLA2XYZ(p); + + xArr(i, j) = XYZP.lon; + yArr(i, j) = XYZP.lat; + zArr(i, j) = XYZP.ati; + + + } + } + + xyzimg.saveImage(xArr, 0, 0, 1); + xyzimg.saveImage(yArr, 0, 0, 2); + xyzimg.saveImage(zArr, 0, 0, 3); + + return; +} + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h new file mode 100644 index 0000000..59f5920 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -0,0 +1,28 @@ +#pragma once +#ifndef __ImageNetOperator__H_ +#define __ImageNetOperator__H_ +#include "BaseConstVariable.h" +#include + + +void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, double& NearRange, double& RangeResolution, int64_t& RangeNum); + +bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath); + +bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath); + +void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); +void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); +int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth); + +int ResampleEChoDataFromGeoEcho(QString L2complexechodataPath, QString RangeLooktablePath, QString L1AEchoDataPath); + +int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath); + + +void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath); + +void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath); + + +#endif diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp new file mode 100644 index 0000000..4c78e3b --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -0,0 +1,146 @@ +#include "ImagePlaneAtiInterpDialog.h" +#include "ui_ImagePlaneAtiInterpDialog.h" +#include +#include +#include +#include "BaseConstVariable.h" +#include "ImageNetOperator.h" + +ImagePlaneAtiInterpDialog::ImagePlaneAtiInterpDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::ImagePlaneAtiInterpDialogClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonImageLLASelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLASelect_clicked())); + connect(ui->pushButtonImageNet0Select, SIGNAL(clicked()), this, SLOT(onpushButtonImageNet0Select_clicked())); + connect(ui->pushButtonRefRangeDEMSelect, SIGNAL(clicked()), this, SLOT(onpushButtonRefRangeDEMSelect_clicked())); + connect(ui->pushButtonEchoGPSPointDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSPointSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBoxAccepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBoxRejected())); + + +} + +ImagePlaneAtiInterpDialog::~ImagePlaneAtiInterpDialog() +{} + +void ImagePlaneAtiInterpDialog::onpushButtonImageNet0Select_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"ѡƽļ"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditImageNet0Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} + +void ImagePlaneAtiInterpDialog::onpushButtonEchoGPSPointSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡزGPSļ"), // + QString(), // Ĭ· + tr(u8"GPSļ(*.gpspos.data);;All Files(*.*)") // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditGPSPointsPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"ѡοDEM"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditRefRangeDEMPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} + +void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, + tr(u8"ʾ"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "ѡļ\n"; + this->ui->lineEditImageLLAPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + } +} + +void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted() +{ + QString imageNet0Path = this->ui->lineEditImageNet0Path->text().trimmed(); + QString refRangeDEMPath = this->ui->lineEditRefRangeDEMPath->text().trimmed(); + QString imageLLAPath = this->ui->lineEditImageLLAPath->text().trimmed(); + QString echoGPSDataPath = this->ui->lineEditGPSPointsPath->text().trimmed(); + if (imageNet0Path.isEmpty() || refRangeDEMPath.isEmpty() || imageLLAPath.isEmpty()||echoGPSDataPath.isEmpty()) { + QMessageBox::warning(this, tr(u8"ʾ"), tr(u8"ûѡļ")); + return; + } + else { + + } + + if (GPSPointsNumberEqualCheck(imageNet0Path, echoGPSDataPath)) { + } + else { + QMessageBox::warning(nullptr, u8"", u8"زGPSĿһ"); + return; + } + + bool checkflag= this->ui->checkBoxOverLap->isChecked(); + if (checkflag) { + InterploateClipAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath); + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); + return; + } + else { + if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? + InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath); + + QMessageBox::information(nullptr, u8"ʾ", u8"completed!!"); + return; + + } + else { + QMessageBox::warning(nullptr, u8"", u8"DEMӰСڳƽҪ"); + return; + } + } +} + +void ImagePlaneAtiInterpDialog::onbuttonBoxRejected() +{ + this->close(); +} + + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h new file mode 100644 index 0000000..5b37329 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h @@ -0,0 +1,36 @@ +#pragma once + +#ifndef __ImagePlaneAtiInterpDialog__HH__ +#define __ImagePlaneAtiInterpDialog__HH__ + +#include + +namespace Ui { + class ImagePlaneAtiInterpDialogClass; +} + + +class ImagePlaneAtiInterpDialog : public QDialog +{ + Q_OBJECT + +public: + ImagePlaneAtiInterpDialog(QWidget *parent = nullptr); + ~ImagePlaneAtiInterpDialog(); + +public slots: + + void onpushButtonImageNet0Select_clicked(); + void onpushButtonEchoGPSPointSelect_clicked(); + void onpushButtonRefRangeDEMSelect_clicked(); + void onpushButtonImageLLASelect_clicked(); + void onbuttonBoxAccepted(); + void onbuttonBoxRejected(); + + +private: + Ui::ImagePlaneAtiInterpDialogClass* ui; +}; + + +#endif \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui new file mode 100644 index 0000000..db72143 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui @@ -0,0 +1,201 @@ + + + ImagePlaneAtiInterpDialogClass + + + + 0 + 0 + 661 + 305 + + + + 根据经纬度插值高程数据 + + + + + + + 0 + 30 + + + + 成像网格(经纬度): + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 回波GPS点 + + + + + + + + 0 + 30 + + + + 参考DEM: + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 成像粗网格(高程): + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 强制采样 + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp new file mode 100644 index 0000000..45b5fce --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp @@ -0,0 +1,98 @@ +#include "InitCreateImageXYZDialog.h" +#include "ui_InitCreateImageXYZDialog.h" +#include +#include +#include "ImageNetOperator.h" + +InitCreateImageXYZDialog::InitCreateImageXYZDialog(QWidget *parent) + : QDialog(parent), ui(new Ui::InitCreateImageXYZDialogClass) +{ + ui->setupUi(this); + connect(ui->pushButtonEchoGPSDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSDataSelect_clicked())); + connect(ui->pushButtonImageXYZSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageXYZSelect_clicked())); + connect(ui->pushButtonImageLLSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); +} + +InitCreateImageXYZDialog::~InitCreateImageXYZDialog() +{} + +void InitCreateImageXYZDialog::onpushButtonImageLLSelect_clicked() +{ + QString fileNamePath = QFileDialog::getSaveFileName( + this, // + tr(u8"澭γȳ"), // + QString(), // Ĭ· + tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiffӰ(*.tif);;tiffӰ(*.tiff)") // ļ + ); + // ûѡļ + if (!fileNamePath.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditImageLLPath->setText(fileNamePath); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } + +} + +void InitCreateImageXYZDialog::onpushButtonImageXYZSelect_clicked() +{ + QString fileNamePath = QFileDialog::getSaveFileName( + this, // + tr(u8"XYZ"), // + QString(), // Ĭ· + tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiffӰ(*.tif);;tiffӰ(*.tiff)") // ļ + ); + // ûѡļ + if (!fileNamePath.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditImageXYZPath->setText(fileNamePath); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void InitCreateImageXYZDialog::onpushButtonEchoGPSDataSelect_clicked() +{ + + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡزGPSļ"), // + QString(), // Ĭ· + tr(u8"GPSļ(*.gpspos.data);;All Files(*.*)") // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditEchoGPSDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void InitCreateImageXYZDialog::onbuttonBox_accepted() +{ + double NearRange = this->ui->doubleSpinBoxNearRange->value(); + double RangeResolution = this->ui->doubleSpinBoxRangeResolution->value(); + int64_t RangeNum = this->ui->spinBoxRangeNum->value(); + QString imageLLPath = this->ui->lineEditImageLLPath->text().trimmed(); + QString imageXYZPath = this->ui->lineEditImageXYZPath->text().trimmed(); + QString echoGPSDataPath = this->ui->lineEditEchoGPSDataPath->text().trimmed(); + + InitCreateImageXYZProcess(imageLLPath, imageXYZPath, echoGPSDataPath, NearRange, RangeResolution, RangeNum); + if (imageLLPath.isEmpty() || imageXYZPath.isEmpty() || echoGPSDataPath.isEmpty()) { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + return; + } + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); + +} + +void InitCreateImageXYZDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h new file mode 100644 index 0000000..d4fb229 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h @@ -0,0 +1,36 @@ +#pragma once +#ifndef __InitCreateImageXYZDialog__HH__ +#define __InitCreateImageXYZDialog__HH__ + + +#include + + +namespace Ui { + class InitCreateImageXYZDialogClass; +} + + +class InitCreateImageXYZDialog : public QDialog +{ + Q_OBJECT + +public: + InitCreateImageXYZDialog(QWidget *parent = nullptr); + ~InitCreateImageXYZDialog(); + + +public slots : + void onpushButtonImageLLSelect_clicked(); + void onpushButtonImageXYZSelect_clicked(); + void onpushButtonEchoGPSDataSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); + + +private: + Ui::InitCreateImageXYZDialogClass* ui; +}; + + +#endif \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui new file mode 100644 index 0000000..38293bd --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui @@ -0,0 +1,250 @@ + + + InitCreateImageXYZDialogClass + + + + 0 + 0 + 600 + 403 + + + + 初始化成像平面网格 + + + + + + + 0 + 30 + + + + 成像网格(XYZ): + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + + + + + + + + 0 + 30 + + + + 成像网格(经纬度): + + + + + + + + 0 + 30 + + + + 回波GPS轨道节点: + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + + + + + + + true + + + + + 0 + 0 + 580 + 239 + + + + + + + 方位向参数 + + + + + + 方位向的像素数与回波GPS脉冲数一致 + + + + + + + + + + 距离向参数 + + + + + + 近斜距 + + + + + + + 3 + + + 1000000000000000000.000000000000000 + + + 0.010000000000000 + + + + + + + 5 + + + 99999999999999991611392.000000000000000 + + + 0.000100000000000 + + + + + + + 距离向间隔 + + + + + + + 距离向像素数 + + + + + + + 999999999 + + + + + + + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp new file mode 100644 index 0000000..44f0859 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp @@ -0,0 +1,386 @@ +#include "QCreateInSARImagePlaneXYZRDialog.h" +#include "ui_QCreateInSARImagePlaneXYZRDialog.h" +#include +#include + +#include "SatelliteOribtModel.h" +#include "SARSimulationTaskSetting.h" +#include "ImageOperatorBase.h" +#include "FileOperator.h" +#include "BaseConstVariable.h" +#include "GPUTool.cuh" +#include "LookTableSimulationComputer.cuh" +#include + +#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 PolyfitPx = orbitmodel.getPolyfitPx(); + std::vector PolyfitPy = orbitmodel.getPolyfitPy(); + std::vector PolyfitPz = orbitmodel.getPolyfitPz(); + std::vector PolyfitVx = orbitmodel.getPolyfitVx(); + std::vector PolyfitVy = orbitmodel.getPolyfitVy(); + std::vector PolyfitVz = orbitmodel.getPolyfitVz(); + + + // ģ + qDebug() << "load simulation setting params from xml :" << orbitpath; + std::shared_ptr SARSetting = ReadSimulationSettingsXML(SatePath); + + // ղ + double dopplerRefrenceTime = SARSetting->getDopplerParametersReferenceTime(); + std::vector DopplerCentroidCoefficients = SARSetting->getDopplerCentroidCoefficients(); + std::vector 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 PolyfitPx, std::vector PolyfitPy, std::vector PolyfitPz, std::vector PolyfitVx, std::vector PolyfitVy, std::vector PolyfitVz, double dopplerRefrenceTime, std::vector 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 = CreategdalImageDouble( // ұ + 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 demX = readDataArr(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// ޸ + std::shared_ptr demY = readDataArr(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demZ = readDataArr(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + // + std::shared_ptr host_R((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + + std::shared_ptr device_R((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + + // + std::shared_ptr host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + std::shared_ptr host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + std::shared_ptr host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + + std::shared_ptr device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + std::shared_ptr device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + std::shared_ptr 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!!!"); + +} + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h new file mode 100644 index 0000000..d071ee9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h @@ -0,0 +1,70 @@ +#pragma once + +#include + + +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 PolyfitPx, // 50 + std::vector PolyfitPy, // 50 + std::vector PolyfitPz, // 50 + std::vector PolyfitVx, // 50 + std::vector PolyfitVy, // 50 + std::vector PolyfitVz, // 50 + + + // ղ + double dopplerRefrenceTime, + std::vector DopplerCentroidCoefficients,// d0 ~ d5 + + // + double starttime, // ʼʱ + double endtime, // ʱ + double nearRange, // б + double farRange, // Զб + double PRF, // ظƵ + double Fs, // Ƶ + double lamda + ); + + + +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui new file mode 100644 index 0000000..c90b83d --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui @@ -0,0 +1,293 @@ + + + QCreateInSARImagePlaneXYZRDialogClass + + + + 0 + 0 + 763 + 498 + + + + QCreateInSARImagePlaneXYZR + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat + + + + + + + 采用多普勒参数 + + + true + + + + + + + + 0 + 30 + + + + 卫星仿真参数: + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + DEM文件(XYZ) + + + + + + + + 0 + 30 + + + + 坡度法向文件(sloper) + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml + + + + + + + + 0 + 30 + + + + LT1A_20250210 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\Looktable + + + + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 多项式轨道模型参数: + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat + + + + + + + + 0 + 30 + + + + 结果文件保存地址: + + + + + + + + 0 + 30 + + + + 成像平面文件名 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp new file mode 100644 index 0000000..88338e9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp @@ -0,0 +1,114 @@ +#include "QL1ASARProcessDialog.h" +#include "ui_QL1ASARProcessDialog.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageNetOperator.h" +#include "ImageOperatorBase.h" + +QL1ASARProcessDialog::QL1ASARProcessDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QL1ASARProcessDialogClass) +{ + ui->setupUi(this); + + + connect(ui->pushButtonL1BSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1BSelect_clicked())); + connect(ui->pushButtonL1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelect_clicked())); + connect(ui->pushButtonS1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonS1ASelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + + + + +} + +QL1ASARProcessDialog::~QL1ASARProcessDialog() +{ + + + +} + +void QL1ASARProcessDialog::onpushButtonL1BSelect_clicked() +{ + + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡL1Bļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = u8"ѡļУ\n"; + this->ui->lineEditL1BDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } + +} + +void QL1ASARProcessDialog::onpushButtonL1ASelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡL1Aļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = u8"ѡļУ\n"; + this->ui->lineEditL1ADataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QL1ASARProcessDialog::onpushButtonS1ASelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡбƷļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = u8"ѡļУ\n"; + this->ui->lineSlAPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QL1ASARProcessDialog::onbuttonBox_accepted() +{ + QString l1arasterpath = ui->lineEditL1ADataPath->text(); + QString s1arasterpath = ui->lineSlAPath->text(); + QString l1brasterpath = ui->lineEditL1BDataPath->text(); + + long nlaz = ui->spinBoxLNAz->value(); + long nlra = ui->spinBoxLNRa->value(); + + qDebug() << u8"бิƷ ת бȲƷ"; + Complex2AmpRaster(l1arasterpath, s1arasterpath); + + qDebug() << u8"бȲƷ ת бȲƷ"; + MultiLookRaster(s1arasterpath, l1brasterpath, nlaz, nlra); + + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"Ӵ")); +} + +void QL1ASARProcessDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h new file mode 100644 index 0000000..3e27297 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h @@ -0,0 +1,30 @@ +#pragma once + +#include + + +namespace Ui { + class QL1ASARProcessDialogClass; + +}; + +class QL1ASARProcessDialog : public QDialog +{ + Q_OBJECT + +public: + QL1ASARProcessDialog(QWidget *parent = nullptr); + ~QL1ASARProcessDialog(); + + +public slots: + + void onpushButtonL1BSelect_clicked(); + void onpushButtonL1ASelect_clicked(); + void onpushButtonS1ASelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); + +private: + Ui::QL1ASARProcessDialogClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui new file mode 100644 index 0000000..b3957fd --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui @@ -0,0 +1,232 @@ + + + QL1ASARProcessDialogClass + + + + 0 + 0 + 475 + 354 + + + + QL1ASARProcessDialog + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + 单视振幅产品: + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + L1B: + + + + + + + + 0 + 30 + + + + L1A产品: + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + + + + + + + + 多视参数 + + + + + + + 0 + 30 + + + + + 100 + 16777215 + + + + 方位向视数: + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + + 100 + 16777215 + + + + 方位向视数: + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp new file mode 100644 index 0000000..4fbc603 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp @@ -0,0 +1,124 @@ +#include "QLonLatInterpAtiFromDEM.h" +#include "ui_QLonLatInterpAtiFromDEM.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageNetOperator.h" + +QLonLatInterpAtiFromDEM::QLonLatInterpAtiFromDEM(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QLonLatInterpAtiFromDEMClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonLonLatRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLonLatRasterSelect_clicked())); + connect(ui->pushButtonDEMRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonDEMRasterSelect_clicked())); + connect(ui->pushButtonLLARasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLLARasterSelect_clicked())); + connect(ui->pushButtonXYZRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonXYZRasterSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + + +} + +QLonLatInterpAtiFromDEM::~QLonLatInterpAtiFromDEM() +{ + +} + +void QLonLatInterpAtiFromDEM::onpushButtonLonLatRasterSelect_clicked() +{ + + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditLonLatRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } + +} + +void QLonLatInterpAtiFromDEM::onpushButtonDEMRasterSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡDEMļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditDEMRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QLonLatInterpAtiFromDEM::onpushButtonLLARasterSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡ񱣴ļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditLLARasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QLonLatInterpAtiFromDEM::onpushButtonXYZRasterSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡתļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditXYZRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QLonLatInterpAtiFromDEM::onbuttonBox_accepted() +{ + QString llrasterpath = ui->lineEditLonLatRasterPath->text(); + QString demrasterpath = ui->lineEditDEMRasterPath->text(); + QString llarasterpath = ui->lineEditLLARasterPath->text(); + QString xyzrasterpath = ui->lineEditXYZRasterPath->text(); + + qDebug() << "DEM߳С"; + InterpLookTableRfromDEM(llrasterpath, demrasterpath, llarasterpath); + qDebug() << "γתΪXYZС"; + RangeLooktableLLA_2_RangeLooktableXYZ(llarasterpath, xyzrasterpath); + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); +} + +void QLonLatInterpAtiFromDEM::onbuttonBox_rejected() +{ + this->close(); +} + diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h new file mode 100644 index 0000000..b728ef8 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +namespace Ui { + class QLonLatInterpAtiFromDEMClass; +} + +class QLonLatInterpAtiFromDEM : public QDialog +{ + Q_OBJECT + +public: + QLonLatInterpAtiFromDEM(QWidget *parent = nullptr); + ~QLonLatInterpAtiFromDEM(); + + +public slots: + void onpushButtonLonLatRasterSelect_clicked(); + void onpushButtonDEMRasterSelect_clicked(); + void onpushButtonLLARasterSelect_clicked(); + void onpushButtonXYZRasterSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); + + +private: + Ui::QLonLatInterpAtiFromDEMClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui new file mode 100644 index 0000000..4a31eca --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui @@ -0,0 +1,191 @@ + + + QLonLatInterpAtiFromDEMClass + + + + 0 + 0 + 600 + 400 + + + + QLonLatInterpAtiFromDEM + + + + + + + 0 + 30 + + + + 经纬度数据矩阵: + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 待采样DEM: + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 采样矩阵(LLA): + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 采样矩阵(XYZ): + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp new file mode 100644 index 0000000..5082835 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -0,0 +1,124 @@ +#include "QSARSimulationComplexEchoDataDialog.h" +#include "ui_QSARSimulationComplexEchoDataDialog.h" +#include +#include +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "ImageNetOperator.h" +#include +#include "FileOperator.h" +#include "ImageOperatorBase.h" + + +QSARSimulationComplexEchoDataDialog::QSARSimulationComplexEchoDataDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::QSARSimulationComplexEchoDataDialogClass) +{ + ui->setupUi(this); + + + connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelect_clicked())); + connect(ui->pushButtonLookTableSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableSelect_clicked())); + connect(ui->pushButtonL1AEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1AEchoDataSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + +} + +QSARSimulationComplexEchoDataDialog::~QSARSimulationComplexEchoDataDialog() +{ + + +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonEchoDataSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡؾļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditEchoDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonLookTableSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡұزļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditLookTablePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonL1AEchoDataSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡбļ"), // + QString(), // Ĭ· + tr(ENVI_FILE_FORMAT_FILTER) // ļ + ); + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditL1AEchoDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSARSimulationComplexEchoDataDialog::onbuttonBox_accepted() +{ + QString echoDataPath = this->ui->lineEditEchoDataPath->text().trimmed(); + QString RangelookTablePath = this->ui->lineEditLookTablePath->text().trimmed(); + QString l1AEchoDataPath = this->ui->lineEditL1AEchoDataPath->text().trimmed(); + + if (isExists(echoDataPath) && isExists(RangelookTablePath)) { + gdalImage echoData(echoDataPath); + gdalImage RangelookTable(RangelookTablePath); + if (echoData.getDataType() == GDT_CFloat32 + ||echoData.getDataType()==GDT_CFloat64 + || echoData.getDataType() == GDT_CInt16 + || echoData.getDataType()==GDT_CInt32 + ) { + + CreategdalImageComplex(l1AEchoDataPath, RangelookTable.height, RangelookTable.width,1, RangelookTable.gt, RangelookTable.projection, true, true); + + + ResampleEChoDataFromGeoEcho(echoDataPath, RangelookTablePath, l1AEchoDataPath); + } + else { + CreategdalImage(l1AEchoDataPath, RangelookTable.height, RangelookTable.width, 1, RangelookTable.gt, RangelookTable.projection, true, true); + ResampleRangeDataFromGeoImage(echoDataPath, RangelookTablePath, l1AEchoDataPath); + } + + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); + } + else { + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡκļ")); + } + +} + +void QSARSimulationComplexEchoDataDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h new file mode 100644 index 0000000..b586769 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +namespace Ui +{ + class QSARSimulationComplexEchoDataDialogClass; +} + +class QSARSimulationComplexEchoDataDialog : public QDialog +{ + Q_OBJECT + +public: + QSARSimulationComplexEchoDataDialog(QWidget *parent = nullptr); + ~QSARSimulationComplexEchoDataDialog(); + + +public slots: + void onpushButtonEchoDataSelect_clicked(); + void onpushButtonLookTableSelect_clicked(); + void onpushButtonL1AEchoDataSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); +private: + Ui::QSARSimulationComplexEchoDataDialogClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui new file mode 100644 index 0000000..6e3e09b --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui @@ -0,0 +1,149 @@ + + + QSARSimulationComplexEchoDataDialogClass + + + + 0 + 0 + 916 + 400 + + + + QSARSimulationComplexEchoDataDialog + + + + + + + 0 + 30 + + + + 地距文件: + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 查找表: + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 斜距文件: + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp new file mode 100644 index 0000000..3fe90be --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp @@ -0,0 +1,193 @@ +#include "QSimulationBPImageMultiProduction.h" +#include +#include +#include "TBPImageAlgCls.h" +#include "EchoDataFormat.h" +#include +#include +#include "ui_QSimulationBPImageMultiProduction.h" +#include "ImageNetOperator.h" + +QSimulationBPImageMultiProduction::QSimulationBPImageMultiProduction(QWidget *parent) + : QDialog(parent),ui(new Ui::QSimulationBPImageMultiProductionClass) +{ + ui->setupUi(this); + + QObject::connect(ui->pushButtonEchoSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoSelectClicked())); + QObject::connect(ui->LookTableBtn, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableBtnClicked())); + QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetBtnSelectClicked())); + QObject::connect(ui->L1ASelectBtn, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelectBtnClicked())); + QObject::connect(ui->L2SelectSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL2SelectSelectClicked())); + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected())); + + + + + +} + +QSimulationBPImageMultiProduction::~QSimulationBPImageMultiProduction() +{} + +void QSimulationBPImageMultiProduction::onpushButtonEchoSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡӰļ"), // + QString(), // Ĭ· + tr(u8"xml Files (*.xml);;All Files (*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditEchoPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + + +void QSimulationBPImageMultiProduction::onpushButtonLookTableBtnClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡұļ"), // + QString(), // Ĭ· + tr(u8"All Files(*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + this->ui->lineEditLookTablePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonGridNetBtnSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡļ"), // + QString(), // Ĭ· + tr(u8"All Files(*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + this->ui->lineEditImageNetPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonL1ASelectBtnClicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡӰļ"), // + QString(), // Ĭ· + tr(u8"All Files(*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + this->ui->lineEditL1AProductionPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonL2SelectSelectClicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // + tr(u8"ѡӰļ"), // + QString(), // Ĭ· + tr(u8"All Files(*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + this->ui->lineEditL2ProductionPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QSimulationBPImageMultiProduction::onbtnaccepted() +{ + QString L1ADataPath = this->ui->lineEditL1AProductionPath->text().trimmed(); + QString L2DataPath = this->ui->lineEditL2ProductionPath->text().trimmed(); + QString looktablePath = this->ui->lineEditLookTablePath->text().trimmed(); + QString imgNetPath = this->ui->lineEditImageNetPath->text().trimmed(); + QString echoDataPath = this->ui->lineEditEchoPath->text().trimmed(); + + this->hide(); + QString echofile = echoDataPath; + QString outImageFolder = getParantFromPath(L2DataPath); + QString imagename = getFileNameFromPath(L2DataPath); + std::shared_ptr 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()); + + gdalImage imgxyzimg(imgNetPath); + imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width); + + qDebug() << u8""; + TBPImageAlgCls TBPimag; + TBPimag.setEchoL0(echoL0ds); + TBPimag.setImageL1(imagL1); + long cpucore_num = std::thread::hardware_concurrency(); + TBPimag.setGPU(true); + TBPimag.ProcessWithGridNet(cpucore_num, imgNetPath); + qDebug() << u8"ϵͳУ"; + + // ӳ + std::shared_ptr< SARSimulationImageL1Dataset> imagL2(new SARSimulationImageL1Dataset); + imagL2->setCenterAngle(echoL0ds->getCenterAngle()); + imagL2->setCenterFreq(echoL0ds->getCenterFreq()); + imagL2->setNearRange(echoL0ds->getNearRange()); + imagL2->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2); + imagL2->setFarRange(echoL0ds->getFarRange()); + imagL2->setFs(echoL0ds->getFs()); + imagL2->setLookSide(echoL0ds->getLookSide()); + + + QString outL1AImageFolder = getParantFromPath(L1ADataPath); + QString L1Aimagename = getFileNameFromPath(L1ADataPath); + + gdalImage Looktableimg(looktablePath); + imagL2->OpenOrNew(outL1AImageFolder, L1Aimagename, Looktableimg.height, Looktableimg.width); + + QString L1AEchoDataPath =imagL2->getImageRasterPath(); + + ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1AEchoDataPath); + + + this->show(); + + QMessageBox::information(this,u8"",u8""); + +} + +void QSimulationBPImageMultiProduction::onbtnrejected() +{ + this->close(); +} + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h new file mode 100644 index 0000000..45222a6 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h @@ -0,0 +1,32 @@ +#pragma once +#include "simulationsartool_global.h" +#include + +namespace Ui { + class QSimulationBPImageMultiProductionClass; +} + + + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProduction : public QDialog +{ + Q_OBJECT + +public: + QSimulationBPImageMultiProduction(QWidget *parent = nullptr); + ~QSimulationBPImageMultiProduction(); + + +public slots: + void onpushButtonEchoSelectClicked(); + void onpushButtonLookTableBtnClicked(); + void onpushButtonGridNetBtnSelectClicked(); + void onpushButtonL1ASelectBtnClicked(); + void onpushButtonL2SelectSelectClicked(); + void onbtnaccepted(); + void onbtnrejected(); + + +private: + Ui::QSimulationBPImageMultiProductionClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui new file mode 100644 index 0000000..4712523 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui @@ -0,0 +1,303 @@ + + + QSimulationBPImageMultiProductionClass + + + + 0 + 0 + 813 + 400 + + + + 仿真图像TimeBP方法 + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 回波地址: + + + + + + + + 0 + 30 + + + + D:/FZSimulation/LTDQ/Input/xml/xml/165665/echodata/LT1B_DQ_165665_Simulation.xml + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 成像区域网格: + + + + + + + true + + + + 0 + 30 + + + + D:/FZSimulation/LTDQ/Input/xml/xml/165665/InSARImageXYZ/LT1A_165665_InSAR_ImageXYZ_looktable.bin + + + + + + + true + + + + 0 + 30 + + + + 选择 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 查找表: + + + + + + + true + + + + 0 + 30 + + + + D:/FZSimulation/LTDQ/Input/DEM1/looktable165665/LT1A_65665_looktable_Range.bin + + + + + + + true + + + + 0 + 30 + + + + 选择 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 1级产品: + + + + + + + true + + + + 0 + 30 + + + + D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L1/LT1A_165665_L1A + + + + + + + true + + + + 0 + 30 + + + + 选择 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 2级产品: + + + + + + + + 0 + 30 + + + + D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L2/LT1A_165665_L2 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index 718d73b..045ebbd 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -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, @@ -65,22 +65,24 @@ __global__ void processPulseKernel( ) { // - long long idx = blockIdx.x * blockDim.x + threadIdx.x; - long long pixelcount = nx * ny; - if (idx >= pixelcount) return; + int64_t idx = int64_t(blockIdx.x) * int64_t(blockDim.x) + int64_t(threadIdx.x); + int64_t pixelcount = int64_t(nx) * int64_t(ny); + if (idx >= pixelcount) { return; } //printf("processPulseKernel start!!\n"); //if (x >= nx || y >= ny) return; //int idx = x * ny + y; - + 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); + double ampcorrect = (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4)); double dR = R - R0; if (dR < r_start || dR >= (r_start + dr * (nR - 1))) return; @@ -98,7 +100,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); // 䵱ǰIJο double cos_phase = cos(phase); double sin_phase = sin(phase); @@ -106,9 +108,15 @@ __global__ void processPulseKernel( phCorr.x = rc_interp.x * cos_phase - rc_interp.y * sin_phase; phCorr.y = rc_interp.x * sin_phase + rc_interp.y * cos_phase; + // amp correction + //phCorr.x = ampcorrect * phCorr.x; + //phCorr.y = ampcorrect * phCorr.y; + // 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)) { //printf( @@ -161,13 +169,12 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { printfinfo("fft finished!!\n"); // ͼؽ - double r_start = data.r_vec[0]; double dr = (data.r_vec[data.Nfft - 1] - r_start) / (data.Nfft - 1); printfinfo("dr = %f\n",dr); - long pixelcount = data.nx* data.ny; - long grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; + int64_t pixelcount = int64_t(data.nx)* int64_t(data.ny); + int64_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; printfinfo("grid finished!!\n"); //double* d_R = (double*)mallocCUDADevice(sizeof(double) * data.nx * data.ny); @@ -177,7 +184,7 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { processPulseKernel << > > ( 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 +213,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 +226,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 +251,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)); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh index c971640..8cfd5cd 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh @@ -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;// ز diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh index 58bdca9..49682a8 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh @@ -1,3 +1,7 @@ +#ifndef __GPUBPTOOL_CUH___ +#define __GPUBPTOOL_CUH___ + + #include "BaseConstVariable.h" #include "GPUTool.cuh" #include @@ -7,7 +11,6 @@ #include "GPUTool.cuh" - extern __device__ double angleBetweenVectors(Vector3 a, Vector3 b, bool returnDegrees = false); extern __device__ Vector3 vec_sub(Vector3 a, Vector3 b); extern __device__ double vec_dot(Vector3 a, Vector3 b); @@ -21,3 +24,5 @@ extern __device__ double angleBetweenVectors_single(Vector3_single a, Vector3_s extern __device__ Vector3_single vec_sub_single(Vector3_single a, Vector3_single b); extern __device__ float vec_dot_single(Vector3_single a, Vector3_single b); extern __device__ Vector3_single vec_cross_single(Vector3_single a, Vector3_single b); + +#endif \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index 0f92e29..aa33c8a 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -487,16 +487,17 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double Pt, double refPhaseRange, double NearR, double FarR, - double maxGain,double GainWeight, - double* d_temp_R, double* d_temp_amps// + double maxGain, double GainWeight, + float* d_temp_R, float* d_temp_amps// ) { - long long idx = blockIdx.x * blockDim.x + threadIdx.x; // ȡǰ̱߳ - long long prfId = idx / SHAREMEMORY_FLOAT_HALF; - long long posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // ǰ̶߳ӦӰ - - //if (prfId > 20000) { - // printf("prfid %d,PRFCount : %d\n", prfId, PRFCount); - //} + int tid = threadIdx.x; + int bid = blockIdx.x; + int dmx = blockDim.x; + int idx = bid*dmx+tid; // ȡǰ̱߳ + int prfId = idx / SHAREMEMORY_FLOAT_HALF; + int posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // ǰ̶߳ӦӰ + //d_temp_R[idx] = pixelcount; + //d_temp_amps[idx] = posId; if (prfId < PRFCount && posId < pixelcount) { SateState antp = antlist[prfId]; @@ -506,8 +507,6 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double RstZ = antp.Pz - gp.Tz; double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // ʸ - - if (RstRFarR) { d_temp_R[idx] = 0; d_temp_amps[idx] = 0; @@ -525,8 +524,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( float slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); // if (slopR > 1e-3) { - - float localangle = acosf((RstX * slopeX + RstY * slopeY + RstZ * slopeZ) / ( slopR)); + float dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ; + float localangle = acosf(dotAB / (slopR)); if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) { d_temp_R[idx] = 0; @@ -538,95 +537,111 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( // б˥ - float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX - + antp.antDirectY * antp.antDirectY - + antp.antDirectZ * antp.antDirectZ); + //float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX + // + antp.antDirectY * antp.antDirectY + // + antp.antDirectZ * antp.antDirectZ); - float diectAngle = -1*(RstX*antp.antDirectX+ - RstY*antp.antDirectY+ - RstZ*antp.antDirectZ) / (antDirectR ); + //float diectAngle = -1 * (RstX * antp.antDirectX + + // RstY * antp.antDirectY + + // RstZ * antp.antDirectZ) / (antDirectR); - diectAngle = acosf(diectAngle);// - diectAngle = diectAngle * GainWeight; + //diectAngle = acosf(diectAngle);// + //diectAngle = diectAngle * GainWeight; float ampGain = 1; - ampGain=2 * maxGain * (1 - (powf(diectAngle,2) / 6) - + (powf(diectAngle, 4) / 120) - - (powf(diectAngle, 6) / 5040)); //dB - - ampGain = powf(10.0, ampGain / 10.0); + //ampGain = 2 * maxGain * (1 - (powf(diectAngle, 2) / 6) + // + (powf(diectAngle, 4) / 120) + // - (powf(diectAngle, 6) / 5040)); //dB + + //ampGain = powf(10.0, ampGain / 10.0); ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // ǿ float sigma = GPU_getSigma0dB(sigma0Params, localangle); sigma = powf(10.0, sigma / 10.0); - double temp_amp = double(ampGain * Pt * sigma); - double temp_R = double(RstR - refPhaseRange); - - bool isNan = !(isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)); - - d_temp_amps[idx] = temp_amp * isNan; - d_temp_R[idx] = temp_R * isNan; - - return; + float temp_amp = float(ampGain * Pt * sigma); + double temp_R = RstR - refPhaseRange; + if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { + d_temp_R[idx] = 0; + d_temp_amps[idx] = 0; + return; + } + else { + d_temp_amps[idx] = temp_amp; + d_temp_R[idx] =static_cast(temp_R); + return; + } } } } + else { + d_temp_R[idx] = 0; + d_temp_amps[idx] =0; + return; + } + } -__global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized( - double* d_temp_R, double* d_temp_amps, long posNum, +__global__ void CUDA_Kernel_Computer_echo_NoAntPattern( + float* d_temp_R, float* d_temp_amps, double f0, double dfreq, - long FreqPoints, // ǰƵʵķֿ - long maxfreqnum, // ֵ + long maxfreqnum, long nextfreqNum,// ֵ cuComplex* echodata, long temp_PRF_Count ) { - // ʹö̬ڴ棬߳̿С - extern __shared__ double s_data[]; - double* s_R = s_data; - double* s_amp = s_data + blockDim.x; + __shared__ float s_R[SHAREMEMORY_FLOAT_HALF]; // עһblock_size ͬڴ + __shared__ float s_amp[SHAREMEMORY_FLOAT_HALF]; - const int tid = threadIdx.x; - const int prfId = blockIdx.x; - const int fId = tid; // ÿ̴߳һƵʵ + long tid = threadIdx.x; + long bid = blockIdx.x; + long idx = bid * blockDim.x + tid; + long prfId = idx / nextfreqNum; // ID + long fId = idx % nextfreqNum;//ƵID - double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq); - cuComplex echo = make_cuComplex(0.0f, 0.0f); + long psid = 0; + long pixelId = 0; + for (long ii = 0; ii < SHAREMEMORY_FLOAT_HALF_STEP; ii++) { // SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE=SHAREMEMORY_FLOAT_HALF + psid = ii * BLOCK_SIZE + tid; + pixelId = prfId * SHAREMEMORY_FLOAT_HALF + psid; + s_R[psid] = d_temp_R[pixelId]; + s_amp[psid] = d_temp_amps[pixelId]; - // ֿݲ - for (int block_offset = 0; block_offset < posNum; block_offset += blockDim.x) { - int psid = block_offset + tid; - int pixelId = prfId * posNum + psid; - - // صǰ鵽ڴ - if (psid < posNum) { - s_R[tid] = static_cast(d_temp_R[pixelId]); - s_amp[tid] = static_cast(d_temp_amps[pixelId]); - } - else { - s_R[tid] = 0.0f; - s_amp[tid] = 0.0f; - } - __syncthreads(); - - // 㵱ǰĹ - for (int dataid = 0; dataid < blockDim.x; ++dataid) { - float temp_phi =fmod( s_R[dataid] * factorjTemp,2*PI); - float temp_amp = s_amp[dataid]; - float sin_phi, cos_phi; - sincosf(temp_phi, &sin_phi, &cos_phi); - echo.x += temp_amp * cos_phi; - echo.y += temp_amp * sin_phi; - } - __syncthreads(); } - // ֻЧƵʵPRF - if (prfId < temp_PRF_Count && fId < FreqPoints && fId < maxfreqnum) { - const int echo_ID = prfId * maxfreqnum + fId; - atomicAdd(&echodata[echo_ID].x, echo.x); - atomicAdd(&echodata[echo_ID].y, echo.y); + __syncthreads(); // ȷдݶѾ + + + + + if (fId < maxfreqnum && prfId < temp_PRF_Count) { + + long echo_ID = prfId * maxfreqnum + fId; // ӦĻزλ + double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq); + cuComplex echo = make_cuComplex(0, 0); + + for (long dataid = 0; dataid < SHAREMEMORY_FLOAT_HALF; dataid++) { + + float temp_real = 0; + float temp_imag = 0; + double R = s_R[dataid]; + float temp_phi = fmod(R * factorjTemp, 2 * PI); + float temp_amp = s_amp[dataid]; + sincosf(temp_phi, &temp_imag, &temp_real); + echo.x = echo.x + (temp_amp * temp_real); + echo.y = echo.y + (temp_amp * temp_imag); + //if (dataid > 5000) { + // printf("echo_ID=%d; dataid=%d;ehodata=(%f,%f);R=%f;amp=%f;\n", echo_ID, dataid, temp_real, temp_imag, s_R[0], s_amp[0]); + //} + //if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y) + // || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y) + // ) { + // printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y); + //} + + } + + echodata[echo_ID] = cuCaddf(echodata[echo_ID], echo); + } } @@ -634,27 +649,28 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized( /** ֿ鴦 ****************************************************************************************************************/ -extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) +extern "C" void ProcessRFPCTask(RFPCTask& task, long devid, float* h_R, float* h_amp) { size_t pixelcount = task.prfNum * task.freqNum; size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; - printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE,task.prfNum); + printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE, task.prfNum); printf("Dev:%d ,freqnum%d , prfnum:%d ,Rref: %e ,Rnear : %e ,Rfar: %e , StartFreq: %e ,DeletFreq: %e \n", devid, task.freqNum, task.prfNum, task.Rref, task.Rnear, task.Rfar, task.startFreq, task.stepFreq); - double* d_R = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); - double* d_amps = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); + float* d_R = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid); + float* d_amps = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid); long BLOCK_FREQNUM = NextBlockPad(task.freqNum, BLOCK_SIZE); // 256*freqBlockID long cudaBlocknum = 0; - long freqpoints = BLOCK_FREQNUM; - - printf("freqpoints:%d\n", freqpoints); + long freqpoints = BLOCK_SIZE; + + printf("freqpoints:%d\n", task.freqNum); long prfcount = task.prfNum; long process = 0; for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) { + cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE; - Kernel_Computer_R_amp_NoAntPattern << > >( + Kernel_Computer_R_amp_NoAntPattern << > > ( task.antlist, prfcount, task.goallist, @@ -664,39 +680,29 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) task.Pt, task.Rref, task.Rnear, task.Rfar, - task.maxGain,task.GainWeight, + task.maxGain, task.GainWeight, d_R, d_amps// - ); + ); PrintLasterError("CUDA_Kernel_Computer_R_amp"); cudaDeviceSynchronize(); + //DeviceToHost(h_R, d_R, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + //DeviceToHost(h_amp, d_amps, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + //break; - dim3 blocks(task.prfNum); - dim3 threads(BLOCK_SIZE); - - size_t shared_mem_size = 2 * BLOCK_SIZE * sizeof(double); - - CUDA_Kernel_Computer_echo_NoAntPattern_Optimized << > > ( - d_R, d_amps, SHAREMEMORY_FLOAT_HALF, - task.startFreq/1e9, task.stepFreq / 1e9, - freqpoints, task.freqNum, - task.d_echoData, - task.prfNum - ); - - //cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE - 1) / BLOCK_SIZE; - //CUDA_Kernel_Computer_echo_NoAntPattern << > > ( - // d_R, d_amps, SHAREMEMORY_FLOAT_HALF, - // task.startFreq/1e9, task.stepFreq / 1e9, - // freqpoints, task.freqNum, - // task.d_echoData, - // task.prfNum - // ); + cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE- 1) / BLOCK_SIZE; + CUDA_Kernel_Computer_echo_NoAntPattern << > > ( + d_R, d_amps, + task.startFreq / 1e9, task.stepFreq / 1e9, + task.freqNum, BLOCK_FREQNUM, + task.d_echoData, + task.prfNum + ); PrintLasterError("CUDA_Kernel_Computer_echo"); cudaDeviceSynchronize(); - if ((sTi * 100.0 / task.targetnum) - process >= 10) { + if ((sTi * 100.0 / task.targetnum) - process >= 1) { process = sTi * 100.0 / task.targetnum; - PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n",devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum,devid); + PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n", devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum, devid); } } @@ -707,7 +713,7 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) FreeCUDADevice(d_amps); } - + #endif diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh index 48ec1be..0515694 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh @@ -16,11 +16,7 @@ extern "C" struct SateState { - double Px, Py, Pz, Vx, Vy, Vz; - //double antXaxisX, antXaxisY, antXaxisZ; - //double antYaxisX, antYaxisY, antYaxisZ; - //double antZaxisX, antZaxisY, antZaxisZ; - double antDirectX, antDirectY, antDirectZ; + double Px, Py, Pz, Vx, Vy, Vz,antDirectX, antDirectY, antDirectZ; }; @@ -152,7 +148,7 @@ extern "C" void CUDA_RFPC_MainProcess( extern "C" double* hostSigmaData_toDevice(int devid); -extern "C" void ProcessRFPCTask(RFPCTask& task,long devid); +extern "C" void ProcessRFPCTask(RFPCTask& task,long devid,float* h_R,float* h_amp); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu index 31b021b..2d7061d 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu @@ -24,152 +24,6 @@ -__global__ void kernel_TimeBPImageGridNet(double* antPx, double* antPy, double* antPz, - double* antDirx, double* antDiry, double* antDirz, - double* imgx, double* imgy, double* imgz, - long prfcount, long freqpoints, double meanH, - double Rnear, double dx, double RefRange) { - - long idx = blockIdx.x * blockDim.x + threadIdx.x; - long pixelcount = prfcount * freqpoints; - long prfid = idx / freqpoints; - long Rid = idx % freqpoints; - if (idx < pixelcount) { - // 计算坐标 - Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // 卫星位置 (m) - Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // 视线方向 - double H = meanH; // 平均高程 - double R = Rnear + dx * Rid; // 目标距离 - // 参数校验 - if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) { - //printf("参数错误:\n H范围:±%.1f km\n R必须>0\n", WGS84_A * 0.1 / 1000); - imgx[idx] = NAN; - imgy[idx] = NAN; - imgz[idx] = NAN; - //printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f,imgP=[%f ,%f , %f ];Rextend\n", - // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,imgx[idx],imgy[idx],imgz[idx]); - // 参数校验 - return; - } - - // Step 1: 计算交点T - Vector3 T = compute_T(S, ray, H); - if (isnan(T.x)) { - imgx[idx] = NAN; - imgy[idx] = NAN; - imgz[idx] = NAN; - //printf("idx=%d;prfid=%d;Rid=%d;Tnan\n", - // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,T.x,T.y,T.z, imgx[idx], imgy[idx], imgz[idx]); - return; - } - - // Step 2: 计算目标点P - - Vector3 P;// = compute_P(S, T, R, H); - { // 计算P - Vector3 ex, ey, ez; // 平面基函数 - Vector3 ST = vec_normalize(vec_sub(T, S));// S->T - Vector3 SO = vec_normalize(vec_sub(Vector3{ 0, 0, 0 }, S)); // S->O - - - Vector3 st1 = vec_sub(T, S); - double R0 = sqrt(st1.x * st1.x + st1.y * st1.y + st1.z * st1.z); - ez = vec_normalize(vec_cross(SO, ST)); // Z 轴 - ey = vec_normalize(vec_cross(ez, SO)); // Y 轴 与 ST 同向 --这个结论在星地几何约束,便是显然的; - ex = vec_normalize(SO); //X轴 - - - - double h2 = (WGS84_A + H) * (WGS84_A + H); - double b2 = WGS84_B * WGS84_B; - double R2 = R * R; - double A = R2 * ((ex.x * ex.x + ex.y * ex.y) / h2 + (ex.z * ex.z) / b2); - double B = R2 * ((ex.x * ey.x + ex.y * ey.y) / h2 + (ex.z * ey.z) / b2) * 2; - double C = R2 * ((ey.x * ey.x + ey.y * ey.y) / h2 + (ey.z * ey.z) / b2); - double D = 1 - ((S.x * S.x + S.y * S.y) / h2 + (S.z * S.z) / b2); - double E = 2*R * ((S.x * ex.x + S.y * ex.y) / h2 + (S.z * ex.z) / b2); - double F = 2*R * ((S.x * ey.x + S.y * ey.y) / h2 + (S.z * ey.z) / b2); - double Q0 = angleBetweenVectors(SO, ST, false); - double dQ = 0; - double fQ = 0; - double dfQ = 0; - double Q = R < R0 ? Q0 - 1e-3 : Q0 + 1e-3; - - //printf("A=%f;B=%f;C=%f;D=%f;E=%f;F=%f;Q=%f;\ - // S=[%f , %f ,%f ];\ - // T=[%f , %f ,%f ];\ - // ex=[%f , %f ,%f ];\ - // ey=[%f , %f ,%f ];\ - // ez=[%f , %f ,%f ];\ - //ray=[%f ,%f ,%f ];\ - //H=%f;R=%f;;\n",A,B,C,D,E,F,Q, - // S.x,S.y,S.z, - // T.x,T.y,T.z , - // ex.x,ex.y,ex.z, - // ey.x,ey.y,ey.z, - // ez.x,ez.y,ez.z, - // ray.x, ray.y, ray.z, - // H, R); - // return; - - // 牛顿迭代法 - for (int iter = 0; iter < MAX_ITER * 10; ++iter) { - fQ = A * cos(Q) * cos(Q) + B * sin(Q) * cos(Q) + C * sin(Q) * sin(Q) + E * cos(Q) + F * sin(Q) - D; - dfQ = (C - A) * sin(2 * Q) + B * cos(2 * Q) - E * sin(Q) + F * cos(Q); - dQ = fQ / dfQ; - if (abs(dQ) < 1e-8) { - //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;break\n", iter, Q0, Q, dQ, fQ, dfQ); - break; - } - else { - dQ = (abs(dQ) < d2r * 3) ? dQ :( abs(dQ) / dQ * d2r* 3); - Q = Q - dQ; - //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;\n", iter, Q0, Q, dQ, fQ, dfQ); - } - - } - //printf("check Q0=%f;Q=%f;\n", Q0, Q); - double t1 = R * cos(Q); - double t2 = R * sin(Q); - P = Vector3{ - S.x + t1 * ex.x + t2 * ey.x, //因为 t3=0; - S.y + t1 * ex.y + t2 * ey.y, - S.z + t1 * ex.z + t2 * ey.z, - }; - double check = (P.x * P.x + P.y * P.y) / ((WGS84_A + H) * (WGS84_A + H)) - + P.z * P.z / (WGS84_B * WGS84_B); - if (isnan(Q) || isinf(Q) || fabs(check - 1.0) > 1e-6) { - P = Vector3{ NAN,NAN,NAN }; - } - } - - double Rt = sqrt(pow(S.x - T.x, 2) + pow(S.y - T.y, 2) + pow(S.z - T.z, 2)); - double Rp = sqrt(pow(S.x - P.x, 2) + pow(S.y - P.y, 2) + pow(S.z - P.z, 2)); - double Rop = sqrt(pow( P.x, 2) + pow( P.y, 2) + pow( P.z, 2)); - - if (!isnan(P.x)&&( Rop>WGS84_A*0.3)&&(Rop> > ( - antPx, antPy, antPz, - antDirx, antDiry, antDirz, - imgx, imgy, imgz, - prfcount, freqpoints, meanH, - Rnear, dx, RefRange); - PrintLasterError("TIMEBPCreateImageGrid"); - cudaDeviceSynchronize(); - } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh index 91314b9..f7d6989 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh @@ -11,15 +11,6 @@ -extern "C" void TIMEBPCreateImageGrid( - double* antPx,double* antPy,double* antPz, // S - double* antDirx,double* antDiry,double* antDirz, // - double* imgx,double* imgy,double* imgz, - long prfcount,long freqpoints,double meanH, - double Rnear,double dx,double RefRange -); - - extern "C" void TimeBPImage( double* antPx, double* antPy, double* antPz, diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp new file mode 100644 index 0000000..a0a1d66 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp @@ -0,0 +1,74 @@ +#include "QEcoherentAndAdditive.h" +#include "ui_QEcoherentAndAdditive.h" +#include +#include + + +QEcoherentAndAdditiveDialog::QEcoherentAndAdditiveDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QEcoherentAndAdditiveClass) +{ + ui->setupUi(this); + + QObject::connect(ui->pushButtonEchoDataAddSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataAddSelectClicked())); + QObject::connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelectClicked())); + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected())); + } + +QEcoherentAndAdditiveDialog::~QEcoherentAndAdditiveDialog() +{} + +void QEcoherentAndAdditiveDialog::onpushButtonEchoDataAddSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡӰļ"), // + QString(), // Ĭ· + tr(u8"xml Files (*.xml);;All Files (*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditEchoDataAddPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QEcoherentAndAdditiveDialog::onpushButtonEchoDataSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // + tr(u8"ѡӰļ"), // + QString(), // Ĭ· + tr(u8"xml Files (*.xml);;All Files (*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + this->ui->lineEditEchoDataAdd2Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QEcoherentAndAdditiveDialog::onaccepted() +{ + QString echo1Path = this->ui->lineEditEchoDataAddPath->text(); + QString echo2Path = this->ui->lineEditEchoDataAdd2Path->text(); + + + + + + QMessageBox::information(this, tr(u8"ʾ"), tr(u8"")); +} + +void QEcoherentAndAdditiveDialog::onrejected() +{ +} diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h new file mode 100644 index 0000000..4b53e85 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + + +namespace Ui { + class QEcoherentAndAdditiveClass; +} + +class QEcoherentAndAdditiveDialog : public QDialog +{ + Q_OBJECT + +public: + QEcoherentAndAdditiveDialog(QWidget *parent = nullptr); + ~QEcoherentAndAdditiveDialog(); + + +public slots: + + void onpushButtonEchoDataAddSelectClicked(); + void onpushButtonEchoDataSelectClicked(); + void onaccepted(); + void onrejected(); + +private: + Ui::QEcoherentAndAdditiveClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui new file mode 100644 index 0000000..bf67d40 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui @@ -0,0 +1,126 @@ + + + QEcoherentAndAdditiveClass + + + + 0 + 0 + 747 + 239 + + + + 仿真回波叠加 + + + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 带叠加回波: + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + 被叠加回波 + + + + + + + + 0 + 30 + + + + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui index 3d6693a..9ff2ec6 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui @@ -103,7 +103,7 @@ - D:/FZSimulation/LTDQ/Input/LandCover.dat + D:/FZSimulation/LTDQ/Input/DEM30/LandCover.dat @@ -233,7 +233,7 @@ - D:/FZSimulation/LTDQ/Input/DEM_XYZ.dat + D:/FZSimulation/LTDQ/Input/DEM30/DEM_XYZ.dat @@ -350,7 +350,7 @@ - D:/FZSimulation/LTDQ/Input/DEM_Sloper.dat + D:/FZSimulation/LTDQ/Input/DEM30/DEM_Sloper.dat diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp index d70ccfd..918731d 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp @@ -12,6 +12,9 @@ QSimulationBPImage::QSimulationBPImage(QWidget *parent) : QDialog(parent),ui(new Ui::QSimulationBPImageClass) { ui->setupUi(this); + ui->checkBox->setEnabled(false); + ui->checkBox->setCheckable(true); + ui->checkBox->setChecked(true); QObject::connect(ui->pushButtonEchoSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoSelectClicked())); QObject::connect(ui->pushButtonImageSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageSelectClicked())); @@ -97,12 +100,8 @@ void QSimulationBPImage::onbtnaccepted() TBPimag.setImageL1(imagL1); long cpucore_num = std::thread::hardware_concurrency(); TBPimag.setGPU(true); - if (ui->checkBox->isChecked()) { - TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed()); - } - else { - TBPimag.Process(cpucore_num); - } + TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed()); + this->show(); QMessageBox::information(this,u8"",u8""); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui index 39d7fa4..79f3686 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui @@ -6,7 +6,7 @@ 0 0 - 995 + 813 400 diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index 65b8203..e8ae0b6 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -929,6 +929,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU() { ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern() { + + int num_devices = 0; cudaGetDeviceCount(&num_devices); PRINT("GPU Count : %d \n", num_devices); @@ -943,7 +945,11 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern() std::shared_ptr sateOirbtNodes = this->getSatelliteOribtNodes(prf_time, dt, antflag, imageStarttime); - + for (int devid = 0; devid < num_devices; devid++) { + printf("GPU ID: %d \n", devid); + printDeviceInfo(devid); + printf("----------------------------------------\n"); + } #pragma omp parallel for for (int devid = 0; devid < num_devices; devid++) { @@ -969,6 +975,16 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si std::map clssigmaParamsDict = this->SigmaDatabasePtr->getsigmaParams(polartype);; std::map clsCUDASigmaParamsDict; for (const auto& pair : clssigmaParamsDict) { + + if (abs(pair.second.p1)<1e-5&& + abs(pair.second.p2) < 1e-5 && + abs(pair.second.p3) < 1e-5 && + abs(pair.second.p4) < 1e-5 && + abs(pair.second.p5) < 1e-5 && + abs(pair.second.p6) < 1e-5) { + continue; + } + clsCUDASigmaParamsDict.insert(std::pair(pair.first, CUDASigmaParam{ float(pair.second.p1), @@ -994,7 +1010,7 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si gdalImage demlandcls(this->LandCoverPath);// 地表覆盖类型 gdalImage slpxyz(this->demsloperPath);// 地面坡向 - long allDemRow = Memory1MB/demxyz.width/8/3*6000; + long allDemRow = Memory1GB/demxyz.width/8/3*6; //allDemRow = allDemRow < demxyz.height ? allDemRow : demxyz.height; for(long demId=0;demId< demxyz.height;demId=demId+ allDemRow){ @@ -1114,19 +1130,41 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si task.antlist = (SateState*)mallocCUDADevice(prfcount * sizeof(SateState), devId); HostToDevice(h_antlist.get(), task.antlist, sizeof(SateState) * prfcount); - + printf("h_antlist: %e,%e,%e,%e,%e,%e,%e,%e,%e \n", + h_antlist.get()[0].Px, h_antlist.get()[0].Py, h_antlist.get()[0].Pz, + h_antlist.get()[0].Vx, h_antlist.get()[0].Vy, h_antlist.get()[0].Vz, + h_antlist.get()[0].antDirectX, h_antlist.get()[0].antDirectY, h_antlist.get()[0].antDirectZ + ); + //testOutAmpArr(QString("antlist_%1.dat").arg(devId), (double*)(h_antlist.get()), prfcount, 9); } + + float* h_R = (float*)mallocCUDAHost(sizeof(float) * prfcount * SHAREMEMORY_FLOAT_HALF); //2GB 距离 + float* h_amp = (float*)mallocCUDAHost(sizeof(float) * prfcount * SHAREMEMORY_FLOAT_HALF);//2GB 强度 + // 分块计算 for (const auto& pair : clsGoalStateDict) { long clsid = pair.first; + task.sigma0_cls = clsCUDASigmaParamsDict[clsid]; size_t clscount = clsCountDict[clsid]; - PRINT("Process Class ID : %d , Count: %d Device: %d\n", clsid, clscount,devId); + PRINT("Process Class ID : %d , Count: %d Device: %d , sigma Prams :[%f,%f,%f,%f,%f,%F]\n", clsid, clscount,devId, + task.sigma0_cls.p1, task.sigma0_cls.p2, task.sigma0_cls.p3, task.sigma0_cls.p4, task.sigma0_cls.p5, task.sigma0_cls.p6); + if (abs(task.sigma0_cls.p1) < 1e-6 && + abs(task.sigma0_cls.p2) < 1e-6 && + abs(task.sigma0_cls.p3) < 1e-6 && + abs(task.sigma0_cls.p4) < 1e-6 && + abs(task.sigma0_cls.p5) < 1e-6 && + abs(task.sigma0_cls.p6) < 1e-6) { + continue; + } task.targetnum = clscount; task.goallist = (GoalState*)mallocCUDADevice(clscount * sizeof(GoalState), devId); HostToDevice(clsGoalStateDict[clsid].get(), task.goallist, sizeof(GoalState) * clscount); - task.sigma0_cls = clsCUDASigmaParamsDict[clsid]; - ProcessRFPCTask(task, devId); + + ProcessRFPCTask(task, devId, h_R, h_amp); + //testOutDataArr(QString("h_R_%1.bin").arg(devId), h_R, prfcount, SHAREMEMORY_FLOAT_HALF); + //testOutDataArr(QString("h_amp_%1.bin").arg(devId), h_amp, prfcount, SHAREMEMORY_FLOAT_HALF); + //exit(-1); FreeCUDADevice(task.goallist); } @@ -1137,7 +1175,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si FreeCUDADevice(task.d_echoData); FreeCUDADevice(task.antlist); //FreeCUDADevice(task.goallist); - + FreeCUDAHost(h_R); + FreeCUDAHost(h_amp); } PRINT("dem cover processbar: [100 precent]\n"); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp index fb99f27..6ad68c4 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp @@ -467,12 +467,12 @@ void PolyfitSatelliteOribtModel::saveToXml(const QString& filePath) { // Write polyfit parameters xmlWriter.writeStartElement("PolyfitParameters"); - xmlWriter.writeAttribute("Pxchisq", QString::number(Pxchisq)); - xmlWriter.writeAttribute("Pychisq", QString::number(Pychisq)); - xmlWriter.writeAttribute("Pzchisq", QString::number(Pzchisq)); - xmlWriter.writeAttribute("Vxchisq", QString::number(Vxchisq)); - xmlWriter.writeAttribute("Vychisq", QString::number(Vychisq)); - xmlWriter.writeAttribute("Vzchisq", QString::number(Vzchisq)); + xmlWriter.writeAttribute("Pxchisq", QString::number(Pxchisq,'e',35)); + xmlWriter.writeAttribute("Pychisq", QString::number(Pychisq,'e',35)); + xmlWriter.writeAttribute("Pzchisq", QString::number(Pzchisq,'e',35)); + xmlWriter.writeAttribute("Vxchisq", QString::number(Vxchisq,'e',35)); + xmlWriter.writeAttribute("Vychisq", QString::number(Vychisq,'e',35)); + xmlWriter.writeAttribute("Vzchisq", QString::number(Vzchisq,'e',35)); writeVector(xmlWriter, "polyfitPx", polyfitPx); writeVector(xmlWriter, "polyfitPy", polyfitPy); @@ -491,7 +491,7 @@ void PolyfitSatelliteOribtModel::saveToXml(const QString& filePath) { void PolyfitSatelliteOribtModel::writeVector(QXmlStreamWriter& xmlWriter, const QString& name, const std::vector& vec) { xmlWriter.writeStartElement(name); for (double val : vec) { - xmlWriter.writeTextElement("Value", QString::number(val)); + xmlWriter.writeTextElement("Value", QString::number(val,'e',35)); } xmlWriter.writeEndElement(); } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp index dbd5f65..8f612f7 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp @@ -30,50 +30,66 @@ SigmaDatabase::SigmaDatabase() this->VH_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); this->VV_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); + this->HH_sigmaParam.insert(std::pair(112, SigmaParam{ 30.5876,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(113, SigmaParam{ 37.6313,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(114, SigmaParam{ 42.6288,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(115, SigmaParam{ 46.5052,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(116, SigmaParam{ 49.6725,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(117, SigmaParam{ 52.3504,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(118, SigmaParam{ 54.67,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(119, SigmaParam{ 56.7161,0,0, 0, 0,0 })); // Lζ + this->HH_sigmaParam.insert(std::pair(120, SigmaParam{ 58.5464,0,0, 0, 0,0 })); // Lζ + + + this->HH_sigmaParam.insert(std::pair(10, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); + this->HH_sigmaParam.insert(std::pair(20, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); + this->HH_sigmaParam.insert(std::pair(40, SigmaParam{ 50.97, -62.9, -0.0968, 1.604, -4.637, 6.108 })); + this->HH_sigmaParam.insert(std::pair(60, SigmaParam{ -32.45, 23.3097, 3.187, -2.482, 8.244, 0.3632 })); + ////12 - //this->HH_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, - 1.11157376729893, - 15.8022895411007, 11.4690828129602 })); + this->HH_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, - 1.11157376729893, - 15.8022895411007, 11.4690828129602 })); //this->HV_sigmaParam.insert(std::pair(12, SigmaParam{ -30.0103645753547, 27.1700862271921, 11.8007376386356, - 0.933835390422269, - 16.4640776105300, 11.8318838032267 })); //this->VH_sigmaParam.insert(std::pair(12, SigmaParam{ -30.0103645753547, 27.1700862271921, 11.8007376386356, -0.933835390422269, -16.4640776105300, 11.8318838032267 })); //this->VV_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); ////22 - //this->HH_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, - 2.68482232690106, 6.29783274559538, 1.96648609622833 })); + this->HH_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, - 2.68482232690106, 6.29783274559538, 1.96648609622833 })); //this->HV_sigmaParam.insert(std::pair(22, SigmaParam{ -36.3971634075803, 13.1296247093899, 1.12707368693158, - 1.88195857790977, 6.57450737122974, 2.11755051297951 })); //this->VH_sigmaParam.insert(std::pair(22, SigmaParam{ -36.3971634075803, 13.1296247093899, 1.12707368693158, -1.88195857790977, 6.57450737122974, 2.11755051297951 })); //this->VV_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); ////30 - //this->HH_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, - 3.93463636916976, 5.99799798331127, - 10.3772604045974 })); + this->HH_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, - 3.93463636916976, 5.99799798331127, - 10.3772604045974 })); //this->HV_sigmaParam.insert(std::pair(30, SigmaParam{ -55.1864353240982, 32.2453149408716, 0.333758208816865, - 3.38774208141056, 6.12774897769798, - 10.1192846531823 })); //this->VH_sigmaParam.insert(std::pair(30, SigmaParam{ -55.1864353240982, 32.2453149408716, 0.333758208816865, - 3.38774208141056, 6.12774897769798, - 10.1192846531823 })); //this->VV_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, -3.93463636916976, 5.99799798331127, -10.3772604045974 })); ////50 - //this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); + this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 30.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); //this->HV_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, - 4.10303899418773, 8.04893424718507, - 3.17171678851531 })); //this->VH_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, -4.10303899418773, 8.04893424718507, -3.17171678851531 })); //this->VV_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, -0.970580847008280, 28.9025325818511, -21.4319176514170 })); ////61 - //this->HH_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, - 5.10400310274333 })); + this->HH_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, - 5.10400310274333 })); //this->HV_sigmaParam.insert(std::pair(61, SigmaParam{ -65.9799383836613, 106.831320929437, 1.53821651203361, 0.704332523237733, 36.3654715437260, - 13.7449876973719 })); //this->VH_sigmaParam.insert(std::pair(61, SigmaParam{ -65.9799383836613, 106.831320929437, 1.53821651203361, 0.704332523237733, 36.3654715437260, -13.7449876973719 })); //this->VV_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, -5.10400310274333 })); ////62 - //this->HH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, - 2.83950292185421, 10.3519995095232, 2.75293811408200 })); + this->HH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, - 2.83950292185421, 10.3519995095232, 2.75293811408200 })); //this->HV_sigmaParam.insert(std::pair(62, SigmaParam{ -34.0710914034599, 14.1778732014224, 3.47049853590805, - 1.73813229616801, 10.9627971440838, 2.19731364578002 })); //this->VH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.0710914034599, 14.1778732014224, 3.47049853590805, -1.73813229616801, 10.9627971440838, 2.19731364578002 })); //this->VV_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, -2.83950292185421, 10.3519995095232, 2.75293811408200 })); ////80 - //this->HH_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, - 7.80014668607246, 0.0880097904597720, - 5.44564720816575, - 0.530358195545799, 1.04332202699956 })); + this->HH_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, - 7.80014668607246, 0.0880097904597720, - 5.44564720816575, - 0.530358195545799, 1.04332202699956 })); //this->HV_sigmaParam.insert(std::pair(80, SigmaParam{ 484.928701445606, - 0.992170190244375, - 1.98914783519718, - 507.127544388772, 0.195180814149377, 6.21339949756719 })); //this->VH_sigmaParam.insert(std::pair(80, SigmaParam{ 484.928701445606, -0.992170190244375, -1.98914783519718, -507.127544388772, 0.195180814149377, 6.21339949756719 })); //this->VV_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, -7.80014668607246, 0.0880097904597720, -5.44564720816575, -0.530358195545799, 1.04332202699956 })); ////90 - //this->HH_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); + this->HH_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); //this->HV_sigmaParam.insert(std::pair(90, SigmaParam{ -26.8776515733889, 10.4251866500052, 8.43273666535992, 4.33165922141213, 8.68204389555939, - 2.51718779582920 })); //this->VH_sigmaParam.insert(std::pair(90, SigmaParam{ -26.8776515733889, 10.4251866500052, 8.43273666535992, 4.33165922141213, 8.68204389555939, - 2.51718779582920 })); //this->VV_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 8286a6b..235ad8c 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -14,171 +14,6 @@ #include -void CreatePixelXYZ(std::shared_ptr echoL0ds, QString outPixelXYZPath) -{ - long bandwidth = echoL0ds->getBandwidth(); - double Rnear = echoL0ds->getNearRange(); - double Rfar = echoL0ds->getFarRange(); - double refRange = echoL0ds->getRefPhaseRange(); - double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b - - - // 创建坐标系统 - 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; - gdalImage xyzRaster = CreategdalImage(outPixelXYZPath, prfcount, freqcount, 3, gt, QString(""), false, true,true,GDT_Float64); - std::shared_ptr antpos = echoL0ds->getAntPos(); - dx = (echoL0ds->getFarRange()-echoL0ds->getNearRange())/(echoL0ds->getPlusePoints()-1); - Rnear = echoL0ds->getNearRange(); - double Rref = echoL0ds->getRefPhaseRange(); - double centerInc = echoL0ds->getCenterAngle()*d2r; - long echocol = Memory1GB * 1.0 / 8 / 4 / prfcount * 6; - qDebug() << "echocol:\t " << echocol ; - echocol = echocol < 1 ? 1: echocol; - - - std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double)*prfcount), FreeCUDAHost); - std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - - { - std::shared_ptr 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]; // 卫星坐标 - 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;// 归一化 - } - antpos.reset(); - } - - std::shared_ptr d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - - 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); - 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); - - - for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) { - - 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 ; - - std::shared_ptr demx = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demy = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demz = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - - std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); - std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); - std::shared_ptr 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]; - } - } - - std::shared_ptr d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - - 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); - - - 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(), - prfcount, tempechocol, 1000, - Rnear+dx* startcolidx, dx, refRange // 更新最近修读 - ); - - 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] ; - } - } - - xyzRaster.saveImage(demx, 0, startcolidx,prfcount,tempechocol, 1); - xyzRaster.saveImage(demy, 0, startcolidx,prfcount,tempechocol, 2); - xyzRaster.saveImage(demz, 0, startcolidx,prfcount,tempechocol, 3); - } - -} - -void TBPImageProcess(QString echofile, QString outImageFolder, QString imagePlanePath,long num_thread) -{ - std::shared_ptr 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()); - - imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints()); - - - TBPImageAlgCls TBPimag; - TBPimag.setEchoL0(echoL0ds); - TBPimag.setImageL1(imagL1); - TBPimag.setImagePlanePath(imagePlanePath); - - TBPimag.Process(num_thread); -} - - void TBPImageAlgCls::setImagePlanePath(QString INimagePlanePath) { @@ -209,20 +44,7 @@ std::shared_ptr TBPImageAlgCls::getImageL0() { return this->L1ds; } - -ErrorCode TBPImageAlgCls::Process(long num_thread) -{ - - qDebug() << u8"开始成像"; - - - qDebug() << u8"创建成像平面的XYZ"; - QString outRasterXYZ = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_xyz.bin"); - CreatePixelXYZ(this->L0ds, outRasterXYZ); - return this->ProcessWithGridNet(num_thread, outRasterXYZ); - -} ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPath) { @@ -259,6 +81,10 @@ ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPa } + // 处理成像映射 + CopyProjectTransformMatrixFromRasterAToRasterB(this->outRasterXYZPath, this->L1ds->getImageRasterPath()); + + qDebug() << u8"频域回波-> 时域回波 结束"; if (GPURUN) { @@ -268,6 +94,9 @@ ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPa QMessageBox::information(nullptr, u8"提示", u8"目前只支持显卡"); return ErrorCode::FAIL; } + + + return ErrorCode::SUCCESS; } @@ -290,7 +119,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() size_t img_rowCont = L1ds->getrowCount(); size_t img_colCont = L1ds->getcolCount(); - size_t block_imgRowCount = Memory1GB / img_colCont / 8 / 3 * 1;// 4GB-- 可以分配内存 + size_t block_imgRowCount = Memory1GB / img_colCont / 8 / 3 * 12;// 4GB-- 可以分配内存 gdalImage demgridimg(imgXYZPath); gdalImageComplex im_finalds(outimgDataPath); @@ -337,6 +166,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() h_data.AntZ = (double*)mallocCUDAHost(sizeof(double) * block_pfrcount); qDebug() << "r_vec [0]:\t" << h_data.r_vec[0]; + qDebug() << "r_vec [end]:\t" << h_data.r_vec[h_data.Nfft-1]; qDebug() << "Range resolution(m):\t" << step; qDebug() << "range Scence(m):\t" << maxWr; qDebug() << "start Freq:\t" << centerFreq - bandwidth / 2; @@ -355,10 +185,24 @@ ErrorCode TBPImageAlgCls::ProcessGPU() std::shared_ptr demX = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); std::shared_ptr demY = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); std::shared_ptr demZ = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demR= demgridimg.band_num==3? + readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD): + readDataArr(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); h_data.z_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); + h_data.R_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); + h_data.nx = img_blockColCount; h_data.ny = img_blockRowCount; @@ -367,6 +211,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() h_data.x_mat[i * h_data.nx + j] = demX.get()[i * h_data.nx + j]; h_data.y_mat[i * h_data.nx + j] = demY.get()[i * h_data.nx + j]; h_data.z_mat[i * h_data.nx + j] = demZ.get()[i * h_data.nx + j]; + h_data.R_mat[i * h_data.nx + j] = demR.get()[i * h_data.nx + j]; } } @@ -465,7 +310,7 @@ void TBPImageAlgCls::EchoFreqToTime() gdalImageComplex outTimeEchoImg = CreategdalImageComplexNoProj(this->TimeEchoDataPath, this->TimeEchoRowCount, this->TimeEchoColCount, 1); // 分块 - long echoBlockline = Memory1GB / 8 / 2 / outColCount * 3; //1GB + long echoBlockline = Memory1GB / 8 / 2 / outColCount *2; //1GB echoBlockline = echoBlockline < 1 ? 1 : echoBlockline; @@ -489,6 +334,7 @@ void TBPImageAlgCls::EchoFreqToTime() host_echoArr.get()[ii * outColCount + jj] = make_cuComplex(echoArr.get()[ii * inColCount + jj].real(), echoArr.get()[ii * inColCount + jj].imag()); } } + #pragma omp parallel for for (long ii = 0; ii < tempechoBlockline * outColCount; ii++) { host_IFFTechoArr.get()[ii] = make_cuComplex(0, 0); @@ -537,3 +383,149 @@ bool TBPImageAlgCls::checkZeros(double* data, long long len) return flag; } + + + +// + +// +//void CreatePixelXYZ(std::shared_ptr echoL0ds, QString outPixelXYZPath) +//{ +// long bandwidth = echoL0ds->getBandwidth(); +// double Rnear = echoL0ds->getNearRange(); +// double Rfar = echoL0ds->getFarRange(); +// double refRange = echoL0ds->getRefPhaseRange(); +// double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b +// +// +// // 创建坐标系统 +// 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; +// gdalImage xyzRaster = CreategdalImage(outPixelXYZPath, prfcount, freqcount, 3, gt, QString(""), false, true,true,GDT_Float64); +// std::shared_ptr antpos = echoL0ds->getAntPos(); +// dx = (echoL0ds->getFarRange()-echoL0ds->getNearRange())/(echoL0ds->getPlusePoints()-1); +// Rnear = echoL0ds->getNearRange(); +// double Rref = echoL0ds->getRefPhaseRange(); +// double centerInc = echoL0ds->getCenterAngle()*d2r; +// long echocol = Memory1GB * 1.0 / 8 / 4 / prfcount * 6; +// qDebug() << "echocol:\t " << echocol ; +// echocol = echocol < 1 ? 1: echocol; +// +// +// std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double)*prfcount), FreeCUDAHost); +// std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// +// { +// std::shared_ptr 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]; // 卫星坐标 +// 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;// 归一化 +// } +// antpos.reset(); +// } +// +// std::shared_ptr d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// +// 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); +// 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); +// +// +// for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) { +// +// 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 ; +// +// std::shared_ptr demx = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// std::shared_ptr demy = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// std::shared_ptr demz = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// +// std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); +// std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); +// std::shared_ptr 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]; +// } +// } +// +// std::shared_ptr d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); +// std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); +// std::shared_ptr d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); +// +// 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); +// +// +// 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(), +// prfcount, tempechocol, 0, +// Rnear+dx* startcolidx, dx, refRange // 更新最近修读 +// ); +// +// 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] ; +// } +// } +// +// xyzRaster.saveImage(demx, 0, startcolidx,prfcount,tempechocol, 1); +// xyzRaster.saveImage(demy, 0, startcolidx,prfcount,tempechocol, 2); +// xyzRaster.saveImage(demz, 0, startcolidx,prfcount,tempechocol, 3); +// } +// +//} + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h index 61b925c..4fe8618 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h @@ -50,7 +50,7 @@ public: std::shared_ptr getImageL0(); public: - ErrorCode Process(long num_thread); + ErrorCode ProcessWithGridNet(long num_thread, QString xyzRasterPath); void setGPU(bool flag); bool getGPU(); @@ -69,23 +69,3 @@ private:// private: bool checkZeros(double* data, long long len); }; - - - - -void CreatePixelXYZ(std::shared_ptr echoL0ds,QString outPixelXYZPath); - - -void TBPImageProcess(QString echofile,QString outImageFolder,QString imagePlanePath,long num_thread); - -// -//void TBPImageGridNet( -// std::shared_ptr antPx, std::shared_ptr antPy, std::shared_ptr antPz, -// std::shared_ptr img_x, std::shared_ptr img_y, std::shared_ptr img_z, -// std::shared_ptr> echoArr, -// std::shared_ptr> img_arr, -// double freq, double dx, double Rnear, double Rfar, double refRange, -// long rowcount, long colcount, -// long prfcount, long freqcount, -// long startPRFId, long startRowID -//); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index e726c24..0065394 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -7,6 +7,46 @@ #include "QCreateSARIntensityByLookTableDialog.h" #include "QtSimulationGeoSARSigma0Dialog.h" #include "QtLinearToIntenisityDialog.h" +#include "InitCreateImageXYZDialog.h" +#include "ImagePlaneAtiInterpDialog.h" +#include "QCreateInSARImagePlaneXYZRDialog.h" +#include "QLookTableResampleFromWGS84ToRange.h" +#include "QSARSimulationComplexEchoDataDialog.h" +#include "QSimulationBPImageMultiProduction.h" +#include "QLonLatInterpAtiFromDEM.h" +#include "QL1ASARProcessDialog.h" + +#include "SimulationSARToolSARSatalliteSimulationWorkflow.h" + +void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) +{ + emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); // 300 + emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSimulationBPImageMultiProductionToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QLonLatInterpAtiFromDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QL1ASARProcessDialogToolButton(toolbox)); + +#ifdef __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ + + initSimulationSARToolSARSateSimulationWorkflow(toolbox); +#endif + + + +} + + SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) { @@ -66,18 +106,6 @@ void QSimulationSAROrbitModelToolButton::excute() -void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) -{ - emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); - -} - LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent) { this->toolPath = QVector(0); @@ -141,4 +169,159 @@ void QtLinearToIntenisityToolButton::excute() { QtLinearToIntenisityDialog* dialog = new QtLinearToIntenisityDialog; dialog->show(); -} \ No newline at end of file +} + +InitCreateImageXYZToolButton::InitCreateImageXYZToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"1.ƽ"); +} + +InitCreateImageXYZToolButton::~InitCreateImageXYZToolButton() +{ + +} + +void InitCreateImageXYZToolButton::run() +{ + InitCreateImageXYZDialog* dialog = new InitCreateImageXYZDialog; + dialog->show(); +} + +ImagePlaneAtiInterpToolButton::ImagePlaneAtiInterpToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"2.ƽӳDEM"); +} +ImagePlaneAtiInterpToolButton::~ImagePlaneAtiInterpToolButton() +{ +} + +void ImagePlaneAtiInterpToolButton::run() +{ + ImagePlaneAtiInterpDialog* dialog = new ImagePlaneAtiInterpDialog; + dialog->show(); +} + +QCreateInSARImagePlaneXYZRToolButton::QCreateInSARImagePlaneXYZRToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"InSAR湤߿"); + this->toolname = QString(u8"1.InSARؾƽ"); +} + +QCreateInSARImagePlaneXYZRToolButton::~QCreateInSARImagePlaneXYZRToolButton() +{ +} + +void QCreateInSARImagePlaneXYZRToolButton::run() +{ + QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog; + dialog->show(); +} + +QInSARBPImageToolButton::QInSARBPImageToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"InSAR湤߿"); + this->toolname = QString(u8"2.InSARؾBP"); +} + +QInSARBPImageToolButton::~QInSARBPImageToolButton() +{ +} + +void QInSARBPImageToolButton::run() +{ + QSimulationBPImage* dialog = new QSimulationBPImage; + dialog->show(); +} + +QLookTableResampleFromWGS84ToRangeToolButton::QLookTableResampleFromWGS84ToRangeToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"湤߿"); + this->toolname = QString(u8"ұķֵ"); +} + +QLookTableResampleFromWGS84ToRangeToolButton::~QLookTableResampleFromWGS84ToRangeToolButton() +{ +} + +void QLookTableResampleFromWGS84ToRangeToolButton::run() +{ + QLookTableResampleFromWGS84ToRange* dialog = new QLookTableResampleFromWGS84ToRange; + dialog->show(); +} + +//QSARSimulationComplexEchoDataDialog + +QSARSimulationComplexEchoDataDialogToolButton::QSARSimulationComplexEchoDataDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"زߣԣ"); +} + +QSARSimulationComplexEchoDataDialogToolButton::~QSARSimulationComplexEchoDataDialogToolButton() +{ +} + +void QSARSimulationComplexEchoDataDialogToolButton::run() +{ + QSARSimulationComplexEchoDataDialog* dialog = new QSARSimulationComplexEchoDataDialog; + dialog->show(); +} + +QSimulationBPImageMultiProductionToolButton::QSimulationBPImageMultiProductionToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"1-2Ʒ"); +} + +QSimulationBPImageMultiProductionToolButton::~QSimulationBPImageMultiProductionToolButton() +{ +} + +void QSimulationBPImageMultiProductionToolButton::run() +{ + QSimulationBPImageMultiProduction* dialog = new QSimulationBPImageMultiProduction; + dialog->show(); +} + +QLonLatInterpAtiFromDEMToolButton::QLonLatInterpAtiFromDEMToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"бƽ"); +} + +QLonLatInterpAtiFromDEMToolButton::~QLonLatInterpAtiFromDEMToolButton() +{ +} + +void QLonLatInterpAtiFromDEMToolButton::run() +{ + QLonLatInterpAtiFromDEM* dialog = new QLonLatInterpAtiFromDEM; + dialog->show(); +} + +QL1ASARProcessDialogToolButton::QL1ASARProcessDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"񹤾߿"); + this->toolname = QString(u8"L1BƷ"); +} + +QL1ASARProcessDialogToolButton::~QL1ASARProcessDialogToolButton() +{ +} + +void QL1ASARProcessDialogToolButton::run() +{ + QL1ASARProcessDialog* dialog = new QL1ASARProcessDialog; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index ae6cf44..9c20a47 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -13,6 +13,10 @@ namespace LAMPMainWidget { class ToolBoxWidget; +extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + + + class SIMULATIONSARTOOL_EXPORT SARSimlulationRFPCToolButton : public QToolAbstract { Q_OBJECT @@ -98,8 +102,104 @@ public slots: }; +class SIMULATIONSARTOOL_EXPORT InitCreateImageXYZToolButton : public QToolAbstract { + Q_OBJECT +public: + InitCreateImageXYZToolButton(QWidget* parent = nullptr); + ~InitCreateImageXYZToolButton(); +public : + virtual void run() override; + +}; -extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); +class SIMULATIONSARTOOL_EXPORT ImagePlaneAtiInterpToolButton : public QToolAbstract { + Q_OBJECT +public: + ImagePlaneAtiInterpToolButton(QWidget* parent = nullptr); + ~ImagePlaneAtiInterpToolButton(); +public: + virtual void run() override; + +}; +class SIMULATIONSARTOOL_EXPORT QCreateInSARImagePlaneXYZRToolButton : public QToolAbstract { + Q_OBJECT +public: + QCreateInSARImagePlaneXYZRToolButton(QWidget* parent = nullptr); + ~QCreateInSARImagePlaneXYZRToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QInSARBPImageToolButton : public QToolAbstract { + Q_OBJECT +public: + QInSARBPImageToolButton(QWidget* parent = nullptr); + ~QInSARBPImageToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QLookTableResampleFromWGS84ToRangeToolButton : public QToolAbstract { + Q_OBJECT +public: + QLookTableResampleFromWGS84ToRangeToolButton(QWidget* parent = nullptr); + ~QLookTableResampleFromWGS84ToRangeToolButton(); +public: + virtual void run() override; + +}; + + +class SIMULATIONSARTOOL_EXPORT QSARSimulationComplexEchoDataDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + QSARSimulationComplexEchoDataDialogToolButton(QWidget* parent = nullptr); + ~QSARSimulationComplexEchoDataDialogToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProductionToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageMultiProductionToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageMultiProductionToolButton(); +public: + virtual void run() override; + +}; + + + + + +class SIMULATIONSARTOOL_EXPORT QLonLatInterpAtiFromDEMToolButton : public QToolAbstract { + Q_OBJECT +public: + QLonLatInterpAtiFromDEMToolButton(QWidget* parent = nullptr); + ~QLonLatInterpAtiFromDEMToolButton(); +public: + virtual void run() override; + +}; + + + + + +class SIMULATIONSARTOOL_EXPORT QL1ASARProcessDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + QL1ASARProcessDialogToolButton(QWidget* parent = nullptr); + ~QL1ASARProcessDialogToolButton(); +public: + virtual void run() override; + +}; + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 1f5abbb..6c19a14 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -105,7 +105,7 @@ - ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath) + ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SARImage;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(SolutionDir)$(Platform)\$(Configuration)\Toolbox\ PluginTool_$(ProjectName) true @@ -124,8 +124,10 @@ true stdcpp14 stdc11 - true - false + false + true + NoExtensions + MaxSpeed true @@ -210,10 +212,21 @@ + + + + + + + + + + + @@ -226,6 +239,7 @@ + @@ -237,6 +251,17 @@ + + + + + + + + + + + @@ -248,6 +273,7 @@ + @@ -267,10 +293,19 @@ + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 6ca9c53..20c001f 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -13,10 +13,6 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {99349809-55BA-4b9d-BF79-8FDBB0286EB3} - ui - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} ts @@ -27,6 +23,13 @@ {9b848585-2348-400d-b12a-dd79a2a71007} + + {3380934c-6b95-45eb-8d70-d8b58e0e9de3} + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + @@ -71,6 +74,12 @@ SimulationSAR + + SARImage + + + SARImage + @@ -124,6 +133,39 @@ PowerSimulationIncoherent + + SARImage + + + SARImage + + + SARImage + + + SARImage + + + SimulationSAR + + + PowerSimulationIncoherent + + + SARImage + + + SARImage + + + SARImage + + + SARImage + + + Source Files + @@ -153,6 +195,33 @@ PowerSimulationIncoherent + + SARImage + + + SARImage + + + SARImage + + + SimulationSAR + + + PowerSimulationIncoherent + + + SARImage + + + SARImage + + + SARImage + + + SARImage + @@ -185,6 +254,36 @@ PowerSimulationIncoherent + + SARImage + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + SARImage + + + SARImage + + + SARImage + + + SARImage + + + Header Files + @@ -220,5 +319,8 @@ SimulationSAR + + SARImage + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp new file mode 100644 index 0000000..b926a8a --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp @@ -0,0 +1,255 @@ +#include "SimulationSARToolSARSatalliteSimulationWorkflow.h" +#include "QSimulationSARPolynomialOrbitModel.h" +#include "QtSimulationGeoSARSigma0Dialog.h" +#include +#include +#include +#include +#include +#include +#include + +SIMULATIONSARTOOL_EXPORT void initSimulationSARToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox) +{ + // 2. ڵģ + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + + + // 5. DEMͷϢSARͼģ + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04",u8"DEMͷϢSARͼģ"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"DEMͷϢSARͼģ"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"DEMͷϢSARͼģ"}, new QSimulationSlrSARRasterToolButton(toolbox)); + + + + + //6. ڻز + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"ڻز"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"ڻز"}, new QInSARImageNetGeneratorToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04",u8"ڻز"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"ڻز"}, new QMapLooktableToolButton(toolbox)); + + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"ڻز"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3B", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"GF3C", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1A", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT1B", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2E", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"HJ2F", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"󳡾", u8"LT04", u8"ڻز"}, new QSimulationBPImageL1BToolButton(toolbox)); + + + return ; +} + +QPolyfitSatelliteGPSModelToolButton::QPolyfitSatelliteGPSModelToolButton(QWidget* parent) +{ + this->toolname = QString(u8"ݹڵϹģ"); +} + +QPolyfitSatelliteGPSModelToolButton::~QPolyfitSatelliteGPSModelToolButton() +{ +} + +void QPolyfitSatelliteGPSModelToolButton::run() +{ + QSimulationPolynomialSAROrbitModel* dialog = new QSimulationPolynomialSAROrbitModel; + dialog->setWindowTitle(u8"ݹڵϹģ"); + dialog->show(); +} + +QGeneratorGeoSimulationRsaterToolButton::QGeneratorGeoSimulationRsaterToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.ɵؾģӰ"); +} + +QGeneratorGeoSimulationRsaterToolButton::~QGeneratorGeoSimulationRsaterToolButton() +{ +} + +void QGeneratorGeoSimulationRsaterToolButton::run() +{ + QtSimulationGeoSARSigma0Dialog* dialog = new QtSimulationGeoSARSigma0Dialog; + dialog->setWindowTitle(u8"ɵؾģӰ"); + dialog->show(); +} + +QGeneratorMapGeoAndSltLookTableToolButton::QGeneratorMapGeoAndSltLookTableToolButton(QWidget* parent) +{ + this->toolname = QString(u8"2.ӳ"); +} + +QGeneratorMapGeoAndSltLookTableToolButton::~QGeneratorMapGeoAndSltLookTableToolButton() +{ +} + +void QGeneratorMapGeoAndSltLookTableToolButton::run() +{ + QSimulationLookTableDialog* dialog = new QSimulationLookTableDialog; + dialog->setWindowTitle(u8"ؾ-бӳ"); + dialog->show(); +} + +QSimulationSlrSARRasterToolButton::QSimulationSlrSARRasterToolButton(QWidget* parent) +{ + this->toolname = QString(u8"3.бģӰ"); +} + +QSimulationSlrSARRasterToolButton::~QSimulationSlrSARRasterToolButton() +{ +} + +void QSimulationSlrSARRasterToolButton::run() +{ + QCreateSARIntensityByLookTableDialog* dialog = new QCreateSARIntensityByLookTableDialog; + dialog->setWindowTitle(u8"бģӰ"); + dialog->show(); +} + +QEchoDataSimulationSARRFPCToolButton::QEchoDataSimulationSARRFPCToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.Ƶɷ"); +} + +QEchoDataSimulationSARRFPCToolButton::~QEchoDataSimulationSARRFPCToolButton() +{ +} + +void QEchoDataSimulationSARRFPCToolButton::run() +{ + QImageSARRFPC* dialog = new QImageSARRFPC(); + dialog->setWindowTitle(u8"ɻز-Ƶɷ"); + dialog->show(); +} + +QInSARImageNetGeneratorToolButton::QInSARImageNetGeneratorToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1."); +} + +QInSARImageNetGeneratorToolButton::~QInSARImageNetGeneratorToolButton() +{ +} + +void QInSARImageNetGeneratorToolButton::run() +{ + QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog; + dialog->setWindowTitle(u8"ƽ񻮷"); + dialog->show(); +} + +QMapLooktableToolButton::QMapLooktableToolButton(QWidget* parent) +{ + this->toolname = QString(u8"3.ұ"); +} + +QMapLooktableToolButton::~QMapLooktableToolButton() +{ +} + +void QMapLooktableToolButton::run() +{ + QLookTableResampleFromWGS84ToRange* dialog = new QLookTableResampleFromWGS84ToRange; + dialog->setWindowTitle(u8"˫ұ"); + dialog->show(); +} + +QSimulationBPImageMultiProductionLevel1_2ToolButton::QSimulationBPImageMultiProductionLevel1_2ToolButton(QWidget* parent) +{ + this->toolname = QString(u8"4. 1~2Ʒ"); +} + +QSimulationBPImageMultiProductionLevel1_2ToolButton::~QSimulationBPImageMultiProductionLevel1_2ToolButton() +{ +} + +void QSimulationBPImageMultiProductionLevel1_2ToolButton::run() +{ + QSimulationBPImageMultiProduction* dialog = new QSimulationBPImageMultiProduction; + dialog->setWindowTitle(u8"1~2Ʒ"); + dialog->show(); +} + +QSimulationBPImageL1BToolButton::QSimulationBPImageL1BToolButton(QWidget* parent) +{ + this->toolname = QString(u8"4. L1BƷ"); + +} + +QSimulationBPImageL1BToolButton::~QSimulationBPImageL1BToolButton() +{ +} + +void QSimulationBPImageL1BToolButton::run() +{ + QL1ASARProcessDialog* dialog = new QL1ASARProcessDialog; + dialog->setWindowTitle(u8"L1BƷ"); + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h new file mode 100644 index 0000000..c5893d9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h @@ -0,0 +1,109 @@ +#pragma once +#ifndef __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ +#define __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ +#include "simulationsartool_global.h" +#include +#include "ToolBoxWidget.h" +#include "QToolAbstract.h" + + +extern "C" SIMULATIONSARTOOL_EXPORT void initSimulationSARToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox); + + + +class SIMULATIONSARTOOL_EXPORT QPolyfitSatelliteGPSModelToolButton : public QToolAbstract { + Q_OBJECT +public: + QPolyfitSatelliteGPSModelToolButton(QWidget* parent = nullptr); + ~QPolyfitSatelliteGPSModelToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QGeneratorGeoSimulationRsaterToolButton : public QToolAbstract { + Q_OBJECT +public: + QGeneratorGeoSimulationRsaterToolButton(QWidget* parent = nullptr); + ~QGeneratorGeoSimulationRsaterToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QGeneratorMapGeoAndSltLookTableToolButton : public QToolAbstract { + Q_OBJECT +public: + QGeneratorMapGeoAndSltLookTableToolButton(QWidget* parent = nullptr); + ~QGeneratorMapGeoAndSltLookTableToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationSlrSARRasterToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationSlrSARRasterToolButton(QWidget* parent = nullptr); + ~QSimulationSlrSARRasterToolButton(); +public: + virtual void run() override; + +}; + + + + +class SIMULATIONSARTOOL_EXPORT QEchoDataSimulationSARRFPCToolButton : public QToolAbstract { + Q_OBJECT +public: + QEchoDataSimulationSARRFPCToolButton(QWidget* parent = nullptr); + ~QEchoDataSimulationSARRFPCToolButton(); +public: + virtual void run() override; + +}; + + +class SIMULATIONSARTOOL_EXPORT QInSARImageNetGeneratorToolButton : public QToolAbstract { + Q_OBJECT +public: + QInSARImageNetGeneratorToolButton(QWidget* parent = nullptr); + ~QInSARImageNetGeneratorToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QMapLooktableToolButton : public QToolAbstract { + Q_OBJECT +public: + QMapLooktableToolButton(QWidget* parent = nullptr); + ~QMapLooktableToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProductionLevel1_2ToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageMultiProductionLevel1_2ToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageMultiProductionLevel1_2ToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageL1BToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageL1BToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageL1BToolButton(); +public: + virtual void run() override; + +}; + + +#endif