LAMPTool 修改为 dll ,并修改对应的参数列表

master
剑古敛锋 2024-04-07 23:51:25 +08:00
parent 7e6f2b435d
commit 7ff3aa55d6
120 changed files with 4004 additions and 9262 deletions

View File

@ -139,6 +139,7 @@ list(APPEND QtNeededModules
PrintSupport # QwtPolar
DBus
Qml DataVisualization Charts
)
if(LAMPCAE_LINUX)
list(APPEND QtNeededModules XcbQpa)
@ -211,6 +212,21 @@ find_package(Gmsh REQUIRED)
# Python
find_package(Python REQUIRED)
# OpenMesh
find_package(OpenMesh CONFIG REQUIRED)
# VCGLIB
find_path(VCGLIB_INCLUDE_DIRS "img/img.h")
# FFTW3
find_package(FFTW3 CONFIG REQUIRED)
# gsl
find_package(GSL REQUIRED)
#GDAL
find_package(GDAL CONFIG REQUIRED)
message("CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}")
@ -226,9 +242,10 @@ include_directories(SYSTEM C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(SYSTEM C:/PCL/include/pcl-1.14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
find_package(Qt5 REQUIRED COMPONENTS Test Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
find_package(PCL)
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${VCGLIB_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
@ -251,7 +268,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# GNUGNUInstallDirs.cmake
#-----------------------------------------------------------------------------
include(GNUInstallDirs)
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_LIBDIR "lib" )
#-----------------------------------------------------------------------------
#

View File

@ -2,8 +2,14 @@
LAMPCAE软件是基于FastCAE 软件上开发得到增加了点云、feko仿真、成像三个部分功能。注意FastCAE 遵循 BSD-3-Clause 协议。为了避免被其他的依赖库协议污染,这里将程序库进行了拆分。
## 点云功能部分依赖库
点云部分依赖pcl,其中模型渲染部分重新用fastCAE软件的渲染重新适配。
其中点云属性与点云实体分开存储,后期在考虑完全统一
注意因为窗口界面部分是后续实现的因此需要依赖python 作为中间件,链接
点云格式pclpointcloud2
1. 点云数据管理与mesh管理合并
2. 点云滤波
3. 点云重新构面
## mesh网格处理
依赖meshlab中库代码处理
@ -24,6 +30,7 @@ LAMPCAE软件是基于FastCAE 软件上开发得到增加了点云、feko仿
## 影像处理部分依赖库
# V1.0
1. 原来点云处理模块全部内置到FastCAE中
# V2.5.0
1. 点云加载与保存
2. 增加mesh的点删除功能
3. 增加mesh的面片删除功能

View File

@ -5,8 +5,9 @@ set(SOVERSION ${PROJECT_VERSION} ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINO
#
#-----------------------------------------------------------------------------
list(APPEND _libraries Common PythonModule SARibbonBar Settings DataProperty MeshData SelfDefObject Material Geometry BCBase ConfigOptions ParaClassFactory ModelData ModuleBase PostAlgorithm PostRenderData PostInterface PostCurveDataManager PostPlotWidget PostWidgets GeometryDataExchange ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets PluginManager GmshModule IO SolverControl MainWidgets UserGuidence)
list(APPEND _libraries PointCloudOperator )
list(APPEND _libraries json qcustomplot qhexedit qscintilla2 LAMPTool WBCLFZSystemModule )
list(APPEND _libraries PluginMotorBike)
list(APPEND _libraries PluginMotorBike )
#[[if(_WIN_)
list(APPEND _libraries XGenerateReport License)
endif()]]
@ -28,7 +29,7 @@ file(TO_NATIVE_PATH "${_rpath}/${INSTALL_LIBDIR}" _lib_rpath)
#
list(APPEND LAMPCAE_Runtimes_Libraries VTK::loguru VTK::gl2ps Qt5::DBus VTK::IOChemistry )
list(APPEND LAMPCAE_Runtimes_Libraries Qt5::Qml )
list(APPEND LAMPCAE_Runtimes_Libraries Qt5::Qml )
@ -65,7 +66,7 @@ install(
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
)
list(APPEND _plugins PluginCustomizer PluginMeshDataExchange)
list(APPEND _plugins PluginCustomizer PluginMeshDataExchange PluginWBFZExchangePlugin)
foreach(_plugin ${_plugins})
list(APPEND LAMPCAE_Runtimes_Libraries ${LAMPCAE_${_plugin}_Runtimes_Libraries})

View File

@ -7,10 +7,10 @@
* @copyright Copyright (c) Since 2020 All rights reserved.
*
* ============================================================================
* Program: LAMPCAE
* Program: FASTCAE
*
* Copyright (c) Since 2020 All rights reserved.
* See License or http://www.LAMPCAE.com/ for details.
* See License or http://www.FASTCAE.com/ for details.
*
* BSD 3-Clause License
*

View File

@ -85,8 +85,6 @@ namespace IO
//获取点云导出的方法
static EXPORTMESHFUN getPclExporter(QString suffix);
//注册替换方法
static void RegisterKeyWordReplacer(QString kw, REPLACEKEYWORDFUN fun);
//获取替换方法

View File

@ -1,38 +0,0 @@
#pragma once
#ifndef BASECONSTVARIABLE_H
#define BASECONSTVARIABLE_H
#include <complex>
#include <math.h>
#define PI_180 180/3.141592653589793238462643383279
#define T180_PI 3.141592653589793238462643383279/180
#define LIGHTSPEED 299792458
#define Radians2Degrees(Radians) Radians*PI_180
#define Degrees2Radians(Degrees) Degrees*T180_PI
const double PI = 3.141592653589793238462643383279;
const double epsilon = 0.000000000000001;
const double pi = 3.14159265358979323846;
const double d2r = pi / 180;
const double r2d = 180 / pi;
const double a = 6378137.0; //椭球长半轴
const double ae = 6378137.0; //椭球长半轴
const double ee = 0.0818191910428;// 第一偏心率
const double f_inverse = 298.257223563; //扁率倒数
const double b = a - a / f_inverse;
const double eSquare = (a * a - b * b) / (a * a);
const double e = sqrt(eSquare);
const double earth_Re = 6378136.49;
const double earth_Rp = (1 - 1 / f_inverse) * earth_Re;
const double earth_We = 0.000072292115;
#endif

View File

@ -1,256 +0,0 @@
#pragma once
#include "BaseTool.h"
///
///
//#define EIGEN_USE_MKL_ALL
//#define EIGEN_VECTORIZE_SSE4_2
//#include <mkl.h>
#include "referenceHeader.h"
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>
//#include <mkl.h>
#include <string>
#include <omp.h>
#include < io.h >
#include < stdio.h >
#include < stdlib.h >
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
//#include <ogr_geos.h>
#include <ogrsf_frmts.h> //#include "ogrsf_frmts.h"
#include <fstream>
#include <proj.h>
#include "GeoOperator.h"
#include "baseTool.h"
using namespace std;
using namespace Eigen;
QString getCurrentTimeString() {
struct tm ConversionTime;
std::time_t t = std::time(NULL);
char mbstr[100];
_localtime64_s(&ConversionTime, &t);
std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime);
QString strTime = mbstr;
return strTime;
}
QString getCurrentShortTimeString() {
struct tm ConversionTime;
std::time_t t = std::time(NULL);
char mbstr[100];
_localtime64_s(&ConversionTime, &t);
std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime);
QString strTime = mbstr;
return strTime;
}
std::vector<QString> splitString(const QString& str, char delimiter)
{
QStringList tokens = str.split(delimiter);
return convertQStringListToStdVector(tokens);
}
complex<double> Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img)
{
if (img.rows() != 4 || img.cols() != 4) {
throw exception("the size of img's block is not right");
}
// 斤拷锟斤拷模锟斤拷
Eigen::MatrixX<complex<double>> wrc(1, 4);// 使锟斤拷 complex<double> 斤拷锟斤拷要原斤拷为锟剿伙拷取值
Eigen::MatrixX<complex<double>> wcr(4, 1);//
for (int i = 0; i < 4; i++) {
wrc(0, i) = Cubic_kernel_weight(u + 1 - i); // u+1,u,u-1,u-2
wcr(i, 0) = Cubic_kernel_weight(v + 1 - i);
}
Eigen::MatrixX<complex<double>> interValue = wrc * img * wcr;
return interValue(0, 0);
}
complex<double> Cubic_kernel_weight(double s)
{
s = abs(s);
if (s <= 1) {
return complex<double>(1.5 * s * s * s - 2.5 * s * s + 1, 0);
}
else if (s <= 2) {
return complex<double>(-0.5 * s * s * s + 2.5 * s * s - 4 * s + 2, 0);
}
else {
return complex<double>(0, 0);
}
}
/// <summary>
/// p11 p12 -- x
/// p0(u,v)
/// p21 p22
/// |
/// y
/// p11(0,0)
/// p21(0,1)
/// P12(1,0)
/// p22(1,1)
/// </summary>
/// <param name="p0">x,y,z</param>
/// <param name="p1">x,y,z</param>
/// <param name="p2">x,y,z</param>
/// <param name="p3">x,y,z</param>
/// <param name="p4">x,y,z</param>
/// <returns></returns>
double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22)
{
return p11.ati * (1 - p0.lon) * (1 - p0.lat) +
p12.ati * p0.lon * (1 - p0.lat) +
p21.ati * (1 - p0.lon) * p0.lat +
p22.ati * p0.lon * p0.lat;
}
bool onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q)
{
if ((Q.x - Pi.x) * (Pj.y - Pi.y) == (Pj.x - Pi.x) * (Q.y - Pi.y) //叉乘
//保证Q点坐标在pi,pj之间
&& min(Pi.x, Pj.x) <= Q.x && Q.x <= max(Pi.x, Pj.x)
&& min(Pi.y, Pj.y) <= Q.y && Q.y <= max(Pi.y, Pj.y))
return true;
else
return false;
}
Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d)
{
Point_3d res;
Point_3d e = b - a;
Point_3d f = d - a;
Point_3d g = a - b + c - d;
Point_3d h = p - a;
double k2 = cross2d(g, f);
double k1 = cross2d(e, f) + cross2d(h, g);
double k0 = cross2d(h, e);
double u, v;
// if edges are parallel, this is a linear equation
if (abs(k2) < 0.001)
{
v = -k0 / k1;
u = (h.x - f.x * v) / (e.x + g.x * v);
p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
return p;
}
// otherwise, it's a quadratic
else
{
float w = k1 * k1 - 4.0 * k0 * k2;
if (w < 0.0) {
// 可能在边界上
if (onSegment(a, b, p)) {
Point_3d tt = b - a;
Point_3d ttpa = p - a;
double scater = ttpa / tt;
if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
p.z = a.z + scater * tt.z;
return p;
}
else if (onSegment(b, c, p)) {
Point_3d tt = c - b;
Point_3d ttpa = p - b;
double scater = ttpa / tt;
if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
p.z = b.z + scater * tt.z;
return p;
}
else if (onSegment(c, d, p)) {
Point_3d tt = d - c;
Point_3d ttpa = p - c;
double scater = ttpa / tt;
if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
p.z = c.z + scater * tt.z;
return p;
}
else if (onSegment(d, a, p)) {
Point_3d tt = a - d;
Point_3d ttpa = p - d;
double scater = ttpa / tt;
if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
p.z = d.z + scater * tt.z;
return p;
}
return { -9999,-9999,-9999 };
}
else {
w = sqrt(w);
float ik2 = 0.5 / k2;
float v = (-k1 - w) * ik2;
float u = (h.x - f.x * v) / (e.x + g.x * v);
if (u < 0.0 || u>1.0 || v < 0.0 || v>1.0)
{
v = (-k1 + w) * ik2;
u = (h.x - f.x * v) / (e.x + g.x * v);
}
p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
return p;
}
}
p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
return p;
}
double sind(double degree)
{
return sin(degree * d2r);
}
double cosd(double d)
{
return cos(d * d2r);
}
string Convert(float Num)
{
ostringstream oss;
oss << Num;
string str(oss.str());
return str;
}
QString JoinPath(const QString& path, const QString& filename)
{
QDir dir(path);
// Ensure the path ends with the appropriate separator
if (!QDir::isAbsolutePath(path))
dir.makeAbsolute();
return dir.filePath(filename);
}
std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList)
{
std::vector<QString> stdVector;
for (const QString& str : qStringList) {
stdVector.push_back(str);
}
return stdVector;
};

View File

@ -1,93 +0,0 @@
#pragma once
#pragma once
#ifndef BASETOOL_H
#define BASETOOL_H
///
/// 基本类、基本函数
///
//#define EIGEN_USE_MKL_ALL
//#define EIGEN_VECTORIZE_SSE4_2
//#include <mkl.h>
//#include <mkl.h>
#include <complex>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>
#include <string>
#include <omp.h>
#include "../LAMPTool/referenceHeader.h"
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <ogrsf_frmts.h>
#include <fstream>
#include "GeoOperator.h"
#include <vector>
#include <string>
using namespace std;
using namespace Eigen;
///////////////////////////////////// 运行时间打印 //////////////////////////////////////////////////////////
QString getCurrentTimeString();
QString getCurrentShortTimeString();
std::vector<QString> splitString(const QString& str, char delimiter);
/////////////////////////////// 基本图像类 结束 //////////////////////////////////////////////////////////
string Convert(float Num);
QString JoinPath(const QString& path, const QString& filename);
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 插值 ////////////////////////////////////////////
complex<double> Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img);
complex<double> Cubic_kernel_weight(double s);
double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22);
bool onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q);
Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d);
//
// WGS84 到J2000 坐标系的变换
// 参考网址https://blog.csdn.net/hit5067/article/details/116894616
// 资料网址http://celestrak.org/spacedata/
// 参数文件:
// a. Earth Orientation Parameter 文件: http://celestrak.org/spacedata/EOP-Last5Years.csv
// b. Space Weather Data 文件: http://celestrak.org/spacedata/SW-Last5Years.csv
// 备注上述文件是自2017年-五年内
/**
wgs84 J2000 WGS t ,BLH
step 1: WGS 84
step 2:
step 3:
step 4:
step 5: J2000
**/
double sind(double degree);
double cosd(double d);
#endif

View File

@ -1,188 +0,0 @@
#include "FileOperator.h"
#include <boost/filesystem.hpp>
#include <string>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <QDebug>
std::vector<QString> getFilelist(const QString& folderpath, const QString& filenameExtension, int (*logfun)(QString logtext, int value))
{
QString filenameExtensionStr = filenameExtension;
filenameExtensionStr = filenameExtensionStr.remove(0, 1);
std::vector<QString> filenames(0);
if (isExists(folderpath) && isDirectory(folderpath)) {
QDir directory(folderpath);
if (directory.exists() && directory.isReadable()) {
QFileInfoList fileList = directory.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
for (const QFileInfo& fileInfo : fileList) {
qDebug() << fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")";
if (filenameExtensionStr == u8"*" || filenameExtensionStr == fileInfo.suffix()) {
filenames.push_back(fileInfo.filePath());
}
if (logfun) {
logfun(fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")", 4);
}
}
}
else {
qWarning() << "Folder does not exist or is not readable: " << folderpath;
}
return filenames;
}
else {
return std::vector<QString>(0);
}
}
QString getParantFolderNameFromPath(const QString& path)
{
QDir directory(path);
directory.cdUp();
QString parentPath = directory.absolutePath();
return directory.dirName();
}
QString getParantFromPath(const QString& path)
{
//qDebug() << path;
QDir directory(path);
directory.cdUp();
QString parentPath = directory.absolutePath();
//qDebug() << parentPath;
return parentPath;
}
QString getFileNameFromPath(const QString& path)
{
QFileInfo fileInfo(path);
return fileInfo.fileName();
}
bool isDirectory(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.isDir();
}
bool isExists(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.exists();
}
bool isFile(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.isFile();
}
int write_binfile(char* filepath, char* data, size_t data_len)
{
FILE* pd = fopen(filepath, "w");
if (NULL == pd) {
return 2;
}
//数据块首地址: "&a",元素大小: "sizeof(unsigned __int8)" 元素个数: "10" 文件指针:"pd"
fwrite(data, sizeof(char), data_len, pd);
fclose(pd);
return -1;
}
char* read_textfile(char* text_path, int* length)
{
char* data = NULL;
FILE* fp1 = fopen(text_path, "r");
if (fp1 == NULL) {
return NULL;
}
else {}
// 读取文件
fseek(fp1, 0, SEEK_END);
int data_length = ftell(fp1);
data = (char*)malloc((data_length + 1) * sizeof(char));
rewind(fp1);
if (data_length == fread(data, sizeof(char), data_length, fp1)) {
data[data_length] = '\0'; // 文件尾
}
else {
free(data);
fclose(fp1);
return NULL;
}
fclose(fp1);
*length = data_length + 1;
return data;
}
bool exists_test(const QString& name)
{
return isExists(name);
}
size_t fsize(FILE* fp)
{
size_t n;
fpos_t fpos; // 当前位置
fgetpos(fp, &fpos); // 获取当前位置
fseek(fp, 0, SEEK_END);
n = ftell(fp);
fsetpos(fp, &fpos); // 恢复之前的位置
return n;
}
void removeFile(const QString& filePath)
{
QFile file(filePath);
if (file.exists()) {
if (file.remove()) {
qDebug() << "File removed successfully: " << filePath;
}
else {
qWarning() << "Failed to remove file: " << filePath;
}
}
else {
qDebug() << "File does not exist: " << filePath;
}
}
unsigned long convertToULong(const QString& input) {
bool ok; // Used to check if the conversion was successful
unsigned long result = input.toULong(&ok);
if (!ok) {
qWarning() << "Conversion to unsigned long failed for input: " << input;
}
return result;
}
void copyFile(const QString& sourcePath, const QString& destinationPath) {
QFile sourceFile(sourcePath);
QFile destinationFile(destinationPath);
if (sourceFile.exists()) {
if (sourceFile.copy(destinationPath)) {
// 复制成功
//QMessageBox::information(nullptr, u8"成功", u8"文件复制成功");
}
else {
// 复制失败
QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("file copy error"));
}
}
else {
// 源文件不存在
QMessageBox::warning(nullptr, QObject::tr("warning"), QObject::tr("Source file not found"));
}
}

View File

@ -1,50 +0,0 @@
#pragma once
#ifndef FILEOPERATOR_H
#define FILEOPERATOR_H
#include "../LAMPTool/referenceHeader.h"
#include <string.h>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <QString>
#include <QDir>
#include <QFile>
#include <QDebug>
bool isDirectory(const QString& path);
bool isExists(const QString& path);
bool isFile(const QString& path);
void removeFile(const QString& filePath);
unsigned long convertToULong(const QString& input);
/// <summary>
/// 获取文件(绝对路径)
/// </summary>
/// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param>
/// <returns></returns>
std::vector<QString> getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr);
QString getParantFolderNameFromPath(const QString& path);
QString getFileNameFromPath(const QString& path);
int write_binfile(char* filepath, char* data, size_t data_len);
char* read_textfile(char* text_path, int* length);
bool exists_test(const QString& name);
size_t fsize(FILE* fp);
QString getParantFromPath(const QString& path);
void copyFile(const QString& sourcePath, const QString& destinationPath);
// QT FileOperator
#endif

View File

@ -1,271 +0,0 @@
#include "GeoOperator.h"
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>
//#include <mkl.h>
#include <string>
#include <omp.h>
#include < io.h >
#include < stdio.h >
#include < stdlib.h >
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
//#include <ogr_geos.h>
#include <ogrsf_frmts.h> //#include "ogrsf_frmts.h"
#include <fstream>
#include <proj.h>
using namespace std;
using namespace Eigen;
Landpoint operator +(const Landpoint& p1, const Landpoint& p2)
{
return Landpoint{ p1.lon + p2.lon,p1.lat + p2.lat,p1.ati + p2.ati };
}
Landpoint operator -(const Landpoint& p1, const Landpoint& p2)
{
return Landpoint{ p1.lon - p2.lon,p1.lat - p2.lat,p1.ati - p2.ati };
}
bool operator ==(const Landpoint& p1, const Landpoint& p2)
{
return p1.lat == p2.lat && p1.lon == p2.lon && p1.ati == p2.ati;
}
Landpoint operator *(const Landpoint& p, double scale)
{
return Landpoint{
p.lon * scale,
p.lat * scale,
p.ati * scale
};
}
Landpoint LLA2XYZ(const Landpoint& LLA) {
double L = LLA.lon * d2r;
double B = LLA.lat * d2r;
double H = LLA.ati;
double sinB = sin(B);
double cosB = cos(B);
//double N = a / sqrt(1 - e * e * sin(B) * sin(B));
double N = a / sqrt(1 - eSquare * sinB * sinB);
Landpoint result = { 0,0,0 };
result.lon = (N + H) * cosB * cos(L);
result.lat = (N + H) * cosB * sin(L);
//result.z = (N * (1 - e * e) + H) * sin(B);
result.ati = (N * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + H) * sinB;
return result;
}
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint)
{
landpoint.col(0) = landpoint.col(0).array() * d2r; // lon
landpoint.col(1) = landpoint.col(1).array() * d2r; // lat
Eigen::MatrixXd sinB = (landpoint.col(1).array().sin());//lat
Eigen::MatrixXd cosB = (landpoint.col(1).array().cos());//lat
Eigen::MatrixXd N = a / ((1 - sinB.array().pow(2) * eSquare).array().sqrt());
Eigen::MatrixXd result(landpoint.rows(), 3);
result.col(0) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::cos(landpoint.col(0).array()).array(); //x
result.col(1) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::sin(landpoint.col(0).array()).array(); //y
result.col(2) = (N.array() * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + landpoint.col(2).array()) * sinB.array(); //z
return result;
}
Landpoint XYZ2LLA(const Landpoint& XYZ) {
double tmpX = XYZ.lon;//
double temY = XYZ.lat;//
double temZ = XYZ.ati;
double curB = 0;
double N = 0;
double sqrtTempXY = sqrt(tmpX * tmpX + temY * temY);
double calB = atan2(temZ, sqrtTempXY);
int counter = 0;
double sinCurB = 0;
while (abs(curB - calB) * r2d > epsilon && counter < 25)
{
curB = calB;
sinCurB = sin(curB);
N = a / sqrt(1 - eSquare * sinCurB * sinCurB);
calB = atan2(temZ + N * eSquare * sinCurB, sqrtTempXY);
counter++;
}
Landpoint result = { 0,0,0 };
result.lon = atan2(temY, tmpX) * r2d;
result.lat = curB * r2d;
result.ati = temZ / sinCurB - N * (1 - eSquare);
return result;
}
double getAngle(const Landpoint& a, const Landpoint& b)
{
double c = dot(a, b) / (getlength(a) * getlength(b));
if (a.lon * b.lat - a.lat * b.lon >= 0) {
return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
}
else {
return 360 - acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
}
}
double dot(const Landpoint& p1, const Landpoint& p2)
{
return p1.lat * p2.lat + p1.lon * p2.lon + p1.ati * p2.ati;
}
double getlength(const Landpoint& p1) {
return sqrt(dot(p1, p1));
}
Landpoint crossProduct(const Landpoint& a, const Landpoint& b) {
return Landpoint{
a.lat * b.ati - a.ati * b.lat,//x
a.ati * b.lon - a.lon * b.ati,//y
a.lon * b.lat - a.lat * b.lon//z
};
}
float cross2d(Point_3d a, Point_3d b)
{
return a.x * b.y - a.y * b.x;
}
Point_3d operator -(Point_3d a, Point_3d b)
{
return Point_3d{ a.x - b.x, a.y - b.y, a.z - b.z };
}
Point_3d operator +(Point_3d a, Point_3d b)
{
return Point_3d{ a.x + b.x, a.y + b.y, a.z + b.z };
}
double operator /(Point_3d a, Point_3d b)
{
return sqrt(pow(a.x, 2) + pow(a.y, 2)) / sqrt(pow(b.x, 2) + pow(b.y, 2));
}
Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4) {
Landpoint n0 = LLA2XYZ(p0),
n1 = LLA2XYZ(p1),
n2 = LLA2XYZ(p2),
n3 = LLA2XYZ(p3),
n4 = LLA2XYZ(p4);
Landpoint n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0;
// 锟斤拷n01为锟斤拷锟斤拷锟斤拷锟斤拷
Landpoint np01 = p1 - p0, np02 = p2 - p0, np03 = p3 - p0, np04 = p4 - p0;
double a2 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np02.lon,np02.lat,0 });// 01->02 锟斤拷时锟斤拷
double a3 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np03.lon,np03.lat,0 });// 01->03 锟斤拷时锟斤拷
double a4 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np04.lon,np04.lat,0 });// 01->04 锟斤拷时锟斤拷
//qDebug() << a2 << "\t" << a3 << "\t" << a4 << endl;
a2 = 360 - a2;
a3 = 360 - a3;
a4 = 360 - a4;
Landpoint N, W, S, E;
N = n01;
if (a2 >= a3 && a2 >= a4) {
W = n02;
if (a3 >= a4) {
S = n03;
E = n04;
}
else {
S = n04;
E = n03;
}
}
else if (a3 >= a2 && a3 >= a4) {
W = n03;
if (a2 >= a4) {
S = n02;
E = n04;
}
else {
S = n04;
E = n02;
}
}
else if (a4 >= a2 && a4 >= a3)
{
W = n04;
if (a2 >= a3) {
S = n02;
E = n03;
}
else {
S = n03;
E = n02;
}
}
return (crossProduct(N, W) + crossProduct(W, S) + crossProduct(S, E) + crossProduct(E, N)) * 0.25;
}
double distance(const Vector3D& p1, const Vector3D& p2)
{
double dx = p1.x - p2.x;
double dy = p1.y - p2.y;
double dz = p1.z - p2.z;
return std::sqrt(dx * dx + dy * dy + dz * dz);
}
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection)
{
Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z };
// 璁畻鐐瑰埌鐩寸嚎鐨勬姇褰辩偣鐨勪綅缃<E7B685>
double t = (pointToLine.x * lineDirection.x + pointToLine.y * lineDirection.y + pointToLine.z * lineDirection.z) /
(lineDirection.x * lineDirection.x + lineDirection.y * lineDirection.y + lineDirection.z * lineDirection.z);
// 璁畻鎶曞奖鐐<E5A596>
Vector3D projection = { linePoint.x + t * lineDirection.x, linePoint.y + t * lineDirection.y, linePoint.z + t * lineDirection.z };
// 璁畻鐐瑰埌鐩寸嚎鐨勮窛绂<E7AA9B>
return distance(point, projection);
}
SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian)
{
SphericalCoordinates spherical;
spherical.r = std::sqrt(cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z);
spherical.theta = std::acos(cartesian.z / spherical.r);
spherical.phi = std::atan2(cartesian.y, cartesian.x);
return spherical;
}
CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical)
{
CartesianCoordinates cartesian;
cartesian.x = spherical.r * std::sin(spherical.theta) * std::cos(spherical.phi);
cartesian.y = spherical.r * std::sin(spherical.theta) * std::sin(spherical.phi);
cartesian.z = spherical.r * std::cos(spherical.theta);
return cartesian;
}

View File

@ -1,111 +0,0 @@
#pragma once
#ifndef GEOOPERATOR_H
#define GEOOPERATOR_H
#include "BaseConstVariable.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
/// <summary>
/// 三维向量,坐标表达
/// </summary>
struct Landpoint // 点 SAR影像的像素坐标
{
/// <summary>
/// 经度x
/// </summary>
double lon; // 经度x lon pixel_col
/// <summary>
/// 纬度y
/// </summary>
double lat; // 纬度y lat pixel_row
/// <summary>
/// 高度z
/// </summary>
double ati; // 高程z ati pixel_time
};
struct Point_3d {
double x;
double y;
double z;
};
/// <summary>
/// 将经纬度转换为地固参心坐标系
/// </summary>
/// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns>
Landpoint LLA2XYZ(const Landpoint& LLA);
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary>
/// 将地固参心坐标系转换为经纬度
/// </summary>
/// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns>
Landpoint XYZ2LLA(const Landpoint& XYZ);
Landpoint operator +(const Landpoint& p1, const Landpoint& p2);
Landpoint operator -(const Landpoint& p1, const Landpoint& p2);
bool operator ==(const Landpoint& p1, const Landpoint& p2);
Landpoint operator *(const Landpoint& p, double scale);
double getAngle(const Landpoint& a, const Landpoint& b);
double dot(const Landpoint& p1, const Landpoint& p2);
double getlength(const Landpoint& p1);
Landpoint crossProduct(const Landpoint& a, const Landpoint& b);
Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4);
float cross2d(Point_3d a, Point_3d b);
Point_3d operator -(Point_3d a, Point_3d b);
Point_3d operator +(Point_3d a, Point_3d b);
double operator /(Point_3d a, Point_3d b);
// 矢量计算
struct Vector3D {
double x, y, z;
};
// 计算两点之间的距离
double distance(const Vector3D& p1, const Vector3D& p2);
// 计算点到直线的最短距离
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection);
struct CartesianCoordinates {
double x, y, z;
};
struct SphericalCoordinates {
double r, theta, phi;
};
SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian);
CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,190 +0,0 @@
#pragma once
/**
*
* ENVI
* GDAL
* **/
#ifndef IMAGEOPERATORBASE_H
#define IMAGEOPERATORBASE_H
#include "../LAMPTool/BaseToollib/BaseConstVariable.h"
#include "../LAMPTool/BaseToollib/GeoOperator.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <complex>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <string>
#include <memory>
#include <QString>
#include <cpl_conv.h> // for CPLMalloc()
#include "../LAMPTool/referenceHeader.h"
using namespace std;
using namespace Eigen;
struct ImageGEOINFO {
int width;
int height;
int bandnum;
};
// 判断是否需要输出为DLL
#define DLLOUT
// 文件打开
std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly); // 当指令销毁时调用GDALClose 销毁类型
void CloseDataset(GDALDataset* ptr);
// 数据格式转换
int TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
// 保存影像数据 --直接保存 ENVI 文件
int CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, QString projection, GDALDataType gdal_dtype, bool need_gt); // 创建文件
int saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
// 根据限制条件估算分块大小
int block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
// 将结果转换为复数 或者 实数
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::MatrixXd getGeoTranslationArray(QString in_path);
ImageGEOINFO getImageINFO(QString in_path);
GDALDataType getGDALDataType(QString fileptah);
struct DemBox {
double min_lat; //纬度
double min_lon;//经度
double max_lat;//纬度
double max_lon;//经度
};
/// <summary>
/// gdalImage图像操作类
/// </summary>
class gdalImage
{
public: // 方法
gdalImage();
gdalImage(const QString& raster_path);
~gdalImage();
virtual void setHeight(int);
virtual void setWidth(int);
virtual void setTranslationMatrix(Eigen::MatrixXd gt);
virtual void setData(Eigen::MatrixXd,int data_band_ids=1);
virtual Eigen::MatrixXd getData(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual Eigen::MatrixXd getGeoTranslation();
virtual GDALDataType getDataType();
virtual void saveImage(Eigen::MatrixXd, int start_row, int start_col, int band_ids);
virtual void saveImage();
virtual void setNoDataValue(double nodatavalue, int band_ids);
virtual int InitInv_gt();
virtual Landpoint getRow_Col(double lon, double lat);
virtual Landpoint getLandPoint(double i, double j, double ati);
virtual double mean(int bandids = 1);
virtual double max(int bandids = 1);
virtual double min(int bandids = 1);
virtual GDALRPCInfo getRPC();
virtual Eigen::MatrixXd getLandPoint(Eigen::MatrixXd points);
virtual Eigen::MatrixXd getHist(int bandids);
public:
QString img_path; // 图像文件
int height; // 高
int width; // 宽
int band_num;// 波段数
int start_row;//
int start_col;//
int data_band_ids;
Eigen::MatrixXd gt; // 变换矩阵
Eigen::MatrixXd inv_gt; // 逆变换矩阵
Eigen::MatrixXd data;
QString projection;
};
/// <summary>
/// gdalImage图像操作类
/// </summary>
class gdalImageComplex:public gdalImage
{
public: // 方法
gdalImageComplex(const QString& raster_path);
~gdalImageComplex();
void setData(Eigen::MatrixXcd);
void saveImage(Eigen::MatrixXcd data, int start_row, int start_col, int band_ids);
Eigen::MatrixXcd getDataComplex(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
void saveImage() override;
public:
Eigen::MatrixXcd data;
};
gdalImage CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample);
int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
//--------------------- 保存文博 -------------------------------
int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);
//----------------------------------------------------
#ifndef DLLOUT
#else
//#define DllExport __declspec( dllexport )
//double __declspec(dllexport) ProcessMGCMathX_MGC(int Xbetaidx, int Xbwidx, double XTao, double satH, char* sigma_path, char* output_path,
// double p1_x, double p1_y, double p2_x, double p2_y, double p3_x, double p3_y, double p4_x, double p4_y)
#endif
#endif

View File

@ -1,13 +0,0 @@
#include "BaseToolLib/interpolation.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <Eigen/Core>
#include <Eigen/Dense>
namespace LampInterpolation {
}

View File

@ -1,69 +0,0 @@
#pragma once
#ifndef INTERPOLATION_H
#define INTERPOLATION_H
#include <complex>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <Eigen/Core>
#include <Eigen/Dense>
namespace LampInterpolation {
enum interpolationtype {
nearest,
linear,
cubic,
};
/// <summary>
/// 矩阵为 1xn
/// </summary>
template<typename T>
std::complex<T> interpolation(Eigen::MatrixX<std::complex<T>>& echo, double& index, interpolationtype methodtype)
{
assert(echo.rows() != 1 || echo.cols() >= index || index < 0); // 断言
if (methodtype == interpolationtype::linear) {
return interpolationLinear(echo, index);
}
else if (methodtype == interpolationtype::cubic) {
}
else if (methodtype == interpolationtype::nearest) {
return interpolationNearest(echo, index);
}
else {}
return std::complex<T>(0, 0);
};
template<typename T>
std::complex<T> interpolationLinear(Eigen::MatrixX<std::complex<T>>& echo, double& index)
{
size_t last_ids = size_t(std::floor(index));
size_t next_ids = size_t(std::ceil(index));
std::complex<T> last_value = echo(1, last_ids);
std::complex<T> next_value = echo(1, next_ids);
// 实部,虚部同时插值
double real = last_value.real() + ((next_value.real() - last_value.real()) / (next_ids - last_ids)) * (index - last_ids);
double imag = last_value.imag() + ((next_value.imag() - last_value.imag()) / (next_ids - last_ids)) * (index - last_ids);
return std::complex<T>(T(real), T(imag));
};
template<typename T>
std::complex<T> interpolationNearest(Eigen::MatrixX<std::complex<T>>& echo, double& index)
{
size_t nearest_ids = size_t(std::round(index));
return echo(1, nearest_ids);
};
}
#endif

View File

@ -1,2 +0,0 @@
# 说明
此模块主要是通用基础模块

View File

@ -3,24 +3,91 @@
#-----------------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
# boost
include_directories(D:/vcpkg/installed/x64-windows/include)
# pcl
include_directories(C:/PCL/3rdParty/FLANN/include)
include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(C:/PCL/include/pcl-1.14)
# FindOpenCASCADE
include_directories(${OpenCASCADE_INCLUDE_DIRS})
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)
# qscintilla2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src)
# lamptool
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include)
# qcustomplot
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot)
# qhexedit
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit)
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SqliteDBProcess/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/modelProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/EchoShowProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/OCCViewer)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/PointCloudProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SharedModuleLib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TableProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TaskXml)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
# pcl
link_directories("C:/PCL/3rdParty/FLANN/lib")
link_directories("C:/VTK/lib")
link_directories("C:/PCL/lib")
#
#-----------------------------------------------------------------------------
# include
#-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
find_package(PCL)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/WBCLFZSystemModule.qrc")
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/qianfan.qrc")
set(_lang "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/translations.qrc")
qt5_add_resources(_resource ${_qrc} ${_lang})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
file(GLOB_RECURSE _ui "*.ui")
file(GLOB_RECURSE _header "*.h*")
file(GLOB_RECURSE _source "*.cpp")
file(GLOB_RECURSE _ui "*.ui" )
file(GLOB_RECURSE _header "*.h" )
file(GLOB_RECURSE _source "*.cpp" )
qt5_wrap_ui(_interface ${_ui})
#-----------------------------------------------------------------------------
@ -36,15 +103,24 @@ add_library(LAMPTool STATIC
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
target_compile_definitions(LAMPTool PUBLIC "LAMPTool_API")
target_compile_definitions(LAMPTool PUBLIC LAMPTOOL_API)
#-----------------------------------------------------------------------------
# Qt
#-----------------------------------------------------------------------------
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
list(APPEND _depend_library qcustomplot)
list(APPEND _runtimes_libraries
Qt5::Core Qt5::Gui Qt5::Widgets
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport
)
list(APPEND _runtimes_libraries
OpenCASCADE::TKOpenGl OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKCAF OpenCASCADE::TKCDF OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIGES OpenCASCADE::TKLCAF OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKVCAF OpenCASCADE::TKXCAF OpenCASCADE::TKXDEIGES OpenCASCADE::TKXSBase OpenCASCADE::TKernel Qt5::Widgets Qt5::Xml VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib VTK::IOGeometry
)
target_include_directories(LAMPTool PRIVATE ${Qwt_INCLUDE_DIRS})
@ -55,6 +131,9 @@ target_include_directories(LAMPTool PRIVATE ${Qwt_INCLUDE_DIRS})
target_link_libraries(LAMPTool PRIVATE
${_runtimes_libraries}
${_depend_library}
${PCL_LIBRARIES}
FFTW3::fftw3
GSL::gsl GSL::gslcblas
)
#-----------------------------------------------------------------------------

View File

@ -1,16 +1,16 @@
#include "FEKOFarFieldFileClass.h"
FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass()
LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass()
{
}
FEKOBase::FEKOFarFieldFileClass::~FEKOFarFieldFileClass()
LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::~FEKOFarFieldFileClass()
{
}
void FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
{
QFile file(fileName);
// 加载文本文件中的所有数据到一个 QString 中
@ -76,7 +76,7 @@ void FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
file.close();
}
void FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fileName)
void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fileName)
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
@ -91,7 +91,7 @@ void FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fileName)
}
FEKOBase::FEKOFARFIELDRESULTTYPE FEKOBase::FEKOFARFIELDRESULTTYPEString2Enum(QString str)
FEKOBase::FEKOFARFIELDRESULTTYPE LAMPTOOLAPI FEKOBase::FEKOFARFIELDRESULTTYPEString2Enum(QString str)
{
if (str.toUpper() == "GAIN") { return FEKOBase::GAIN; }
else if (str.toUpper() == "DIRECTIVITY") { return FEKOBase::DIRECTIVITY; }
@ -103,7 +103,7 @@ FEKOBase::FEKOFARFIELDRESULTTYPE FEKOBase::FEKOFARFIELDRESULTTYPEString2Enum(QSt
return FEKOBase::FEKOFARFIELDRESULTTYPE();
}
QString FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode)
QString LAMPTOOLAPI FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode)
{
switch (mode) {
case FEKOBase::GAIN:
@ -120,7 +120,7 @@ QString FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYP
}
}
FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
{
this->dataList.clear();
this->thetaSamples = 0;
@ -136,12 +136,12 @@ FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
this->resultType = FEKOBase::FEKOFARFIELDRESULTTYPEUNKOWN;
}
FEKOBase::FEKOFARFIELDFEKODATABLOCK::~FEKOFARFIELDFEKODATABLOCK()
LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::~FEKOFARFIELDFEKODATABLOCK()
{
}
int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr)
int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr)
{
// 按行进行解析
QList<QString> lines= blockstr.split("\n");
@ -150,7 +150,7 @@ int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QStri
}
int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QList<QString>& lines)
int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QList<QString>& lines)
{
bool in_readHeaderState = false;
size_t headerlineCount = 0;
@ -267,7 +267,7 @@ int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QLi
return 0;
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderString(QString headerstr)
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderString(QString headerstr)
{
headerstr = headerstr.replace("'", "").replace(u8"\"",u8"");
if(headerstr.indexOf("#Configuration Name") != -1)
@ -408,7 +408,7 @@ QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderString(QString h
;
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock()
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock()
{
switch (this->resultType) {
@ -425,22 +425,22 @@ QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock()
}
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Gain()
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Gain()
{
return QString();
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Directivity()
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Directivity()
{
return QString();
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_RCS()
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_RCS()
{
return QString();
}
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_FarFieldValues()
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_FarFieldValues()
{
return QString();
}

View File

@ -3,7 +3,7 @@
#ifndef FARFIELDFILECLASS_H
#define FARFIELDFILECLASS_H
#include "referenceHeader.h"
#include "SARImage/FEKOBaseToolClass.h"
#include "FEKOBaseToolClass.h"
namespace FEKOBase {
@ -21,8 +21,8 @@ namespace FEKOBase {
FARFIELDVALUES,// 远场值
FEKOFARFIELDRESULTTYPEUNKOWN
};
FEKOBase::FEKOFARFIELDRESULTTYPE FEKOFARFIELDRESULTTYPEString2Enum(QString str);
QString QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode);
FEKOBase::FEKOFARFIELDRESULTTYPE LAMPTOOLAPI FEKOFARFIELDRESULTTYPEString2Enum(QString str);
QString LAMPTOOLAPI QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode);
@ -63,7 +63,7 @@ namespace FEKOBase {
double RCS_total = 0;
};
class FEKOFARFIELDFEKODATABLOCK { // 数据块
class LAMPTOOLAPI FEKOFARFIELDFEKODATABLOCK { // 数据块
public:
FEKOFARFIELDFEKODATABLOCK();
~FEKOFARFIELDFEKODATABLOCK();
@ -100,7 +100,7 @@ namespace FEKOBase {
class FEKOFarFieldFileClass: public QObject
class LAMPTOOLAPI FEKOFarFieldFileClass: public QObject
{
Q_OBJECT
public:

View File

@ -1,14 +1,14 @@
// 下面的代码是属性的设置与获取,请补充完整
#include "FEKOSimulationSARClass.h"
#include "BaseToolLib/BaseConstVariable.h"
#include "BaseConstVariable.h"
#include <QMessageBox>
#include <math.h>
#include <complex>
#include "BaseToollib/ImageOperatorBase.h"
#include <SARBaseToolLib/SARImageBase.h>
#include "BaseToollib/FileOperator.h"
#include "ImageOperatorBase.h"
#include "SARImageBase.h"
#include "FileOperator.h"
#include <QtXml/qdom.h>
#include "BaseToollib/GeoOperator.h"
#include "GeoOperator.h"
@ -434,7 +434,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
bool FEKOBase::FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod, ImageAlgWindowFun winfun)
bool LAMPTOOLAPI FEKOBase::FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod, ImageAlgWindowFun winfun)
{
Eigen::MatrixXcd echoData = echodata.getEchoData();
Eigen::MatrixXd antpos = echodata.getAntPos();

View File

@ -1,188 +1,183 @@
#pragma once
/*
* FEKO_SIMULAION_SAR_CLASS FEKO
* FEKOSimulationSARClass
*
*/
#ifndef FEKO_SIMULATION_SAR_CLASS_H
#define FEKO_SIMULATION_SAR_CLASS_H
* FEKO_SIMULAION_SAR_CLASS FEKO
* FEKOSimulationSARClass
*
*/
#ifndef _FEKO_SIMULATION_SAR_CLASS_H
#define _FEKO_SIMULATION_SAR_CLASS_H
#include "referenceHeader.h"
#include "OCCTBase.h"
#include "BaseToollib/GeoOperator.h"
#include "SARImage/FEKOBaseToolClass.h"
#include "SARBaseToolLib/SARImageBase.h"
#include "GeoOperator.h"
#include "FEKOBaseToolClass.h"
#include "SARImageBase.h"
#include <QObject>
namespace FEKOBase {
//==========================================================
// FEKO成像仿真参数类
// FEKO成像仿真参数类
//==========================================================
class FEKOSimulationDataparams:public QObject
{ // 仿真参数类
class LAMPTOOLAPI FEKOSimulationDataparams : public QObject { // 仿真参数类
Q_OBJECT
public:
FEKOSimulationDataparams(QObject* parent=nullptr);
FEKOSimulationDataparams(QObject* parent = nullptr);
~FEKOSimulationDataparams();
signals:
void FEKOSimulationDataparamsChanged(); // 响应时间,作为一个参数分发
public: // 频率更新
void CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false);
void updateFEKOSimulationFreqParams(double startfreq, double endfreq, size_t freqpoints);
public: // 频率更新
void CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth,
double scenceRange, bool isResolution = false);
void updateFEKOSimulationFreqParams(double startfreq, double endfreq, size_t freqpoints);
public:
void loadXml(const QString& fileName);
void saveXml(const QString& fileName);
void loadXml(const QString& fileName);
void saveXml(const QString& fileName);
public: // 属性字段
QString taskName; // 任务名称
FEKOImageMode imagemode; // 成像时间
QString AntennaRadiationFileName; // 远程天线等效辐射方向图文件地址
long farsource_thetaPoints;
long farsource_phiPoints;
public: // 属性字段
QString taskName; // 任务名称
FEKOImageMode imagemode; // 成像时间
QString AntennaRadiationFileName; // 远程天线等效辐射方向图文件地址
long farsource_thetaPoints;
long farsource_phiPoints;
bool isRight = false; // 是否为右视
double refRange; // 参考距离 m
double incangle; // 入射角 °
bool isRight = false; // 是否为右视
double refRange;// 参考距离 m
double incangle; // 入射角 °
double centerFreq; // 中心频率
double rangeResolution; // 分辨率
double bandwidth; // 带宽
double centerFreq; // 中心频率
double rangeResolution;//分辨率
double bandwidth;// 带宽
double startfreq; // 频率参数
double endfreq;
double freqpoints;
double startfreq; // 频率参数
double endfreq;
double freqpoints;
// 成像场景设置
double x_min;
double x_max;
double y_min;
double y_max;
double z_plane;
//成像场景设置
double x_min;
double x_max;
double y_min;
double y_max;
double z_plane;
size_t imageheight; // 图像高度
size_t imagewidth; // 图像宽度
size_t imageheight; // 图像高度
size_t imagewidth; // 图像宽度
// 条带模式参数
size_t prfcount; // 脉冲数量
double start_x;
double end_x;
double start_y;
double end_y;
double start_z;
double end_z;
size_t prfcount; // 脉冲数量
double start_x;
double end_x;
double start_y;
double end_y;
double start_z;
double end_z;
// 扫描模式参数
double start_az_angle; // 扫描起始角
double end_az_angle; // 扫描终止角
double start_az_angle; // 扫描起始角
double end_az_angle; // 扫描终止角
// ISAR模式参数 , 圆迹模式参数
double start_circle_angle; // 起始扫描角
double end_circle_angle; // 终止扫描角
double delta_angle;// 扫描角间隔
double start_circle_angle; // 起始扫描角
double end_circle_angle; // 终止扫描角
double delta_angle; // 扫描角间隔
public:
void setTaskName(QString taskName);
QString getTaskName();
public:
void setTaskName(QString taskName);
QString getTaskName();
// 成像模式
void setImagemode(FEKOImageMode imagemode);
void setImagemode(FEKOImageMode imagemode);
FEKOImageMode getImagemode();
// 是否为右视
void setIsRight(bool isRight);
bool getIsRight();
void setIsRight(bool isRight);
bool getIsRight();
// 参考距离
void setRefRange(double refRange);
double getRefRange();
void setRefRange(double refRange);
double getRefRange();
// 入射角
void setIncangle(double incangle);
double getIncangle();
void setIncangle(double incangle);
double getIncangle();
// 中心频率
void setCenterFreq(double centerFreq);
double getCenterFreq();
void setCenterFreq(double centerFreq);
double getCenterFreq();
// 分辨率
void setRangeResolution(double rangeResolution);
double getRangeResolution();
void setRangeResolution(double rangeResolution);
double getRangeResolution();
// 带宽
void setBandwidth(double bandwidth);
double getBandwidth();
void setBandwidth(double bandwidth);
double getBandwidth();
// 频率参数
void setStartfreq(double startfreq);
double getStartfreq();
void setEndfreq(double endfreq);
double getEndfreq();
void setFreqpoints(double freqpoints);
double getFreqpoints();
void setStartfreq(double startfreq);
double getStartfreq();
void setEndfreq(double endfreq);
double getEndfreq();
void setFreqpoints(double freqpoints);
double getFreqpoints();
// 成像范围
void setX_min(double x_min);
double getX_min();
void setX_max(double x_max);
double getX_max();
void setY_min(double y_min);
double getY_min();
void setY_max(double y_max);
double getY_max();
void setZ_plane(double z_plane);
double getZ_plane();
void setX_min(double x_min);
double getX_min();
void setX_max(double x_max);
double getX_max();
void setY_min(double y_min);
double getY_min();
void setY_max(double y_max);
double getY_max();
void setZ_plane(double z_plane);
double getZ_plane();
// 图像高度
void setImageheight(size_t imageheight);
size_t getImageheight();
void setImageheight(size_t imageheight);
size_t getImageheight();
// 图像宽度
void setImagewidth(size_t imagewidth);
size_t getImagewidth();
void setImagewidth(size_t imagewidth);
size_t getImagewidth();
// 条带模式参数
void setPRFCount(size_t prfcount);
size_t getPRFCount();
void setStart_x(double start_x);
double getStart_x();
void setEnd_x(double end_x);
double getEnd_x();
void setStart_y(double start_y);
double getStart_y();
void setEnd_y(double end_y);
double getEnd_y();
void setStart_z(double start_z);
double getStart_z();
void setEnd_z(double end_z);
double getEnd_z();
double getStart_az_angle(); // 扫描起始角
double getEnd_az_angle(); // 扫描终止角
double getStart_circle_angle(); // 起始扫描角
double getEnd_circle_angle(); // 终止扫描角
double getDelta_angle();// 扫描角间隔
void setPRFCount(size_t prfcount);
size_t getPRFCount();
void setStart_x(double start_x);
double getStart_x();
void setEnd_x(double end_x);
double getEnd_x();
void setStart_y(double start_y);
double getStart_y();
void setEnd_y(double end_y);
double getEnd_y();
void setStart_z(double start_z);
double getStart_z();
void setEnd_z(double end_z);
double getEnd_z();
double getStart_az_angle(); // 扫描起始角
double getEnd_az_angle(); // 扫描终止角
double getStart_circle_angle(); // 起始扫描角
double getEnd_circle_angle(); // 终止扫描角
double getDelta_angle(); // 扫描角间隔
void setStart_az_angle(double Start_az_angle); // 扫描起始角
void setEnd_az_angle(double End_az_angle); // 扫描终止角
void setStart_circle_angle(double Start_circle_angle); // 起始扫描角
void setEnd_circle_angle(double End_circle_angle); // 终止扫描角
void setDelta_angle(double Delta_angle);// 扫描角间隔
QString getAntennaRadiationFileName();
void setAntennaRadiationFileName( QString path);
long getFarsourceThetaPoints();
void setFarsourceThetaPoints(long thetaPoints);
long getFarsourcePhiPoints();
void setFarsourcePhiPoints(long phiPoints);
void setStart_az_angle(double Start_az_angle); // 扫描起始角
void setEnd_az_angle(double End_az_angle); // 扫描终止角
void setStart_circle_angle(double Start_circle_angle); // 起始扫描角
void setEnd_circle_angle(double End_circle_angle); // 终止扫描角
void setDelta_angle(double Delta_angle); // 扫描角间隔
QString getAntennaRadiationFileName();
void setAntennaRadiationFileName(QString path);
long getFarsourceThetaPoints();
void setFarsourceThetaPoints(long thetaPoints);
long getFarsourcePhiPoints();
void setFarsourcePhiPoints(long phiPoints);
};
class FEKOSimulationDataparamsHandler {
class LAMPTOOLAPI FEKOSimulationDataparamsHandler {
public:
FEKOSimulationDataparamsHandler();
~FEKOSimulationDataparamsHandler();
public:
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams;
void setFEKOSimulationDataparams(std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams);
void setFEKOSimulationDataparams(
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams);
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> getFEKOSimulationDataparams();
public:
@ -190,70 +185,75 @@ namespace FEKOBase {
};
//==========================================================
// FEKO仿真成像参数类
// FEKO仿真成像参数类
// 解析成像参数xml
//==========================================================
class FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler
{
class LAMPTOOLAPI FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler {
public:
FEKOSimulationSARClass();
FEKOSimulationSARClass();
~FEKOSimulationSARClass();
public:
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist;// FEKO的天线参数设置
void setFEKOAntPoselist(std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist); // FEKO的天线参数设置
public:
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist; // FEKO的天线参数设置
void setFEKOAntPoselist(
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist); // FEKO的天线参数设置
std::vector<FEKOBase::FEKOSatelliteParams> getFEKOAntPoselist();
public:
void generator_STRIP_FEKOSatelliteParams();
void generator_SCAN_FEKOSatelliteParams();
void generator_ISAR_FEKOSatelliteParams();
void generator_CircleSAR_FEKOSatelliteParams();
void generator_FEKOSatelliteParams();
void generator_STRIP_FEKOSatelliteParams();
void generator_SCAN_FEKOSatelliteParams();
void generator_ISAR_FEKOSatelliteParams();
void generator_CircleSAR_FEKOSatelliteParams();
void generator_FEKOSatelliteParams();
virtual void refreshFEKOSimulationParams();
public:
QString workSpace; // 工作空间
QString workSpace; // 工作空间
QString AntennaRadiationPath; // 远程天线等效辐射方向图文件地址
QString xmlpath;
public : // 初始化模型
void loadFEKOImageSettingXML(QString xmlpath);
void saveFEKOImageSettingXML();
public: // 初始化模型
void loadFEKOImageSettingXML(QString xmlpath);
void saveFEKOImageSettingXML();
QString createLuaSciptString(size_t startprfidx, size_t endprfidx);
};
//==========================================================
// FEKO成像
// FEKO成像
//==========================================================
bool FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod = FEKOImageAlgorithm::TBP_FREQ, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
class FEKOImageProcessAbstractClass {
bool LAMPTOOLAPI FEKOImageProcess(EchoDataClass& echodata,
FEKOImageSettingParams& imageSettingParams, QString& outPath,
FEKOImageAlgorithm algmethod = FEKOImageAlgorithm::TBP_FREQ,
ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
class LAMPTOOLAPI FEKOImageProcessAbstractClass {
public:
FEKOImageProcessAbstractClass();
~FEKOImageProcessAbstractClass();
private:
EchoDataClass echodata; // 原始回波数据 -
EchoDataClass echodata; // 原始回波数据 -
FEKOImageSettingParams imageSettingParams; // 成像参数
FEKOImageAlgorithm algmethod; // 成像算法
QString tiffPath;
FEKOImageAlgorithm algmethod; // 成像算法
QString tiffPath;
public:
// 构建与成员变量有关的属性函数
void setEchoData(EchoDataClass echodata);
EchoDataClass getEchoData() const;
void setImageSettingParams(FEKOImageSettingParams imageSettingParams);
void setEchoData(EchoDataClass echodata);
EchoDataClass getEchoData() const;
void setImageSettingParams(FEKOImageSettingParams imageSettingParams);
FEKOImageSettingParams getImageSettingParams();
void setAlgmethod(FEKOImageAlgorithm algmethod);
FEKOImageAlgorithm getAlgmethod();
void settiffPath(QString outtiffPath);
QString gettiffPath();
void LoadEchoDataPath(QString echoPath);
void setAlgmethod(FEKOImageAlgorithm algmethod);
FEKOImageAlgorithm getAlgmethod();
void settiffPath(QString outtiffPath);
QString gettiffPath();
void LoadEchoDataPath(QString echoPath);
public: // 成像参数
bool Imageprocess();
};
};
}; // namespace FEKOBase
#endif

View File

@ -6,8 +6,8 @@
#include <QtWidgets/QMainWindow>
#include "ui_LAMPTool.h"
class LAMPTool : public QMainWindow
#include "LAMPToolAPI.h"
class LAMPTOOLAPI LAMPTool : public QMainWindow
{
Q_OBJECT

View File

@ -1,6 +1,6 @@
#include "OCCTBase.h"
#include "referenceHeader.h"
#include <opencascade\BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
// ===================================================================
@ -8,7 +8,7 @@
// ===================================================================
OCCTShapeType str2OCCTShapeType(QString str)
OCCTShapeType LAMPTOOLAPI str2OCCTShapeType(QString str)
{
if (str.isEmpty()) {
return OCCTShapeType::NoneType;
@ -28,7 +28,7 @@ OCCTShapeType str2OCCTShapeType(QString str)
return OCCTShapeType();
}
QStringList getOCCTShapeTypeEmnu()
QStringList LAMPTOOLAPI getOCCTShapeTypeEmnu()
{
QStringList list;
list.push_back(QString(u8"STL"));
@ -38,27 +38,27 @@ QStringList getOCCTShapeTypeEmnu()
return list;
}
QString getOCCTShapeTypeFilterString()
QString LAMPTOOLAPI getOCCTShapeTypeFilterString()
{
return QString(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)");
}
QString get_STL_FilterString()
QString LAMPTOOLAPI get_STL_FilterString()
{
return QString(u8"STL Files (*.stl);;STL Files (*.stla)");
}
QString get_STEP_FilterString()
QString LAMPTOOLAPI get_STEP_FilterString()
{
return QString(u8"step Files (*.stp);;step Files (*.step)");
}
QString get_IGES_FilterString()
QString LAMPTOOLAPI get_IGES_FilterString()
{
return QString(u8"IGES Files (*.iges);;IGES Files (*.igs)");
}
QString getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
{
switch (switch_on)
{
@ -71,26 +71,26 @@ QString getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
}
}
QString getOCCTShapeTypeFilterString(QString str)
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(QString str)
{
return getOCCTShapeTypeFilterString(str2OCCTShapeType(str));
}
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) {
bool LAMPTOOLAPI SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) {
// 将形状保存为 STL 文件
qDebug() << u8"SaveTopoDs_Stl " << FilePath;
StlAPI_Writer writer;
writer.Write(shape, FilePath.toStdString().c_str()); // 保存为stl模型
return true;
}
bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) {
bool LAMPTOOLAPI SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) {
qDebug() << u8"SaveTopoDs_Step " << FilePath;
STEPControl_Writer writer;
writer.Transfer(shape, STEPControl_AsIs);
writer.Write(FilePath.toStdString().c_str());
return true;
}
bool SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
bool LAMPTOOLAPI SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
qDebug() << u8"SaveTopoDs_IGES " << FilePath;
IGESControl_Writer writer;
writer.AddShape(shape);
@ -98,7 +98,7 @@ bool SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
return true;
}
bool SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType shapetype)
bool LAMPTOOLAPI SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType shapetype)
{
switch (shapetype)
{
@ -125,20 +125,20 @@ bool SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType s
return true;
}
TopoDS_Shape ReadTopoDs_IGES(QString Filepath) {
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_IGES(QString Filepath) {
IGESControl_Reader reader;
reader.ReadFile(Filepath.toStdString().c_str());
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
return shape;
}
TopoDS_Shape ReadTopoDs_Stl(QString Filepath) {
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Stl(QString Filepath) {
TopoDS_Shape shape_TopoDs;
StlAPI_Reader aReader_Stl;
aReader_Stl.Read(shape_TopoDs, Filepath.toStdString().c_str());
return shape_TopoDs;
}
TopoDS_Shape ReadTopoDs_Step(QString Filepath) {
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Step(QString Filepath) {
TopoDS_Shape shape;
STEPControl_Reader reader;
IFSelect_ReturnStatus status = reader.ReadFile(Filepath.toStdString().c_str());
@ -152,7 +152,7 @@ TopoDS_Shape ReadTopoDs_Step(QString Filepath) {
}
}
OCCTShapeType ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
OCCTShapeType LAMPTOOLAPI ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
{
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
@ -182,7 +182,7 @@ OCCTShapeType ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
}
}
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
TopoDS_Shape LAMPTOOLAPI MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
{
// 创建一个复合体
TopoDS_Compound compound;
@ -199,7 +199,7 @@ TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
}
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
void LAMPTOOLAPI ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
{
// 将颜色应用到模型
@ -208,7 +208,7 @@ void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius) {
TopoDS_Shape LAMPTOOLAPI CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius) {
// 创建一个圆柱作为箭头的主体
gp_Pnt origin(0, 0, 0);
gp_Ax2 axis(origin, direction);
@ -230,7 +230,7 @@ TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard
}
gp_Trsf GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec& vectorB)
gp_Trsf LAMPTOOLAPI GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec& vectorB)
{
// 计算旋转轴和旋转角度
gp_Vec rotationAxis = vectorA.Crossed(vectorB);
@ -250,7 +250,7 @@ gp_Trsf GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec& vectorB)
}
TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi, double X, double Y, double Z)
TopoDS_Shape LAMPTOOLAPI Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi, double X, double Y, double Z)
{
gp_Vec Position(gp_Pnt(0, 0, 0), gp_Pnt(X, Y, Z));
gp_Trsf rotationTransform_theta;
@ -270,7 +270,7 @@ TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta,
return result;
}
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength)
TopoDS_Shape LAMPTOOLAPI CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength)
{
// 创建三个方向的箭头
@ -296,21 +296,21 @@ TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, doub
return compound;
}
TopoDS_Shape CreateBox(double x, double y, double z)
TopoDS_Shape LAMPTOOLAPI CreateBox(double x, double y, double z)
{
// 创建一个长方体
BRepPrimAPI_MakeBox box(gp_Pnt(-x / 2, -y / 2, -z / 2), gp_Pnt(x / 2, y / 2, z / 2));
return box.Shape();
}
TopoDS_Shape CreateCylinder(double radius, double height)
TopoDS_Shape LAMPTOOLAPI CreateCylinder(double radius, double height)
{
BRepPrimAPI_MakeCylinder makeCylinder(radius, height);
TopoDS_Shape cylinderShape = makeCylinder.Shape();
return cylinderShape;
}
TopoDS_Shape CreateCone(double radius1, double radius2, double height)
TopoDS_Shape LAMPTOOLAPI CreateCone(double radius1, double radius2, double height)
{
BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(radius1, radius2, height);
TopoDS_Shape coneShape = mkCone.Shape();
@ -318,29 +318,29 @@ TopoDS_Shape CreateCone(double radius1, double radius2, double height)
return coneShape;
}
TopoDS_Shape CreateSphere(double radius)
TopoDS_Shape LAMPTOOLAPI CreateSphere(double radius)
{
return TopoDS_Shape();
}
TopoDS_Shape CreateTorus(double majorRadius, double minorRadius)
TopoDS_Shape LAMPTOOLAPI CreateTorus(double majorRadius, double minorRadius)
{
return TopoDS_Shape();
}
TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
TopoDS_Shape LAMPTOOLAPI Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
{
return TopoDS_Shape();
}
TopoDS_Shape Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
TopoDS_Shape LAMPTOOLAPI Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
{
return TopoDS_Shape();
}
TopoDS_Shape Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
TopoDS_Shape LAMPTOOLAPI Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
{
// 进行旋转
angle= angle * M_PI / 180;
@ -350,7 +350,7 @@ TopoDS_Shape Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
return rotateTransform_X.Shape();
}
TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec)
TopoDS_Shape LAMPTOOLAPI Translate(TopoDS_Shape& shape, gp_Vec move_vec)
{
gp_Trsf translation;
translation.SetTranslation(move_vec);
@ -358,7 +358,7 @@ TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec)
return translateTransform.Shape();
}
TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale)
TopoDS_Shape LAMPTOOLAPI Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale)
{
gp_Trsf scaleTransform;
scaleTransform.SetScale(refrenceCenter, scale);
@ -366,7 +366,7 @@ TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale)
return scaleTransformBuilder.Shape();
}
TopoDS_Shape createConicalHorn(double bottomRadius, double bottomHeight, double topRadius, double topHeight)
TopoDS_Shape LAMPTOOLAPI createConicalHorn(double bottomRadius, double bottomHeight, double topRadius, double topHeight)
{
BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(bottomRadius,topRadius,topHeight);
@ -394,7 +394,7 @@ TopoDS_Shape createConicalHorn(double bottomRadius, double bottomHeight, double
return compound;
}
TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl)
TopoDS_Shape LAMPTOOLAPI createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl)
{
@ -402,7 +402,7 @@ TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double
return TopoDS_Shape();
}
TopoDS_Shape CreateWedge(double x, double y, double z)
TopoDS_Shape LAMPTOOLAPI CreateWedge(double x, double y, double z)
{

View File

@ -2,6 +2,7 @@
#ifndef OCCTBASELAMP_H
#define OCCTBASELAMP_H
#include "LAMPToolAPI.h"
#include "referenceHeader.h"
@ -17,45 +18,45 @@ enum OCCTShapeType
NoneType,
};
OCCTShapeType str2OCCTShapeType(QString str);
QStringList getOCCTShapeTypeEmnu();
QString getOCCTShapeTypeFilterString();
QString get_STL_FilterString();
QString get_STEP_FilterString();
QString get_IGES_FilterString();
QString getOCCTShapeTypeFilterString(OCCTShapeType t);
QString getOCCTShapeTypeFilterString(QString str);
OCCTShapeType LAMPTOOLAPI str2OCCTShapeType(QString str);
QStringList LAMPTOOLAPI getOCCTShapeTypeEmnu();
QString LAMPTOOLAPI getOCCTShapeTypeFilterString();
QString LAMPTOOLAPI get_STL_FilterString();
QString LAMPTOOLAPI get_STEP_FilterString();
QString LAMPTOOLAPI get_IGES_FilterString();
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(OCCTShapeType t);
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(QString str);
// 常用静态函数
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape);
bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape);
bool SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape);
bool SaveTopoDs(QString FilePath,const TopoDS_Shape& shape, OCCTShapeType type);
bool LAMPTOOLAPI SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs(QString FilePath,const TopoDS_Shape& shape, OCCTShapeType type);
TopoDS_Shape ReadTopoDs_IGES(QString Filepath);
TopoDS_Shape ReadTopoDs_Stl(QString Filepath);
TopoDS_Shape ReadTopoDs_Step(QString Filepath);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_IGES(QString Filepath);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Stl(QString Filepath);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Step(QString Filepath);
OCCTShapeType ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs);
OCCTShapeType LAMPTOOLAPI ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs);
// 模型合并
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist);
TopoDS_Shape LAMPTOOLAPI MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist);
// 修改模型显示
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor);
void LAMPTOOLAPI ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor);
//// 创建箭头
TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius);
TopoDS_Shape LAMPTOOLAPI CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius);
//
// OCCT 根据向量A和B,计算变换矩阵
gp_Trsf GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B);
gp_Trsf LAMPTOOLAPI GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B);
TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi,double X,double Y,double Z);
TopoDS_Shape LAMPTOOLAPI Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi,double X,double Y,double Z);
//TopoDS_Shape Createpyramid(double width=10.0,double depth=5.0, double mouthWidth=1.0, double mouthHeight=0.5, double height = 15.0);
@ -63,27 +64,27 @@ TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta,
// 创建一个笛卡尔坐标系
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength);
TopoDS_Shape LAMPTOOLAPI CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength);
// 常见模型创建
TopoDS_Shape CreateBox(double x, double y, double z);
TopoDS_Shape CreateCylinder(double radius, double height);
TopoDS_Shape CreateCone(double radius_bottom, double radius_top, double height);
TopoDS_Shape CreateSphere(double radius);
TopoDS_Shape CreateTorus(double majorRadius, double minorRadius);
TopoDS_Shape LAMPTOOLAPI CreateBox(double x, double y, double z);
TopoDS_Shape LAMPTOOLAPI CreateCylinder(double radius, double height);
TopoDS_Shape LAMPTOOLAPI CreateCone(double radius_bottom, double radius_top, double height);
TopoDS_Shape LAMPTOOLAPI CreateSphere(double radius);
TopoDS_Shape LAMPTOOLAPI CreateTorus(double majorRadius, double minorRadius);
// 常见模型操作
TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape LAMPTOOLAPI Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape LAMPTOOLAPI Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
// 常见操作 -- 模型旋转、平移、缩放
TopoDS_Shape Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle);
TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec);
TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale);
TopoDS_Shape LAMPTOOLAPI Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle);
TopoDS_Shape LAMPTOOLAPI Translate(TopoDS_Shape& shape, gp_Vec move_vec);
TopoDS_Shape LAMPTOOLAPI Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale);
// 创建散射体雷达
// 创建一个坐标原点为圆心的
TopoDS_Shape createConicalHorn(double bottomRadius,double bottomHeight,double topRadius,double topHeight);
TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl);
TopoDS_Shape LAMPTOOLAPI createConicalHorn(double bottomRadius,double bottomHeight,double topRadius,double topHeight);
TopoDS_Shape LAMPTOOLAPI createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl);

View File

@ -1,14 +0,0 @@
#include "BackScatterModel.h"
#include <complex>
#include <math.h>
double MuhlemanSimulationBackScatter(double incidentAngle)
{
return 0.0133*cos(incidentAngle)/pow(sin(incidentAngle)+0.1*cos(incidentAngle), 3);
}
Eigen::MatrixXd MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle)
{
return 0.0133 * (incidentAngle.array().cos()) / ((incidentAngle.array().sin()) + cos(incidentAngle.array().cos()*0.1).pow(3));
}

View File

@ -1,12 +0,0 @@
#pragma once
#include <Eigen/Core>
#include <Eigen/Dense>
double MuhlemanSimulationBackScatter(double incidentAngle);
Eigen::MatrixXd MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle);

View File

@ -1,283 +0,0 @@
// SARBaseTool.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "BaseToollib/ImageOperatorBase.h"
#include "SARBaseTool.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <proj.h>
#include <string.h>
#include <memory.h>
#include <memory>
#include <fftw3.h>
int Complex2dB(QString in_tiff, QString out_dB_path)
{
GDALAllRegister();
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(in_tiff);
int width = rasterDataset->GetRasterXSize();
int height = rasterDataset->GetRasterYSize();
int band_num = rasterDataset->GetRasterCount();
double* gt = new double[6];
std::shared_ptr<double> gt_ptr(gt);
QString projectDef = rasterDataset->GetProjectionRef();
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
bool _nGt_flag = false;
if (projectDef == "") {
_nGt_flag = true;
}
else {
_nGt_flag = false;
}
CreateDataset(out_dB_path, height, width, 1, gt_ptr.get(), projectDef, GDT_Float64, _nGt_flag);
// 计算大小
if (gdal_datatype == 0) {
return 1;
}
else if (gdal_datatype < 8) {
if (band_num != 2) { return 1; }
}
else if (gdal_datatype < 12) {
if (band_num != 1) { return 1; }
}
int block_num = block_num_pre_memory(width, height, gdal_datatype, 1e9);//
block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num;
for (int i = 0; i < height; i = block_num + i) {
if (height - i < block_num) {
line_num = height - i;
}
else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 1);// 必须强制行优先
if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num * width, 1);
Eigen::MatrixX<char> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_UInt16) {
Eigen::MatrixX<unsigned short > real_mat(line_num * width, 1);
Eigen::MatrixX<unsigned short > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_Int16) {
Eigen::MatrixX<short > real_mat(line_num * width, 1);
Eigen::MatrixX<short > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_UInt32) {
Eigen::MatrixX<unsigned int > real_mat(line_num * width, 1);
Eigen::MatrixX<unsigned int > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_Int32) {
Eigen::MatrixX<int > real_mat(line_num * width, 1);
Eigen::MatrixX<int > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
//else if (gdal_datatype == GDT_UInt64) {
// Eigen::MatrixX<unsigned long> real_mat(line_num * width, 1);
// Eigen::MatrixX<unsigned long> imag_mat(line_num * width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
// _flag = true;
//}
//else if (gdal_datatype == GDT_Int64) {
// Eigen::MatrixX<long> real_mat(line_num * width, 1);
// Eigen::MatrixX<long> imag_mat(line_num * width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
// _flag = true;
//}
else if (gdal_datatype == GDT_Float32) {
Eigen::MatrixX<float> real_mat(line_num * width, 1);
Eigen::MatrixX<float> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_Float64) {
Eigen::MatrixX<double> real_mat(line_num * width, 1);
Eigen::MatrixX<double> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = ((real_mat.array().cast<double>()).array().pow(2) + (imag_mat.array().cast<double>()).array().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_CInt16) {
Eigen::MatrixX<complex<short>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>().array().pow(2) + complex_short_mat.imag().array().cast<double>().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_CInt32) {
Eigen::MatrixX<complex<int>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>().array().pow(2) + complex_short_mat.imag().array().cast<double>().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_CFloat32) {
Eigen::MatrixX<complex<float>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>().array().pow(2) + complex_short_mat.imag().array().cast<double>().pow(2)).log10() * 10.0;
_flag = true;
}
else if (gdal_datatype == GDT_CFloat64) {
Eigen::MatrixX<complex<double>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>().array().pow(2) + complex_short_mat.imag().array().cast<double>().pow(2)).log10() * 10.0;
_flag = true;
}
else {}
// 保存数据
if (_flag) {
// 定义赋值矩阵
saveDataset(out_dB_path, i, 0, 1, width, line_num, data_mat.data());
}
else {
}
}
return 0;
}
int Amplitude2dB(QString in_tiff, QString out_dB_path)
{
GDALAllRegister();
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(in_tiff);
int width = rasterDataset->GetRasterXSize();
int height = rasterDataset->GetRasterYSize();
int band_num = rasterDataset->GetRasterCount();
double* gt = new double[6];
std::shared_ptr<double> gt_ptr(gt);
QString projectDef = rasterDataset->GetProjectionRef();
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
bool _nGt_flag = false;
if (projectDef == "") {
_nGt_flag = true;
}
else {
_nGt_flag = false;
}
CreateDataset(out_dB_path, height, width, 1, gt_ptr.get(), projectDef, GDT_Float64, _nGt_flag);
// 计算大小
if (gdal_datatype == 0) {
return 1;
}
else if (gdal_datatype < 8) {
if (band_num != 1) { return 1; }
}
else { return 1; }
int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);//
block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num;
for (int i = 0; i < height; i = block_num + i) {
if (height - i < block_num) {
line_num = height - i;
}
else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat = ReadMatrixDoubleData(i, width, line_num, rasterDataset, gdal_datatype, 1);
_flag = (data_mat.rows() > 0) && (data_mat.cols() > 0);
// 保存数据
if (_flag) {
// 定义赋值矩阵
saveDataset(out_dB_path, i, 0, 1, width, line_num, data_mat.data());
}
else {
}
}
return 0;
}
Eigen::MatrixXd Complex2dB(Eigen::MatrixXcd in_matrix)
{
return Complex2dB(in_matrix.real().array(), in_matrix.imag().array());
}
Eigen::MatrixXd Complex2dB(Eigen::MatrixXd in_matrix_real, Eigen::MatrixXd in_matrix_imag)
{
return (in_matrix_real.array().pow(2) + in_matrix_imag.array().pow(2)).log10() * 10;
}
double Complex2Amplitude(std::complex<double> sign)
{
return sqrt(pow(sign.real(),2)+pow(sign.imag(),2));
}
double Complex2phase(std::complex<double> sign)
{
//return (sign.real() == 0)*((sign.imag() < 0) * PI / 2)+ (sign.real() != 0)*(atan(sign.imag() / sign.real()) + (sign.real() < 0) * ((sign.imag() <= 0) * PI));
if (sign.real() != 0) {
return atan(sign.imag() / sign.real()) + (sign.real() < 0) * ((sign.imag() <= 0) * PI);
}
else {
return (sign.imag() < 0) * PI / 2;
}
}
Eigen::MatrixXd Complex2Amplitude(Eigen::MatrixXcd in_matrix)
{
return in_matrix.array().abs().cast<double>().array();
}
Eigen::MatrixXd Complex2phase(Eigen::MatrixXcd in_matrix)
{
// 复数转相位
Eigen::MatrixXd result = in_matrix.real().array();
int rows = in_matrix.rows();
int cols = in_matrix.cols();
for (int i = 0; i < rows; i++) { // 可能是性能瓶颈
for (int j = 0; j < cols; j++) {
result(i, j) = Complex2phase(in_matrix(i, j));
}
}
return result;
}
int Complex2dB_DLL(QString out_path, QString in_sar_path)
{
return Complex2dB(in_sar_path, out_path);
}
int Amplitude2dB_DLL(QString in_tiff, QString out_dB_path)
{
return Amplitude2dB(in_tiff, out_dB_path);
}

View File

@ -1,65 +0,0 @@
#pragma once
/**
* SARBaseTool
*
*/
#include <complex>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <gdal.h>
#include <gdal_utils.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <proj.h>
#include <string.h>
#include <memory.h>
#include <memory>
#define PI 3.141592653589793238462643383279
#define PI_180 180/3.141592653589793238462643383279
#define T180_PI 3.141592653589793238462643383279/180
#define LIGHTSPEED 299792458
#define LIGHESPEEDGHZ 0.299792458
#define Radians2Degrees(Radians) Radians*PI_180
#define Degrees2Radians(Degrees) Degrees*T180_PI
// 判断是否需要输出为DLL
#define DLLOUT
int Complex2dB(QString in_tiff, QString out_dB_path);
int Amplitude2dB(QString in_tiff, QString out_dB_path);
Eigen::MatrixXd Complex2dB(Eigen::MatrixXcd in_matrix);
Eigen::MatrixXd Complex2dB(Eigen::MatrixXd in_matrix_real, Eigen::MatrixXd in_matrix_imag );
double Complex2Amplitude(std::complex<double> sign);
double Complex2phase(std::complex<double> sign);// 返回弧度制相位
Eigen::MatrixXd Complex2Amplitude(Eigen::MatrixXcd in_matrix);
Eigen::MatrixXd Complex2phase(Eigen::MatrixXcd in_matrix);
// ----------------------------------------------------------------------------------------------------------
// 后向散射系数系统仿真模型
#ifndef DLLOUT
#else
#ifdef __cplusplus
extern "C" {
#endif
#define DllExport __declspec( dllexport )
int __declspec(dllexport) Complex2dB_DLL(QString out_path, QString in_sar_path);
int __declspec(dllexport) Amplitude2dB_DLL(QString in_tiff, QString out_dB_path);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,384 +0,0 @@
#include "SARCalibration.h"
#include "BaseToollib/ImageOperatorBase.h"
#include "SARBaseTool.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <proj.h>
#include <string.h>
#include <memory.h>
#include <memory>
using namespace std;
using namespace Eigen;
/**
* ENVI
*/
Eigen::Matrix2cd CalibrationMatrix(Eigen::MatrixXcd in_matrix, double calibrationValue)
{
return in_matrix.array() * calibrationValue;
}
int CalibrationSiglePolarSAR(QString out_path, QString in_sar_path, double calibrationValue)
{
return CalibrationComplex(out_path, in_sar_path, calibrationValue);
}
int CalibrationComplex(const QString& out_path, const QString& in_sar_path, double calibrationValue)
{
GDALAllRegister();
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(in_sar_path);
int width = rasterDataset->GetRasterXSize();
int height = rasterDataset->GetRasterYSize();
int band_num = rasterDataset->GetRasterCount();
double* gt = new double[6];
std::shared_ptr<double> gt_ptr(gt);
QString projectDef = rasterDataset->GetProjectionRef();
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
bool _nGt_flag = false;
if (projectDef == "") {
_nGt_flag = true;
}
else {
_nGt_flag = false;
}
CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag);
// 计算大小
if (gdal_datatype == 0) {
return 1;
}
else if (gdal_datatype < 8) {
if (band_num != 2) { return 1; }
}
else if (gdal_datatype < 12) {
if (band_num != 1) { return 1; }
}
else {}
int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);//
block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num;
for (int i = 0; i < height; i= block_num+i) {
if (height - i < block_num) {
line_num = height - i;
}
else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先
if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num*width,1);
Eigen::MatrixX<char> imag_mat(line_num*width,1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_UInt16) {
Eigen::MatrixX<unsigned short > real_mat(line_num * width, 1);
Eigen::MatrixX<unsigned short > imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Int16) {
Eigen::MatrixX<short > real_mat(line_num*width, 1);
Eigen::MatrixX<short > imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_UInt32) {
Eigen::MatrixX<unsigned int > real_mat(line_num*width, 1);
Eigen::MatrixX<unsigned int > imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Int32) {
Eigen::MatrixX<int > real_mat(line_num*width, 1);
Eigen::MatrixX<int > imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
//else if (gdal_datatype == GDT_UInt64) {
// Eigen::MatrixX<unsigned long> real_mat(line_num*width, 1);
// Eigen::MatrixX<unsigned long> imag_mat(line_num*width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
// data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
// _flag = true;
//}
//else if (gdal_datatype == GDT_Int64) {
// Eigen::MatrixX<long> real_mat(line_num*width, 1);
// Eigen::MatrixX<long> imag_mat(line_num*width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
// data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
// _flag = true;
//}
else if (gdal_datatype == GDT_Float32) {
Eigen::MatrixX<float> real_mat(line_num*width, 1);
Eigen::MatrixX<float> imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Float64) {
Eigen::MatrixX<double> real_mat(line_num*width, 1);
Eigen::MatrixX<double> imag_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) =( imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CInt16) {
Eigen::MatrixX<complex<short>> complex_short_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CInt32) {
Eigen::MatrixX<complex<int>> complex_short_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CFloat32) {
Eigen::MatrixX<complex<float>> complex_short_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CFloat64) {
Eigen::MatrixX<complex<double>> complex_short_mat(line_num*width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else {}
// 保存数据
if (_flag) {
// 定义赋值矩阵
saveDataset(out_path, i,0,1, width, line_num, data_mat.data());
}
else {
}
}
return -1;
}
int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, double calibrationValue)
{
GDALAllRegister();
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(in_sar_path);
int width = rasterDataset->GetRasterXSize();
int height = rasterDataset->GetRasterYSize();
int band_num = rasterDataset->GetRasterCount();
double* gt = new double[6];
std::shared_ptr<double> gt_ptr(gt);
QString projectDef = rasterDataset->GetProjectionRef();
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
bool _nGt_flag = false;
if (projectDef == "") {
_nGt_flag = true;
}
else {
_nGt_flag = false;
}
CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag);
// 计算大小
if (gdal_datatype == 0) {
return 1;
}
else if (gdal_datatype < 8) {
if (band_num != 2) { return 1; }
}
else if (gdal_datatype < 12) {
if (band_num != 1) { return 1; }
}
else {}
int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);//
block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num;
for (int i = 0; i < height; i = block_num + i) {
if (height - i < block_num) {
line_num = height - i;
}
else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先
if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num * width, 1);
Eigen::MatrixX<char> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_UInt16) {
Eigen::MatrixX<unsigned short > real_mat(line_num * width, 1);
Eigen::MatrixX<unsigned short > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Int16) {
Eigen::MatrixX<short > real_mat(line_num * width, 1);
Eigen::MatrixX<short > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_UInt32) {
Eigen::MatrixX<unsigned int > real_mat(line_num * width, 1);
Eigen::MatrixX<unsigned int > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Int32) {
Eigen::MatrixX<int > real_mat(line_num * width, 1);
Eigen::MatrixX<int > imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
//else if (gdal_datatype == GDT_UInt64) {
// Eigen::MatrixX<unsigned long> real_mat(line_num * width, 1);
// Eigen::MatrixX<unsigned long> imag_mat(line_num * width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
// data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
// _flag = true;
//}
//else if (gdal_datatype == GDT_Int64) {
// Eigen::MatrixX<long> real_mat(line_num * width, 1);
// Eigen::MatrixX<long> imag_mat(line_num * width, 1);
// rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
// rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
// data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
// data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
// _flag = true;
//}
else if (gdal_datatype == GDT_Float32) {
Eigen::MatrixX<float> real_mat(line_num * width, 1);
Eigen::MatrixX<float> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_Float64) {
Eigen::MatrixX<double> real_mat(line_num * width, 1);
Eigen::MatrixX<double> imag_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, i, width, line_num, imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag
data_mat.col(0) = (real_mat.array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (imag_mat.array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CInt16) {
Eigen::MatrixX<complex<short>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CInt32) {
Eigen::MatrixX<complex<int>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CFloat32) {
Eigen::MatrixX<complex<float>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else if (gdal_datatype == GDT_CFloat64) {
Eigen::MatrixX<complex<double>> complex_short_mat(line_num * width, 1);
rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, i, width, line_num, complex_short_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
data_mat.col(0) = (complex_short_mat.real().array().cast<double>() * calibrationValue).array();
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>() * calibrationValue).array();
_flag = true;
}
else {}
// 保存数据
if (_flag) {
// 定义赋值矩阵
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_out(line_num* width, 1);// 必须强制行优先
data_out.col(0) = Complex2dB(data_mat.col(0).array(), data_mat.col(1).array()).array();
saveDataset(out_path, i, 0, 1, width, line_num, data_out.data());
}
else {
}
}
return -1;
return 0;
}
int CalibrationComplex_DLL(const QString& out_path, const QString& in_sar_path, double calibrationValue)
{
return 0;
}
int CalibrationComplex2dB_DLL(const QString& out_path, const QString& in_sar_path, double calibrationValue)
{
return 0;
}

View File

@ -1,52 +0,0 @@
#pragma once
#ifndef SARCALIBRATION_H
#define SARCALIBRATION_H
/**
* SAR
*
*/
#include "referenceHeader.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <complex.h>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
using namespace std;
using namespace Eigen;
// 判断是否需要输出为DLL
#define DLLOUT
// 定标计算
// 输入定标系统,保证数据能够正常定标
Eigen::Matrix2cd CalibrationMatrix(Eigen::MatrixXcd in_matrix, double calibrationValue);
int CalibrationComplex(const QString& out_path, const QString& in_sar_path, double calibrationValue);
int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, double calibrationValue);
#ifndef DLLOUT
#else
#ifdef __cplusplus
extern "C" {
#endif
#define DllExport __declspec( dllexport )
int __declspec(dllexport) CalibrationComplex_DLL(const QString& out_path, const QString& in_sar_path, double calibrationValue);
int __declspec(dllexport) CalibrationComplex2dB_DLL(const QString& out_path, const QString& in_sar_path, double calibrationValue);
#ifdef __cplusplus
}
#endif
#endif
#endif // !SARCALIBRATION_H

View File

@ -1,86 +0,0 @@
// SARCalibrationTool.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "SARCalibration.h"
#include "SARBaseTool.h"
#include <iostream>
#include <string>
#include <memory>
int SiglePolarCalibration(int argc, char* argv[]) {
qDebug() << "mode : 1 "<< "\n";
QString in_tiff_path = "";
QString out_path = "";
double calibration = 0;
// params prase
for (int i = 0; i < argc; i++) {
if (string(argv[i]) == "-in")
{
in_tiff_path = argv[i + 1];
qDebug() << "in file : " << in_tiff_path << "\n";
}
else if (string(argv[i]) == "-out") {
out_path = argv[i + 1];
qDebug() << "out file : " << in_tiff_path << "\n";
}
else if (string(argv[i]) == "-calibrationConst") {
calibration = strtod(argv[i + 1], NULL);
qDebug() << "calibrationConst : " << calibration << "\n";
}
else {}
}
// excute tool
return CalibrationComplex(out_path, in_tiff_path, calibration);
}
int RasterComplex2dB(int argc, char* argv[]) {
qDebug() << "mode : 1 " << "\n";
QString in_tiff_path = "";
QString out_path = "";
// params prase
for (int i = 0; i < argc; i++) {
if (string(argv[i]) == "-in")
{
in_tiff_path = argv[i + 1];
qDebug() << "in file : " << in_tiff_path << "\n";
}
else if (string(argv[i]) == "-out") {
out_path = argv[i + 1];
qDebug() << "out file : " << in_tiff_path << "\n";
}
else {}
}
// excute tool
return Complex2dB(in_tiff_path, out_path);
}
int Test_SARCalibrationTool(int argc, char* argv[])
{
qDebug() << "calibration tool " << "\n";
qDebug() << "sigle polsar Amg: SARCalibrationTool.exe 1 -in filepath -out filepath -calibrationConst 43" << "\n";
qDebug() << "complex 2 dB : SARCalibrationTool.exe 1 -in filepath -out filepath" << "\n";
if (argc == 1) {
qDebug() << "the number of params should be than 2" << "\n";
return 2;
}
try {
int mode = atoi(argv[1]);
if (mode == 1) {
return SiglePolarCalibration(argc, argv);
}
else if (mode == 2) {
return RasterComplex2dB(argc, argv);
}
else {}
}
catch (std::exception ex) {
std::wcerr << ex.what() << "\n";
}
qDebug() << "Hello World!\n";
return 0;
}

View File

@ -1,334 +0,0 @@
#include "BaseToollib/ImageOperatorBase.h"
#include "SARBaseTool.h"
#include "SARImageBase.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <proj.h>
#include <string.h>
#include <memory.h>
#include <memory>
#include <fftw3.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_spline.h>
#include "referenceHeader.h"
#include "OCCTBase.h"
#include "BaseToollib/GeoOperator.h"
#include "SARBaseToolLib/SARImageBase.h"
double getRangeResolution(double startfreq, double endfreq)
{
return LIGHTSPEED / 2 / std::abs(endfreq - startfreq);
}
double getAzimuthResolution(double AzAngleRange, double startFreq)
{
return LIGHTSPEED / 2 / (AzAngleRange * startFreq);
}
Eigen::MatrixXd hammingWindows(size_t num)
{
double alpha = 25. / 46;
double beta = 1 - alpha;
double scale = 1;
size_t m = num;
Eigen::MatrixXd x = Eigen::MatrixXd::Zero(m, 1);
for (int i = 0; i < m; i++) {
x(i, 0) = alpha - beta * std::cos(2 * PI * i / (num - 1));
}
x = x.array() * scale;
return x;
}
Eigen::MatrixXd Hanning(size_t Nf, size_t Nxa, double alpha)
{
// n1 = double ? DOUBLE(n1In[0]) : FLOAT(n1In[0])
double a = 2 * PI / Nf; // a = 2 * pi / N1 ;scale factor
double n2 = Nxa; // n2 = double ? DOUBLE(n2In[0]) : FLOAT(n2In[0])
double b = 2 * pi / n2; // dim 2 scale fact
double one = 1.0; // double ? 1d : 1.0
double temp_row = 0;
double temp_col = 0;
Eigen::MatrixXd result_arr = Eigen::MatrixXd::Zero(Nxa, Nf); // 结果
for (int i = 0; i < Nxa; i++) {
for (int j = 0; j < Nf; j++) {
// index = double ? DINDGEN(n1) : FINDGEN(n1) ; Nf
temp_row = (alpha - one) * cos(j * a) + alpha; // (alpha-one) * cos(index*a) + alpha ;One row
// index = double ? DINDGEN(n2) : FINDGEN(n2) ; Nxa
temp_col = (alpha - one) * cos(i * b) + alpha; // col = (alpha-one) * cos(index*b) + alpha ;One column
result_arr(i, j) = temp_row * temp_col;// RETURN,(row # col) ;DINDGEN(n1)#DINDGEN(n2)
}
}
return result_arr;
}
Eigen::MatrixXcd HammingWindows(Eigen::MatrixXcd FreqEcho)
{
size_t data_cols = FreqEcho.cols();
size_t data_rows = FreqEcho.rows();
// 进行进行hanmming windows
Eigen::MatrixXd hamming_Az = hammingWindows(data_cols);
Eigen::MatrixXd hamming_Rz = hammingWindows(data_rows);
for (int i = 0; i < data_cols; i++) {
for (int j = 0; j < data_rows; j++) {
FreqEcho(j, i) = FreqEcho(j, i) * hamming_Az(i, 0) * hamming_Rz(j, 0);
}
}
return FreqEcho;
}
Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd SourceFreqlist, Eigen::VectorXd interpFreqlist)
{
assert(freqEcho.cols() == SourceFreqlist.rows());
size_t data_rows = freqEcho.rows();
size_t data_cols = freqEcho.cols();
size_t out_cols = interpFreqlist.rows();
Eigen::MatrixXcd resultECHO = Eigen::MatrixXcd::Zero(data_rows, out_cols);
#pragma omp parallel for // NEW ADD
for (int i = 0; i < data_rows; i++) { // 单脉冲
double* xs = new double[data_rows];
for (int i = 0; i < data_cols; i++) {
xs[i] = SourceFreqlist(i); // 原始回波
}
double* real_ys = new double[data_cols];
double* imag_ys = new double[data_cols];
gsl_interp_accel* acc = gsl_interp_accel_alloc();
const gsl_interp_type* t = gsl_interp_cspline_periodic;
gsl_spline* spline_real = gsl_spline_alloc(t, data_rows);
gsl_spline* spline_imag = gsl_spline_alloc(t, data_rows);
for (int jj = 0; jj < data_cols; jj++) {
real_ys[jj] = freqEcho(jj, i).real();
imag_ys[jj] = freqEcho(jj, i).imag();
}
gsl_spline_init(spline_real, xs, real_ys, data_rows);
gsl_spline_init(spline_imag, xs, imag_ys, data_rows);
for (int j = 0; j < out_cols; j++) { // 受限于当前函数只能逐点插值,或者后期可修改为 gsl 直接插值
double cx = interpFreqlist(j,0);
std::complex<double> result(
gsl_spline_eval(spline_real, cx, acc),// 插值实部
gsl_spline_eval(spline_imag, cx, acc)// 插值虚部
);
resultECHO(i, j) = result;
}
gsl_spline_free(spline_real);
gsl_spline_free(spline_imag);
gsl_interp_accel_free(acc);
delete[] xs;
delete[] real_ys, imag_ys;
}
return resultECHO;
}
int WriteComplexData2Amp_Arg(QString out_tiff_path, Eigen::MatrixXcd data)
{
Eigen::MatrixXd amp_data = Eigen::MatrixXd::Zero(data.rows(), data.cols());
Eigen::MatrixXd arg_data = Eigen::MatrixXd::Zero(data.rows(), data.cols());
size_t row_count = data.rows();
size_t col_count = data.cols();
for (int i = 0; i < row_count; i++) {
for (int j = 0; j < col_count; j++) {
amp_data(i, j) = std::abs(data(i, j));
arg_data(i, j) = std::arg(data(i, j));
}
}
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果
image_tiff.saveImage(amp_data, 0, 0, 1);
image_tiff.saveImage(arg_data, 0, 0, 2);
return 0;
}
int WriteComplexData2AmpdB_Arg(QString out_tiff_path, Eigen::MatrixXcd data)
{
Eigen::MatrixXd amp_data = Eigen::MatrixXd::Zero(data.rows(), data.cols());
Eigen::MatrixXd arg_data = Eigen::MatrixXd::Zero(data.rows(), data.cols());
size_t row_count = data.rows();
size_t col_count = data.cols();
for (int i = 0; i < row_count; i++) {
for (int j = 0; j < col_count; j++) {
amp_data(i, j) = 10.0*std::log10(std::abs(data(i, j)));
arg_data(i, j) = std::arg(data(i, j));
}
}
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果
image_tiff.saveImage(amp_data, 0, 0, 1);
image_tiff.saveImage(arg_data, 0, 0, 2);
return 0;
}
size_t nextpow2(size_t num)
{
double n = std::round(std::log10(num * 1.0) / std::log10(2.0));
return pow(2, (size_t)std::ceil(n) + 1);
}
Eigen::MatrixXcd IFFTW1D(Eigen::MatrixXcd ECHOdata)
{
size_t data_rows = ECHOdata.rows();
size_t data_cols = ECHOdata.cols();
// 频域 转换到 时域
size_t n2 = nextpow2(data_cols) ;
//qDebug() << data_rows << "," << data_cols << "," << n2 << "\n";
// 补零
Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2);
for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < data_cols; j++) {
ExpandECHO(i, j) = ECHOdata(i, j);
}
}
// 结果
Eigen::MatrixXcd echoTime = Eigen::MatrixXcd::Zero(data_rows, n2);
fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_plan p;
double n = 1.0 / n2; // 因为 fftw 的逆傅里叶变换没有除于N,所以实际上是原来的N倍
//逐行进行fftw
p = fftw_plan_dft_1d(n2, din, dout, FFTW_BACKWARD, FFTW_MEASURE);//FFTW_BACKWARD 逆,
fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案
// 傅里叶 计算进度
for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < n2; j++) { // 初始化输入
din[j][0] = std::real(ExpandECHO(i, j));
din[j][1] = std::imag(ExpandECHO(i, j));
}
// 构建fftw 任务
fftw_execute(p);
// 保存结果
for (int j = 0; j < n2; j++) { //读取结果
echoTime(i, j) = std::complex<double>(dout[j][0], dout[j][1]) * n; // 每次变换后都除于n
}
printf("\rIFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1));
}
fftw_destroy_plan(p);
fftw_free(din);
fftw_free(dout);
qDebug() << "\n";
qDebug() << "IFFT over" << "\n";
return echoTime;
}
Eigen::MatrixXcd FFTW1D(Eigen::MatrixXcd ECHO)
{
size_t data_rows = ECHO.rows();
size_t data_cols = ECHO.cols();
// 频域 转换到 时域
size_t n2 = data_cols;
// 补零
Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2);
for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < data_cols; j++) {
ExpandECHO(i, j) = ECHO(i, j);
}
}
// 结果
Eigen::MatrixXcd echofreq = Eigen::MatrixXcd::Zero(data_rows, n2);
fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_plan p;
//逐行进行fftw
p = fftw_plan_dft_1d(n2, din, dout, FFTW_FORWARD, FFTW_MEASURE);//FFTW_FORWARD 顺,
fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案
for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < n2; j++) { // 初始化输入
din[j][0] = std::real(ExpandECHO(i, j));
din[j][1] = std::imag(ExpandECHO(i, j));
}
// 构建fftw 任务
fftw_execute(p);
// 保存结果
for (int j = 0; j < n2; j++) { //读取结果
echofreq(i, j) = std::complex<double>(dout[j][0], dout[j][1]);
}
printf("\rFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1));
}
fftw_destroy_plan(p);
fftw_free(din);
fftw_free(dout);
qDebug() << "\n";
qDebug() << "FFT over" << "\n";
return echofreq;
}
Eigen::MatrixXcd FFTW2D(Eigen::MatrixXcd ECHO)
{
// 获取数据的尺寸
int rows = ECHO.rows();
int cols = ECHO.cols();
// 创建FFTW输入和输出数组
fftw_complex* in = reinterpret_cast<fftw_complex*>(ECHO.data());
fftw_complex* out = static_cast<fftw_complex*>(fftw_malloc(sizeof(fftw_complex) * rows * cols));
// 创建FFTW计划执行傅立叶变换
fftw_plan plan = fftw_plan_dft_2d(rows, cols, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(plan);
// 打印傅立叶变换结果
Eigen::MatrixXcd result(rows, cols);
result = Map<Eigen::MatrixXcd>(reinterpret_cast<std::complex<double>*>(out), rows, cols);
//qDebug() << "Fourier Transform Result: " << "\n" << result << "\n";
// 销毁FFTW计划和内存
fftw_destroy_plan(plan);
fftw_free(out);
qDebug() << "\n";
qDebug() << "FFT over" << "\n";
return result;
}
Eigen::MatrixXcd fftshift(Eigen::MatrixXcd X) {
int rows = X.rows();
int cols = X.cols();
int rows_half = rows / 2;
int cols_half = cols / 2;
Eigen::MatrixXcd tmp = X.topLeftCorner(rows_half, cols_half);
X.topLeftCorner(rows_half, cols_half) = X.bottomRightCorner(rows_half, cols_half);
X.bottomRightCorner(rows_half, cols_half) = tmp;
tmp = X.topRightCorner(rows_half, cols_half);
X.topRightCorner(rows_half, cols_half) = X.bottomLeftCorner(rows_half, cols_half);
X.bottomLeftCorner(rows_half, cols_half) = tmp;
return X;
}

View File

@ -1,95 +0,0 @@
#pragma once
#ifndef SARIMAGEBASE_H
#define SARIMAGEBASE_H
/**
*
****/
#include "referenceHeader.h"
#include "SARBaseTool.h"
// ------------------------------------------- 成像 公用库----------------------------------------------------------
// SAR 常用计算的方法
double getRangeResolution(double startfreq, double endfreq);
/// <summary>
/// 方位向分辨率计算
/// </summary>
/// <param name="AzAngleRange">弧度制,方位角变化范围(>=0</param>
/// <param name="startFreq">起始频率</param>
/// <returns></returns>
double getAzimuthResolution(double AzAngleRange, double startFreq);
// 根据输入数量构建汉明窗
Eigen::MatrixXd hammingWindows(size_t num);
// 频率域汉明窗口
/// <summary>
/// 频率域汉明窗口
/// </summary>
/// <param name="Nf">频率点数</param>
/// <param name="Nxa">脉冲数量</param>
/// <param name="alpha">权重</param>
/// <returns>汉明窗权重</returns>
Eigen::MatrixXd Hanning(size_t Nf, size_t Nxa, double alpha = 0.54);
/// <summary>
/// 获取2的平方数,大于2
/// </summary>
/// <param name="num"></param>
/// <returns></returns>
size_t nextpow2(size_t num);
/// <summary>
/// 对回波沿着行进行一维傅里叶逆变换
/// </summary>
/// <param name="ECHO"></param>
/// <returns></returns>
Eigen::MatrixXcd IFFTW1D(Eigen::MatrixXcd ECHO);
/// <summary>
/// 对回波沿着行进行一维傅里叶变换
/// </summary>
/// <param name="echo"></param>
/// <returns></returns>
Eigen::MatrixXcd FFTW1D(Eigen::MatrixXcd echo);
Eigen::MatrixXcd FFTW2D(Eigen::MatrixXcd ECHO);
Eigen::MatrixXcd fftshift(Eigen::MatrixXcd X);
/// <summary>
/// 对回波 加 hamming 窗
/// </summary>
/// <param name="FreqEcho">频域的回波数据PRFnum,Freqnum)</param>
/// <returns></returns>
Eigen::MatrixXcd HammingWindows(Eigen::MatrixXcd FreqEcho);
/// <summary>
/// 对回波进行一维插值(并行),不能用来处理极坐标
/// 插值方式为 实部虚部分别进行线性插值
/// </summary>
/// <param name="freqEcho">回波数据,(行数,列数):PRFNUM,freqNUM</param>
/// <param name="SourceFreqlist">回波的 原始频率列表</param>
/// <param name="interpFreqlist">回波的 插值频率列表</param>
/// <returns></returns>
Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd SourceFreqlist, Eigen::VectorXd interpFreqlist);
/// <summary>
/// 保存复数矩阵数据 为tiff 其中band 1: amp (linear) angle(radia)
/// </summary>
/// <param name="out_tiff_path"></param>
/// <param name="data"></param>
/// <returns></returns>
int WriteComplexData2Amp_Arg(QString out_tiff_path, Eigen::MatrixXcd data);
/// <summary>
/// 保存复数矩阵数据 为tiff 其中band 1: amp (dB) angle(radia)
/// </summary>
/// <param name="out_tiff_path"></param>
/// <param name="data"></param>
/// <returns></returns>
int WriteComplexData2AmpdB_Arg(QString out_tiff_path, Eigen::MatrixXcd data);
// ----------------------------------------------------------------------------------------------------------
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,338 +0,0 @@
#pragma once
#include <complex>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <gdal.h>
#include <gdal_utils.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <proj.h>
#include <string.h>
#include <memory.h>
#include <memory>
#include <vector>
#include "referenceHeader.h"
#include "BaseToollib/GeoOperator.h"
/**
* FEKO
* 1.
* 2. PRFPRF
* 3. PRF 90,
* 4.
***/
namespace FEKOBase {
//==========================================================
// FEKO常用坐标系
//==========================================================
enum FEKOCoordinateSystem {
Spherical, // 球坐标系
Cartesian, // 笛卡尔坐标系
UNKONWFEKOCOORDINATESYSTEM // 必须为最后一个表示未知
};
FEKOBase::FEKOCoordinateSystem FEKOCoordinateSystemString2Enum(QString str);
QString QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode);
//==========================================================
// FEKO成像模式枚举
//==========================================================
enum FEKOImageMode
{
Strip,
Scane,
ISAR,
CircleSAR,
UNKNOW
};
FEKOImageMode FEKOImageModeString2Enum(QString str);
QString FEKOImageModeenumToString(FEKOImageMode mode);
//==========================================================
// FEKO成像仿真参数类主要用来搭建统一的仿真成像模块
//==========================================================
//==========================================================
// 频率参数
//==========================================================
struct freqParams { // 频率参数
double startfreqs;
double endfreqs;
size_t freqpoint;
};
//==========================================================
// 输入的卫星参数
//==========================================================
struct SatellitePosition { // 卫星姿态
double Px = 0, Py = 0, Pz = 0;
};
struct SatelliteVelocity { // 卫星速度
double Vx = 0, Vy = 0, Vz = 0;
};
struct SatelliteState { // 卫星矢量
SatellitePosition pos;
SatelliteVelocity vel;
};
//==========================================================
// FEKO 远场等效源姿态参数
//==========================================================
struct FEKOantPitionDirect {
double x = 0;
double y = 0;
double z = 0;
double theta = 0;
double phi = 0;
};
//===========================================================
// FEKO成像设置参数
//===========================================================
struct FEKOImageSettingParams {
double min_x = 0;
double max_x = 0;
double min_y = 0;
double max_y = 0;
double plane_z = 0; // 平面高程
size_t ImageWidth = 0;
size_t ImageHeight = 0;
};
//==========================================================
// FEKO参数文件等效参数
//==========================================================
struct FEKOSatelliteParams { // FEKOPRF脉冲参数
size_t PRFidx = 0; // PRF 脉冲计数
SatelliteState pose;// 卫星矢量
double incidenceAngle = 0; // 入射角
double AzAngle = 0; // 姿态角
FEKOantPitionDirect antpos;// 天线实际姿态
bool isRight = false; // 判断左右视false 左right 右
};
/////////////////////////////////////////////////
///// 函数类
//////////////////////////////////////////////
/// <summary>
/// 频率Setting
/// </summary>
/// <param name="centerFreq">中心频率 GHZ</param>
/// <param name="resolution">分辨率 米</param>
/// <param name="bandWidth">带宽 GHz</param>
/// <param name="scenceRange">分辨率 米</param>
/// <param name="isResolution"></param>
/// <returns></returns>
freqParams getFreqSetting(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false);
FEKOSatelliteParams createFEKOSatelliteParams(double Px, double Py, double Pz, double Vx, double Vy, double Vz, double incidenceAngle, double AzAngle, double theta, double phi, bool isRight, size_t PRFIdx = 0);
FEKOSatelliteParams createFEKOSatelliteParams(SatelliteState pose, double incidenceAngle, double AzAngle, FEKOantPitionDirect antpos, size_t PRFIdx = 0);
SatelliteState FEKOSatelliteParams2SatelliteState(FEKOSatelliteParams parmas);
FEKOantPitionDirect FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas);
/// <summary>
/// 将卫星姿态转换为 FEKO 天线坐标,
/// 注意默认模型的Z轴为天线的指向
/// </summary>
/// <param name="satepos">卫星矢量</param>
/// <param name="incidenceAngle">入射角</param>
/// <param name="AzAngle">侧视角</param>
/// <param name="isRIGHT">是否为右视</param>
/// <param name="antposition_Direct">结果文件</param>
/// <param name="inDs">输入模型</param>
/// <returns></returns>
TopoDS_Shape SatellitePos2FEKOAntPos(SatelliteState satepos, double incidenceAngle, double AzAngle, bool isRIGHT, FEKOantPitionDirect* antposition_Direct, TopoDS_Shape inDs);
//===============================================
// FEKO结果解析文件
//===============================================
struct ElectricFieldData {
QString fileType;
QString fileFormat;
QString source;
QString date;
double radius;
double theta;
double phi;
double reEr;
double imEr;
double reEtheta;
double imEtheta;
double reEphi;
double imEphi;
QString configurationName;
QString requestName;
double frequency;
QString coordinateSystem;
Point_3d origin;
int numRadiusSamples;
int numThetaSamples;
int numPhiSamples;
QString resultType;
int numHeaderLines;
size_t prfidx = -1; // 脉冲计数,>0
};
struct PRFPluseData { // 单个PRF脉冲数据格式
size_t prfidx; //脉冲次数
double freqstart;
double freqend;
size_t freqpoints;
double px, py, pz;
//double theta, phi;
//double incidence, azangle;
//std::vector<double> freqlist;
std::vector<ElectricFieldData> electricFieldDataList; // 单频点信息
};
bool compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b);
bool comparePRFPluseDataInPRFIdx(const PRFPluseData& a, const PRFPluseData& b);
class NearFieldEchoCSVParser {
public:
NearFieldEchoCSVParser();
~NearFieldEchoCSVParser();
private:
bool usePRFCountMode = true;
//std::vector<ElectricFieldData> electricFieldDataList;
QMap<QString, std::vector<ElectricFieldData>> electricFieldDataList; // 电场数据
//QMap<QString, PRFPluseData> prfPluseMap;
std::vector<PRFPluseData> prfData;
size_t freqPoints;
double freqStart;
double freqEnd;
// 频率参数
private: // 内部检查函数
bool checkPRFModel();
bool resizePRFPluse(); //回波整理
public:
bool parseCSV(const QString& filePath); // 读取回波数据文件
void toThetapolar(const QString& filePath);// 输出theta 极化
void toPhiPolar(const QString& filePath);// 输出phi 极化
void toRPolar(const QString& filePath);// 输出phi 极化
void saveCSV(const QString& filePath);// 输出csv文件
private:
void toEchoData(const QString& filePath, size_t outDataName);// 输出回波数据
};
//========================================================================
// 成像回波格式
// file type:
// freqStart,freqEnd,freqPoint,isRight,
// PRF1,Pos,incidenceAngle,AzAngle,echoDatalist
// PRF2,Pos,incidenceAngle,AzAngle,echoDatalist
// 。
// 。
// 。
// 注意Bp并不关心脉冲的顺序只是关注脉冲的坐标位置默认按照脉冲的解析顺序进行组织
//========================================================================
class EchoDataClass {
private: // 成像变量
Eigen::MatrixXcd echoData; // 回波数据
Eigen::MatrixXd antPos;// 每个脉冲的坐标
double freqStart; // 起始频率
double freqEnd; // 终止频率
int freqpoints; // 频率点数
public:
EchoDataClass(const FEKOBase::EchoDataClass& inecho);
EchoDataClass();
~EchoDataClass();
public:
// 根据每个成员变量构建属性
void setEchoData(Eigen::MatrixXcd echoData);
Eigen::MatrixXcd getEchoData() const;
void setAntPos(Eigen::MatrixXd antPos);
Eigen::MatrixXd getAntPos() const;
void setFreqStart(double freqStart);
double getFreqStart() const;
void setFreqEnd(double freqEnd);
double getFreqEnd() const;
void setFreqpoints(int freqpoints);
int getFreqpoints() const;
void loadEchoData(const QString& filePath); // 加载回波数据文件
void SaveEchoData(const QString& filePath); // 保存回波数据文件
};
//==========================================================
// 仿真成像算法类
// BP成像算法
// 建议将所有的频率处理到 GHz 单位,避免频率过大导致的精度问题
// 回波矩阵:
// PRF1:f1,f2,f3,f4
// PRF2f1,f2,f3,f4
// PRF2f1,f2,f3,f4
//==========================================================
enum ImageAlgWindowFun // 成像方法加窗方法
{
NOWINDOWS,
HANMMING,
UNKONWWINDOW
};
/// <summary>
/// 加窗
/// </summary>
/// <param name="echo">行:脉冲,列:频点</param>
/// <returns></returns>
Eigen::MatrixXd WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
enum FEKOImageAlgorithm
{
TBP_TIME,
TBP_FREQ,
UNKONW // 必须为最后一个表示未知
};
QList<QString> getFEKOImageAlgorithmList();
FEKOImageAlgorithm String2FEKOImageAlgorithm(QString str);
QString FEKOImageAlgorithm2String(FEKOImageAlgorithm alg);
// 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数
QList<QString> getImageAlgWindowFunList();
ImageAlgWindowFun String2ImageAlgWindowFun(QString str);
QString ImageAlgWindowFun2String(ImageAlgWindowFun alg);
bool BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // BP成像
bool FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // FBP成像
}

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +0,0 @@
#pragma once
/**
* FEKO BP
*
**/
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <memory>
#include <vector>
#include "referenceHeader.h"
// FEKO 几何关系处理
/// <summary>
/// 笛卡尔坐标系,转换为 极坐标系
/// </summary>
/// <param name="CartesianPoint">[X,Y,Z;X1,Y1,Z1]</param>
/// <returns></returns>
Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint);
/// <summary>
/// 时域BP
/// </summary>
class BP2DProcessClass {
public:
size_t height;
size_t width;
Eigen::MatrixXcd echo;
Eigen::MatrixXd AntPosition;
Eigen::VectorXd Frequencylist;
size_t freqnum;
double f1;
double fc;
double Rref; // 成像中心的参考距离
double minX;
double maxX;
double minY;
double maxY;
double centerX;
double centerY;
double Zplane;
size_t ImageHeight;
size_t ImageWidth;
QString out_path;
public:
virtual int initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
virtual int readEchoFile(QString in_path);
virtual int saveTiFF(Eigen::MatrixXcd m);
virtual int start();
virtual int logFUN(int percent, QString logtext);
};
int BP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ,int ImageHeight,int ImageWidth);
// BP 成像时逐像素点计算计算速度慢回波PRFNUM,freqNUM)
template<typename T>
Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho,Eigen::MatrixXd AntPosition,double minX,double maxX,double minY,double maxY,double PlaneZ ,double Rref,size_t ImageWidth,size_t ImageHeight,double startfreq,size_t timefreqnum,double timeFreqBandWidth, T* logclss=nullptr);
/// <summary>
/// 时域BP --- FBP
/// </summary>
class FBP2DProcessClass:public BP2DProcessClass {
public:
size_t height;
size_t width;
Eigen::MatrixXcd echo;
Eigen::MatrixXd AntPosition;
Eigen::VectorXd Frequencylist;
size_t freqnum;
double f1;
double fc;
double Rref; // 成像中心的参考距离
double minX;
double maxX;
double minY;
double maxY;
double centerX;
double centerY;
double Zplane;
size_t ImageHeight;
size_t ImageWidth;
QString out_path;
public:
virtual int initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
virtual int readEchoFile(QString in_path);
virtual int saveTiFF(Eigen::MatrixXcd m);
virtual int start();
virtual int logFUN(int percent, QString logtext);
};
// BP 成像时逐脉冲计算回波PRFNUM,freqNUM)
template<typename T>
Eigen::MatrixXcd BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss = nullptr);
int FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
// 生成成像的数据文件
int build2Bin(QString path,int width,int height,std::vector<double> &freqs,Eigen::MatrixXd AntPositions,Eigen::MatrixXcd echo);
// 定义插值函数,以处理复数值
std::complex<double> InterpolateComplex(Eigen::MatrixXd& xi, Eigen::MatrixXd& yi, Eigen::MatrixXcd& data, double x, double y);
/// <summary>
/// 远场成像
/// </summary>
class FEKOFarFieldProcessClass :public BP2DProcessClass {
public:
size_t height;
size_t width;
Eigen::MatrixXcd echo;
Eigen::MatrixXd AntPosition; // theta phi 0
Eigen::VectorXd Frequencylist;
size_t freqnum;
double f1;
double fc;
double Rref; // 成像中心的参考距离
double minX;
double maxX;
double minY;
double maxY;
double centerX;
double centerY;
double Zplane;
size_t ImageHeight;
size_t ImageWidth;
QString out_path;
public:
virtual int initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
virtual int readEchoFile(QString in_path);
virtual int saveTiFF(Eigen::MatrixXcd m);
virtual int start();
virtual int logFUN(int percent, QString logtext);
// 平均频率间隔
double get_df() { return (this->Frequencylist(this->get_Nf() - 1) - this->Frequencylist(0)) / (this->get_Nf() - 1); };
// 脉冲数
size_t get_Nxa() { return this->AntPosition.rows(); };
// 频率点数
size_t get_Nf() { return this->Frequencylist.rows(); };
double get_minFreq() { this->Frequencylist(this->get_Nf() - 1) > this->Frequencylist(0) ? this->Frequencylist(0) : this->Frequencylist(this->get_Nf() - 1); };
};

View File

@ -1,100 +0,0 @@
// FEKONearBpBaseImage.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "FEKONearBPBasic.h"
#include <string>
#include <iostream>
#include "LampToolTest.h"
int TestImageBP_main(int argc, char* argv[])
{
qDebug() << "process starting .......\n";
qDebug() << "-i in_echo.bin -o out_resule.bin -Rref 10 -minX -1 -maxX 1 -minY -1 -maxY 1 -PlaneZ 0 -ImageHeight 201 -ImageWidth 201" << "\n";
qDebug() << "BP mehtod for FEKO Near field (Cartesian) " << "\n";
qDebug() << "format: " << "\n";
qDebug() << "height[int32] width[int32] frequencylist[width*double] echoData " << "\n";
qDebug() << "echoData format: ant[x,y,z 3xdouble] real[width*double] imag[width*double]" << "\n";
qDebug() << "echodata [freqNUM,PRF_num]" << "\n";
qDebug() << "warnning:Eigen default matrix is row-major storage" << "\n";
qDebug() << "===============params list==============================" << "\n";
QString in_path = "";
QString out_path = "";
int mode = 1;
double Rref=0, minX=0, maxX = 0, minY = 0, maxY = 0, PlaneZ = 0, ImageHeight = 0, ImageWidth = 0;
for (int i = 0; i < argc; i++) {
qDebug() << argv[i] << "\n";
}
for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "-i")==0) {
if (i == argc - 1) { return 1; }
in_path = argv[i + 1];
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-o") == 0) {
if (i == argc - 1) { return 1; }
out_path = argv[i + 1];
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-Rref") == 0) {
if (i == argc - 1) { return 1; }
Rref =std::stod(argv[i+1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-minX") == 0) {
if (i == argc - 1) { return 1; }
minX = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-maxX") == 0) {
if (i == argc - 1) { return 1; }
maxX = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-minY") == 0) {
if (i == argc - 1) { return 1; }
minY = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-maxY") == 0) {
if (i == argc - 1) { return 1; }
maxY = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-PlaneZ") == 0) {
if (i == argc - 1) { return 1; }
PlaneZ = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-ImageHeight") == 0) {
if (i == argc - 1) { return 1; }
ImageHeight = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-ImageWidth")==0) {
if (i == argc - 1) { return 1; }
ImageWidth = std::stod(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
else if (strcmp(argv[i], "-mode") == 0) {
if (i == argc - 1) { return 1; }
mode = std::stoi(argv[i + 1]);
qDebug() << argv[i] << " = " << argv[i + 1] << "\n";
}
}
qDebug() << "======================================================" << "\n";
//qDebug() << Eigen::MatrixXd::LinSpaced(1, 10).array() << "\n";
if (mode == 0) {
//BP2DProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
}
else if (mode == 1) {
//FBP2DProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
}
else if (mode == 2) {
}
return 0;
}

View File

@ -67,7 +67,7 @@ int main(int argc, char* argv[])
#ifdef __TEST_FARFIELDFILEREADPROCESS
#include "LAMPTool.h"
#include "SARImage/FEKOBaseToolClass.h"
#include "FEKOBaseToolClass.h"
#include "FEKOFarFieldFileClass.h"
#include "FEKOSimulationSARClass.h"
int main() {

View File

@ -1,8 +1,2 @@
# BaseToollib
基础操作库
# SARBaseToolLib
SAR处理操作库
# 说明
此模块主要是通用基础模块

View File

@ -9,27 +9,28 @@
#ifndef REFERENCEHEADER_H
#define REFERENCEHEADER_H
#include "LAMPToolAPI.h"
#include <QFileDialog>
#include <QFile>
#include <QXmlStreamReader>
#include <QString>
#include <QDebug>
#include <QDialog>
#include <opencascade\BRepBuilderAPI_Copy.hxx>
#include <opencascade\AIS_Shape.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <AIS_Shape.hxx>
#include <QObject>
#include <opencascade\TopoDS.hxx>
#include <opencascade\TopoDS_Shape.hxx>
#include <opencascade\Standard_WarningsDisable.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QListWidget>
#include <QList>
#include <opencascade\Standard_WarningsRestore.hxx>
#include <opencascade\AIS_TextLabel.hxx>
#include <opencascade\AIS_InteractiveContext.hxx>
#include <opencascade\Graphic3d_Texture2Dplane.hxx>
#include <opencascade\Graphic3d_Text.hxx>
#include <opencascade\V3d_View.hxx>
#include <opencascade\V3d_Viewer.hxx>
#include <Standard_WarningsRestore.hxx>
#include <AIS_TextLabel.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Graphic3d_Texture2Dplane.hxx>
#include <Graphic3d_Text.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <vector>
#include <string>
#include <QMap>
@ -37,75 +38,75 @@
#include <QCheckBox>
#include <QMouseEvent>
#include <QDialog>
#include <opencascade\BRepGProp.hxx>
#include <opencascade\GProp_GProps.hxx>
#include <opencascade\AIS_ViewCube.hxx>
#include <opencascade\Geom_Axis2Placement.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <AIS_ViewCube.hxx>
#include <Geom_Axis2Placement.hxx>
#include <QApplication>
#include <QColor>
#include <QColorDialog>
#include <QStatusBar>
#include <opencascade\StepGeom_Axis2Placement3d.hxx>
#include <opencascade\AIS_InteractiveObject.hxx>
#include <opencascade\Aspect_DisplayConnection.hxx>
#include <opencascade\Graphic3d_NameOfMaterial.hxx>
#include <opencascade\OpenGl_GraphicDriver.hxx>
#include <opencascade\OSD_Environment.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OSD_Environment.hxx>
#include <QFileDialog>
#include <opencascade\TCollection_AsciiString.hxx>
#include <opencascade\StlAPI_Reader.hxx>
#include <opencascade\AIS_Trihedron.hxx>
#include <TCollection_AsciiString.hxx>
#include <StlAPI_Reader.hxx>
#include <AIS_Trihedron.hxx>
#include <QtWidgets>
#include <opencascade\BRepPrimAPI_MakePrism.hxx>
#include <opencascade\IGESControl_Reader.hxx>
#include <opencascade\STEPControl_Reader.hxx>
#include <opencascade\IGESControl_Writer.hxx>
#include <opencascade\STEPControl_Writer.hxx>
#include <opencascade\StlAPI_Writer.hxx>
#include <opencascade\BRep_Builder.hxx>
#include <opencascade\BRepBuilderAPI_Collect.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <IGESControl_Reader.hxx>
#include <STEPControl_Reader.hxx>
#include <IGESControl_Writer.hxx>
#include <STEPControl_Writer.hxx>
#include <StlAPI_Writer.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_Collect.hxx>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <opencascade\TopExp_Explorer.hxx>
#include <opencascade\gp_Pnt.hxx>
#include <opencascade\gp_Ax1.hxx>
#include <opencascade\gp_Dir.hxx>
#include <opencascade\BRepAlgoAPI_Fuse.hxx>
#include <opencascade\AIS_TexturedShape.hxx>
#include <opencascade\Prs3d_Arrow.hxx>
#include <opencascade\BRepPrimAPI_MakeCylinder.hxx>
#include <opencascade\BRepPrimAPI_MakeCone.hxx>
#include <opencascade\BRepBuilderAPI_Transform.hxx>
#include <TopExp_Explorer.hxx>
#include <gp_Pnt.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <AIS_TexturedShape.hxx>
#include <Prs3d_Arrow.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <QMessageBOx>
#include <opencascade\StlAPI_Writer.hxx>
#include <opencascade\AIS_ViewCube.hxx>
#include <opencascade\AIS_Shape.hxx>
#include <opencascade\Geom_Axis2Placement.hxx>
#include <opencascade\Standard_WarningsDisable.hxx>
#include <StlAPI_Writer.hxx>
#include <AIS_ViewCube.hxx>
#include <AIS_Shape.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QColor>
#include <QColorDialog>
#include <QStatusBar>
#include <opencascade\Standard_WarningsRestore.hxx>
#include <opencascade\StepGeom_Axis2Placement3d.hxx>
#include <Standard_WarningsRestore.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <QDebug>
#include <opencascade\AIS_InteractiveObject.hxx>
#include <opencascade\Aspect_DisplayConnection.hxx>
#include <opencascade\Graphic3d_NameOfMaterial.hxx>
#include <opencascade\OpenGl_GraphicDriver.hxx>
#include <opencascade\OSD_Environment.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OSD_Environment.hxx>
#include <QFileDialog>
#include <opencascade\TCollection_AsciiString.hxx>
#include <opencascade\StlAPI_Reader.hxx>
#include <opencascade\AIS_Trihedron.hxx>
#include <TCollection_AsciiString.hxx>
#include <StlAPI_Reader.hxx>
#include <AIS_Trihedron.hxx>
#include <QCheckBox>
#include <QtWidgets>
#include <opencascade\BRepPrimAPI_MakePrism.hxx>
#include <opencascade\BRepBuilderAPI_Copy.hxx>
#include <opencascade\IGESControl_Reader.hxx>
#include <opencascade\STEPControl_Reader.hxx>
#include <opencascade\IGESControl_Writer.hxx>
#include <opencascade\STEPControl_Writer.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <IGESControl_Reader.hxx>
#include <STEPControl_Reader.hxx>
#include <IGESControl_Writer.hxx>
#include <STEPControl_Writer.hxx>
#include <QMessageBox>
#include <QCoreApplication>
#include <Eigen/Core>
@ -113,15 +114,15 @@
#include <iostream>
#include <Eigen/Dense>
#include <fftw3.h>
#include <opencascade\BRepBuilderAPI_MakeEdge.hxx>
#include <opencascade\BRepBuilderAPI_MakeWire.hxx>
#include <opencascade\BRepBuilderAPI_MakeFace.hxx>
#include <opencascade\BRepPrimAPI_MakeWedge.hxx>
#include <opencascade\gp_Pnt.hxx>
#include <opencascade\BRepBuilderAPI_MakeEdge.hxx>
#include <opencascade\BRepBuilderAPI_MakeWire.hxx>
#include <opencascade\BRepBuilderAPI_MakeFace.hxx>
#include <opencascade\TopoDS_Face.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepPrimAPI_MakeWedge.hxx>
#include <gp_Pnt.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopoDS_Face.hxx>
#include <QRegularExpression>
#include <omp.h> // 并行计算库
#include <cmath>
@ -130,7 +131,7 @@
//================================================
// 常用函数
//================================================
std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList);
std::vector<QString> LAMPTOOLAPI convertQStringListToStdVector(const QStringList& qStringList);

View File

@ -31,6 +31,7 @@ add_library(MainWidgets
${_interface}
${_header}
${_source}
)
#-----------------------------------------------------------------------------
@ -38,7 +39,7 @@ add_library(MainWidgets
#-----------------------------------------------------------------------------
target_compile_definitions(MainWidgets PRIVATE "MAINWIDGETS_API")
list(APPEND _depend_library Common PythonModule Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PostInterface PostPlotWidget PostWidgets ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets IO SolverControl)
list(APPEND _depend_library Common PointCloudOperator PythonModule Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PostInterface PostPlotWidget PostWidgets ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets IO SolverControl)
if(OpenMP_CXX_FOUND)
list(APPEND _depend_library OpenMP::OpenMP_CXX)

View File

@ -28,7 +28,7 @@ namespace MainWidget
_ui->ConplanarCheckBox->setCheckState(Qt::Unchecked);
_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));
_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
connect(_ui->ConplanarCheckBox, SIGNAL(stateChanged(int)), this, SLOT(stateChangedSlot(int)));
connect(_ui->ConplanarCheckBox, SIGNAL(stateChanged(int)), this, SLOT(stateChangedSlot(int))); // 寻找共有点
connect(_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentIndexChangedSlot(int)));
connect(this, SIGNAL(updateSetTree()), _mainWindow, SIGNAL(updateSetTreeSig()));
@ -221,7 +221,7 @@ namespace MainWidget
void CreateSetDialog::accept()
{
if (_ui->ConplanarCheckBox->isChecked())
if (_ui->ConplanarCheckBox->isChecked()) // 共有点复选框
findConplanarAccept();
else
createSetAccept();
@ -258,7 +258,7 @@ namespace MainWidget
QDialog::reject();
return;
}
if (_isGeo)
if (_isGeo) // OCCT 选择
{
if (this->selectFromGeo())
QDialog::accept();
@ -267,7 +267,7 @@ namespace MainWidget
return;
}
QMultiHash<int, int> *selectItems = _preWindow->getSelectItems();
QMultiHash<int, int> *selectItems = _preWindow->getSelectItems(); // 选择 mesh
if (selectItems == nullptr || selectItems->isEmpty())
{
QMessageBox::warning(this, tr("Warning"), tr("No Node or Element selected !"));
@ -287,7 +287,7 @@ namespace MainWidget
memList.append(s);
}
QString idstring = memList.join(";");
QString idstring = memList.join(";"); // id 节点列表
QString type = "Node";
if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell)
type = "Element";

View File

@ -58,10 +58,10 @@ namespace MainWidget
Ui::CreateSetDialog *_ui{};
GUI::MainWindow *_mainWindow{};
PreWindow *_preWindow{};
MeshData::MeshData *_meshData{};
MeshData::MeshData *_meshData{}; // 选择的 vtk mesh 网格
ModuleBase::SelectModel _model;
bool _isGeo{false};
ModuleBase::SelectModel _model; // 选择的 OCCT 模型
bool _isGeo{false}; // 处理OCCT 模型选择的
// vtkDataSet* _data;
int _seedId{-1};
// QString _geoIds;

View File

@ -0,0 +1,108 @@
/**
* @file DialogPCLBilateralFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLBilateralFilter.h" resolved
#include "DialogPCLBilateralFilter.h"
#include "ui_DialogPCLBilateralFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLBilateralFilter::DialogPCLBilateralFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLBilateralFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Fast Bilateral Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLBilateralFilter::~DialogPCLBilateralFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLBilateralFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double sigmaS=_ui->SigmaS->value();
double sigmaR=_ui->SigmaR->value();
emit excuteAlg( componentIds, sigmaR, sigmaS);
QFDialog::accept();
}
void DialogPCLBilateralFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLBilateralFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLBilateralFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -0,0 +1,60 @@
/**
* @file DialogPCLBilateralFilter.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPCLBILATERALFILTER_H
#define LAMPCAE_DIALOGPCLBILATERALFILTER_H
#include "mainWidgetsAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
class QListWidgetItem;
namespace Ui
{
class DialogPCLBilateralFilter;
}
namespace MeshData
{
class MeshSet;
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLBilateralFilter : public QFDialog {
Q_OBJECT
public:
DialogPCLBilateralFilter(GUI::MainWindow* parent);
~DialogPCLBilateralFilter() ;
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double sigmaR,double sigmaS);
private slots:
virtual void accept();
void selectedComponentsSlot(QList<MeshData::MeshSet*> components);
void customContextMenuRequestedSlot(const QPoint& point);
private:
GUI::MainWindow* _mw;
DialogSelectComponents* _selectdlg;
QList<MeshData::MeshSet*> _components;
private:
Ui::DialogPCLBilateralFilter* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLBILATERALFILTER_H

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPCLBilateralFilter</class>
<widget class="QDialog" name="DialogPCLBilateralFilter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>397</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>375</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>397</height>
</size>
</property>
<property name="windowTitle">
<string>DialogPCLBilateralFilter</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>357</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Selected Component</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>299</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>550</width>
<height>500</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="geoSelectPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Clicked Button Selected Components"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/QUI/geometry/selectface.png</normaloff>:/QUI/geometry/selectface.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="btBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>357</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>120</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="SigmaS">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="SigmaSLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>the size of the window : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="SigmaR">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="SigmaRLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>standard deviation of the Gaussian : </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>
</resources>
<connections>
<connection>
<sender>btBox</sender>
<signal>accepted()</signal>
<receiver>DialogPCLBilateralFilter</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>189</x>
<y>493</y>
</hint>
<hint type="destinationlabel">
<x>189</x>
<y>260</y>
</hint>
</hints>
</connection>
<connection>
<sender>btBox</sender>
<signal>rejected()</signal>
<receiver>DialogPCLBilateralFilter</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>189</x>
<y>493</y>
</hint>
<hint type="destinationlabel">
<x>189</x>
<y>260</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,113 @@
/**
* @file DialogPCLGPMesh.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGPMesh.h"
// resolved
#include "DialogPCLGPMesh.h"
#include "ui_DialogPCLGPMesh.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGPMesh::DialogPCLGPMesh(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLGPMesh),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("GP Meshing"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLGPMesh::~DialogPCLGPMesh()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGPMesh::accept()
{
if (_components.size() == 0)
return;
QString componentIds;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double SearchRadius=_ui->SearchRadius->value();
double Mu=_ui->Mu->value();
int MaximumNearestNeighbors=_ui->MaximumNearestNeighbors->value();
double MaximumSurfaceAngle=_ui->MaximumSurfaceAngle->value();
double MaximumAngle=_ui->MaximumAngle->value();
double MinimumAngle=_ui->MinimumAngle->value();
// excuteAlg( QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
emit excuteAlg( componentIds , SearchRadius, Mu, MaximumNearestNeighbors, MaximumSurfaceAngle, MaximumAngle, MinimumAngle);
QFDialog::accept();
}
void DialogPCLGPMesh::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGPMesh::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGPMesh::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -0,0 +1,58 @@
/**
* @file DialogPCLGPMesh.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPCLGPMESH_H
#define LAMPCAE_DIALOGPCLGPMESH_H
#include "mainWidgetsAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
class QListWidgetItem;
namespace Ui
{
class DialogPCLGPMesh;
}
namespace MeshData
{
class MeshSet;
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLGPMesh : public QFDialog {
Q_OBJECT
public:
DialogPCLGPMesh(GUI::MainWindow* parent);
~DialogPCLGPMesh() ;
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg( QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
private slots:
virtual void accept();
void selectedComponentsSlot(QList<MeshData::MeshSet*> components);
void customContextMenuRequestedSlot(const QPoint& point);
private:
GUI::MainWindow* _mw;
DialogSelectComponents* _selectdlg;
QList<MeshData::MeshSet*> _components;
private:
Ui::DialogPCLGPMesh* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLGPMESH_H

View File

@ -0,0 +1,430 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPCLGPMesh</class>
<widget class="QDialog" name="DialogPCLGPMesh">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>673</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>673</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>DialogPCLGPMesh</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QDialogButtonBox" name="btBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>357</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>400</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="SearchRadiusLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Search Radius: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="SearchRadius">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="MuLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>nearest neighbor distance multiplier : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="Mu">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="MaximumNearestNeighborsLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>maximum number of nearest neighbors : </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="MaximumNearestNeighbors">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="MaximumSurfaceAngleLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>normal deviates : </string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="MaximumSurfaceAngle">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="MaximumAngleLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>triangle maximum Angle : </string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="MaximumAngle">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="MinimumAngleLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>triangle minimum Angle : </string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="MinimumAngle">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>357</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>300</height>
</size>
</property>
<property name="title">
<string>Selected Component</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>299</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>550</width>
<height>500</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="geoSelectPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Clicked Button Selected Components"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/QUI/geometry/selectface.png</normaloff>:/QUI/geometry/selectface.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>
</resources>
<connections>
<connection>
<sender>btBox</sender>
<signal>accepted()</signal>
<receiver>DialogPCLGPMesh</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>688</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>365</y>
</hint>
</hints>
</connection>
<connection>
<sender>btBox</sender>
<signal>rejected()</signal>
<receiver>DialogPCLGPMesh</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>688</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>365</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,112 @@
/**
* @file DialogPCLGuassFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGuassFilter.h"
// resolved
#include "DialogPCLGuassFilter.h"
#include "ui_DialogPCLGuassFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGuassFilter::DialogPCLGuassFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLGuassFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Guass Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLGuassFilter::~DialogPCLGuassFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGuassFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double Sigma=_ui->Sigma->value();
double threshold=_ui->threshold->value();
emit excuteAlg( componentIds, Sigma, threshold);
QString code = QString("MainWindow.createVTKTransform(\"%1\",\"%2\",\"%3\",\"%4\")").arg(componentIds).arg(rotate).arg(moveLocation).arg(scale);
Py::PythonAgent::getInstance()->submit(code);
QFDialog::accept();
}
void DialogPCLGuassFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGuassFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGuassFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -0,0 +1,57 @@
/**
* @file DialogPCLGuassFilter.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPCLGUASSFILTER_H
#define LAMPCAE_DIALOGPCLGUASSFILTER_H
#include "mainWidgetsAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
class QListWidgetItem;
namespace Ui
{
class DialogPCLGuassFilter;
}
namespace MeshData
{
class MeshSet;
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLGuassFilter : public QFDialog {
Q_OBJECT
public:
DialogPCLGuassFilter(GUI::MainWindow* parent);
~DialogPCLGuassFilter() ;
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double sigma,double threshold);
private slots:
virtual void accept();
void selectedComponentsSlot(QList<MeshData::MeshSet*> components);
void customContextMenuRequestedSlot(const QPoint& point);
private:
GUI::MainWindow* _mw;
DialogSelectComponents* _selectdlg;
QList<MeshData::MeshSet*> _components;
private:
Ui::DialogPCLGuassFilter* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLGUASSFILTER_H

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPCLGuassFilter</class>
<widget class="QDialog" name="DialogPCLGuassFilter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>446</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>375</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>DialogPCLGuassFilter</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>357</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Selected Component</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>299</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>550</width>
<height>500</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="geoSelectPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Clicked Button Selected Components"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/QUI/geometry/selectface.png</normaloff>:/QUI/geometry/selectface.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>357</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>120</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="Sigma">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="SigmaLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>the sigma of the Gaussian : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="threshold">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="thresholdLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>distance threshold : </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="btBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>
</resources>
<connections>
<connection>
<sender>btBox</sender>
<signal>accepted()</signal>
<receiver>DialogPCLGuassFilter</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>187</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>187</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>btBox</sender>
<signal>rejected()</signal>
<receiver>DialogPCLGuassFilter</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>187</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>187</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,112 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLRadiusOutlierRemoval.h"
#include "ui_DialogPCLRadiusOutlierRemoval.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
namespace MainWidget {
DialogPCLRadiusOutlierRemoval::DialogPCLRadiusOutlierRemoval(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLRadiusOutlierRemoval),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Radius Outlier Removal"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLRadiusOutlierRemoval::~DialogPCLRadiusOutlierRemoval()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLRadiusOutlierRemoval::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double RadiusSearch=_ui->RadiusSearch->value();
double MinNeighborsInRadius=_ui->MinNeighborsInRadius->value();
emit excuteAlg(componentIds,RadiusSearch, MinNeighborsInRadius);
QFDialog::accept();
}
void DialogPCLRadiusOutlierRemoval::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLRadiusOutlierRemoval::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLRadiusOutlierRemoval::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -0,0 +1,59 @@
/**
* @file DialogPCLRadiusOutlierRemoval.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPCLRADIUSOUTLIERREMOVAL_H
#define LAMPCAE_DIALOGPCLRADIUSOUTLIERREMOVAL_H
#include "mainWidgetsAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
class QListWidgetItem;
namespace Ui
{
class DialogPCLRadiusOutlierRemoval;
}
namespace MeshData
{
class MeshSet;
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLRadiusOutlierRemoval : public QFDialog {
Q_OBJECT
public:
DialogPCLRadiusOutlierRemoval(GUI::MainWindow* parent);
~DialogPCLRadiusOutlierRemoval();
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double RadiusSearch,double MinNeighborsInRadius);
private slots:
virtual void accept();
void selectedComponentsSlot(QList<MeshData::MeshSet*> components);
void customContextMenuRequestedSlot(const QPoint& point);
private:
GUI::MainWindow* _mw;
DialogSelectComponents* _selectdlg;
QList<MeshData::MeshSet*> _components;
private:
Ui::DialogPCLRadiusOutlierRemoval* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLRADIUSOUTLIERREMOVAL_H

View File

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPCLRadiusOutlierRemoval</class>
<widget class="QDialog" name="DialogPCLRadiusOutlierRemoval">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>428</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>375</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>DialogPCLRadiusOutlierRemoval</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>357</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Selected Component</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>299</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>550</width>
<height>500</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="geoSelectPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Clicked Button Selected Components"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/QUI/geometry/selectface.png</normaloff>:/QUI/geometry/selectface.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>357</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>120</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="RadiusSearch">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="RadiusSearchLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>25</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Radius of Search : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="MinNeighborsInRadius">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="MinNeighborsInRadiusLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>the number of neighbors : </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="btBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>
</resources>
<connections>
<connection>
<sender>btBox</sender>
<signal>accepted()</signal>
<receiver>DialogPCLRadiusOutlierRemoval</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>390</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>213</y>
</hint>
</hints>
</connection>
<connection>
<sender>btBox</sender>
<signal>rejected()</signal>
<receiver>DialogPCLRadiusOutlierRemoval</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>390</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>213</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,113 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLStatisticalRemoveFilter.h"
#include "ui_DialogPCLStatisticalRemoveFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLStatisticalRemoveFilter::DialogPCLStatisticalRemoveFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLStatisticalRemoveFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Statistical Remove Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLStatisticalRemoveFilter::~DialogPCLStatisticalRemoveFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLStatisticalRemoveFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double MeanK=_ui->MeanK->value();
double stddev=_ui->Stddev->value();
emit excuteAlg(componentIds,MeanK,stddev);
QFDialog::accept();
}
void DialogPCLStatisticalRemoveFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLStatisticalRemoveFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLStatisticalRemoveFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -0,0 +1,57 @@
/**
* @file DialogPCLStatisticalRemoveFilter.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGPCLSTATISTICALREMOVEFILTER_H
#define LAMPCAE_DIALOGPCLSTATISTICALREMOVEFILTER_H
#include "mainWidgetsAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
class QListWidgetItem;
namespace Ui
{
class DialogPCLStatisticalRemoveFilter;
}
namespace MeshData
{
class MeshSet;
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLStatisticalRemoveFilter : public QFDialog {
Q_OBJECT
public:
DialogPCLStatisticalRemoveFilter(GUI::MainWindow* parent);
~DialogPCLStatisticalRemoveFilter();
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double MeanK,double stddev);
private slots:
virtual void accept();
void selectedComponentsSlot(QList<MeshData::MeshSet*> components);
void customContextMenuRequestedSlot(const QPoint& point);
private:
GUI::MainWindow* _mw;
DialogSelectComponents* _selectdlg;
QList<MeshData::MeshSet*> _components;
private: // 界面
Ui::DialogPCLStatisticalRemoveFilter* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLSTATISTICALREMOVEFILTER_H

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPCLStatisticalRemoveFilter</class>
<widget class="QDialog" name="DialogPCLStatisticalRemoveFilter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>450</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>375</width>
<height>408</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>450</height>
</size>
</property>
<property name="windowTitle">
<string>DialogPCLStatisticalRemoveFilter</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>357</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Selected Component</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>299</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>550</width>
<height>500</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="geoSelectPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Clicked Button Selected Components"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/QUI/geometry/selectface.png</normaloff>:/QUI/geometry/selectface.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>357</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>120</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="MeanKLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>number of nearest neighbors : </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="MeanK">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="StddevLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Stddev Thresh : </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="Stddev">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="btBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>
</resources>
<connections>
<connection>
<sender>btBox</sender>
<signal>accepted()</signal>
<receiver>DialogPCLStatisticalRemoveFilter</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>408</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>224</y>
</hint>
</hints>
</connection>
<connection>
<sender>btBox</sender>
<signal>rejected()</signal>
<receiver>DialogPCLStatisticalRemoveFilter</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>408</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>224</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,49 @@
/**
* @file dialogselectmeshdatacomponents.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/7
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogSelectMeshDataComponents.h" resolved
#include "DialogSelectMeshDataComponents.h"
#include "ui_DialogSelectMeshDataComponents.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include "MeshData/MeshKernal.h"
namespace MainWidget {
auto meshData = MeshData::MeshData::getInstance();
DialogSelectMeshDataComponents::DialogSelectMeshDataComponents(GUI::MainWindow* parent)
: QFDialog(parent)
{
_ui->setupUi(this);
setWindowTitle(tr("Select Components"));
int nSet = meshData->getMeshSetCount();
for (int i = 0; i < nSet; i++)
{
MeshData::MeshKernal* k= meshData->getKernalAt(i);
if (!k)
continue;
_ui->listWidget->addItem(k->getName());
}
}
DialogSelectMeshDataComponents::~DialogSelectMeshDataComponents()
{
delete _ui;
_ui = NULL;
}
void DialogSelectMeshDataComponents::accept()
{
QDialog::accept();
}
}

View File

@ -0,0 +1,50 @@
/**
* @file dialogselectmeshdatacomponents.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/7
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_DIALOGSELECTMESHDATACOMPONENTS_H
#define LAMPCAE_DIALOGSELECTMESHDATACOMPONENTS_H
#include <QDialog>
#include "DialogVTKTransform.h"
#include "MeshData/meshSet.h"
namespace MeshData
{
class MeshData;
class MeshSet;
class MeshKernal;
}
namespace Ui {
class DialogSelectMeshDataComponents;
}
namespace MainWidget{
class MAINWIDGETSAPI DialogSelectMeshDataComponents : public QFDialog {
Q_OBJECT
public:
DialogSelectMeshDataComponents(GUI::MainWindow* parent);
~DialogSelectMeshDataComponents() override;
void clearSelectItems();
signals:
void selectedComponentsSig(QList<MeshData::MeshSet*> components);
private slots:
virtual void accept();
private:
Ui::DialogSelectMeshDataComponents* _ui;
};
}
#endif // LAMPCAE_DIALOGSELECTMESHDATACOMPONENTS_H

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogSelectMeshDataComponents</class>
<widget class="QDialog" name="DialogSelectMeshDataComponents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>248</height>
</rect>
</property>
<property name="windowTitle">
<string>DialogSelectMeshDataComponents</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="listWidget">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>247</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogVTKTransform</class>
<widget class="QDialog" name="DialogVTKTransform">
@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>664</height>
<width>377</width>
<height>752</height>
</rect>
</property>
<property name="minimumSize">
@ -18,7 +18,7 @@
</property>
<property name="maximumSize">
<size>
<width>375</width>
<width>379</width>
<height>752</height>
</size>
</property>

View File

@ -56,7 +56,7 @@ namespace MainWidget
void MeshKernalViewObj::setPointColor(const QColor &c, bool disOnly)
{
vtkDataArray *dpointColor = _displayData->GetPointData()->GetScalars();
double col[3]{c.red(), c.green(), c.blue()};
double col[3]{c.red()*1.0, c.green()*1.0, c.blue()*1.0};
if (nullptr == dpointColor)
{
dpointColor = vtkUnsignedCharArray::New();
@ -91,7 +91,7 @@ namespace MainWidget
vtkDataArray *indexArray = _displayData->GetPointData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red(), color.green(), color.blue()};
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
const int nPoint = indexArray->GetNumberOfTuples();
for (int i = 0; i < nPoint; ++i)
{
@ -111,7 +111,7 @@ namespace MainWidget
void MeshKernalViewObj::setCellColor(const QColor &c, bool disOnly)
{
double col[3]{c.red(), c.green(), c.blue()};
double col[3]{c.red()*1.0, c.green()*1.0, c.blue()*1.0};
vtkDataArray *dcellcolor = _displayData->GetCellData()->GetScalars();
if (dcellcolor == nullptr)
{
@ -146,7 +146,7 @@ namespace MainWidget
{
vtkDataArray *colorArray = _displayData->GetCellData()->GetScalars();
vtkDataArray *indexArray = _displayData->GetCellData()->GetArray("IDS");
double col[3]{color.red(), color.green(), color.blue()};
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
if (nullptr == colorArray || nullptr == indexArray)
return;
const int nCell = indexArray->GetNumberOfTuples();
@ -200,7 +200,7 @@ namespace MainWidget
vtkDataArray *indexArray = _displayData->GetPointData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red(), color.green(), color.blue()};
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
for (int index : indexs)
{
colorArray->SetComponent(index, 0, col[0]);
@ -216,7 +216,7 @@ namespace MainWidget
vtkDataArray *indexArray = _displayData->GetCellData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red(), color.green(), color.blue()};
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
for (int index : indexs)
{
colorArray->SetComponent(index, 0, col[0]);
@ -283,11 +283,11 @@ namespace MainWidget
const int id = _kernal->getID();
// cell ID与显示隐藏状态
vtkSmartPointer<vtkUnsignedIntArray> kcellid_index = vtkSmartPointer<vtkUnsignedIntArray>::New();
kcellid_index->SetNumberOfComponents(2);
kcellid_index->SetNumberOfComponents(2); // 设置 dimension
kcellid_index->SetName("IDS");
const int ncell = dataset->GetNumberOfCells();
for (int i = 0; i < ncell; ++i)
kcellid_index->InsertNextTuple2(id, i);
kcellid_index->InsertNextTuple2(id, i); // 这里添加 网格id ,与 cell 序号
dataset->GetCellData()->AddArray(kcellid_index);
vtkSmartPointer<vtkUnsignedIntArray> cstatesArray = vtkSmartPointer<vtkUnsignedIntArray>::New();

View File

@ -23,15 +23,21 @@ namespace MainWidget
_meshData = MeshData::MeshData::getInstance();
connect(_preWindow, SIGNAL(updateMeshActorSig()), this, SLOT(updateMeshActorSlot()));
//connect(_preWindow, SIGNAL(removeSetDataSig(int)), this, SLOT(removeSetData(int)));
// connect(_preWindow, SIGNAL(highLightActorDispalyPoint(bool)), this, SLOT(highLightActorDispalyPoint(bool)));
// connect(_preWindow, SIGNAL(removeSetDataSig(int)), this, SLOT(removeSetData(int)));
// connect(_preWindow, SIGNAL(highLightActorDispalyPoint(bool)), this,
//SLOT(highLightActorDispalyPoint(bool)));
connect(_preWindow, SIGNAL(clearMeshSetHighLight()), this, SLOT(clearHighLight()));
connect(_preWindow, SIGNAL(clearAllHighLight()), this, SLOT(clearHighLight()));
connect(_preWindow, SIGNAL(highLighMeshSet(MeshData::MeshSet *)), this, SLOT(highLighMeshSet(MeshData::MeshSet *)));
connect(_preWindow, SIGNAL(highLighKernel(MeshData::MeshKernal *)), this, SLOT(highLighKernel(MeshData::MeshKernal *)));
// connect(_preWindow, SIGNAL(highLighDataSet(vtkDataSet*)), this, SLOT(highLighDataSet(vtkDataSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetVisibleSig(MeshData::MeshSet *)), this, SLOT(updateMeshSetVisibily(MeshData::MeshSet *)));
connect(_mainWindow, SIGNAL(updateMeshSetColorSig(int)), this, SLOT(updateMeshSetColor(int)));
connect(_preWindow, SIGNAL(highLighMeshSet(MeshData::MeshSet*)), this,
SLOT(highLighMeshSet(MeshData::MeshSet*)));
connect(_preWindow, SIGNAL(highLighKernel(MeshData::MeshKernal*)), this,
SLOT(highLighKernel(MeshData::MeshKernal*)));
// connect(_preWindow, SIGNAL(highLighDataSet(vtkDataSet*)), this,
//SLOT(highLighDataSet(vtkDataSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetVisibleSig(MeshData::MeshSet*)), this,
SLOT(updateMeshSetVisibily(MeshData::MeshSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetColorSig(int)), this,
SLOT(updateMeshSetColor(int)));
}
MeshViewProvider::~MeshViewProvider()

View File

@ -19,12 +19,14 @@ namespace MainWidget
PreWindow::PreWindow(GUI::MainWindow *mw, int id, ModuleBase::GraphWindowType t)
: ModuleBase::Graph3DWindow(mw, id, t, true)
{
_meshData = MeshData::MeshData::getInstance();
_meshData = MeshData::MeshData::getInstance(); // 数据管理口
_geometryData = Geometry::GeometryData::getInstance();
_modelData = ModelData::ModelDataSingleton::getinstance();
_geoProvider = new GeometryViewProvider(mw, this);
_geoProvider = new GeometryViewProvider(mw, this); // 界面
_meshProvider = new MeshViewProvider(mw, this);
_sketchProvider = new SketchViewProvider(mw, this);
this->setWindowTitle(tr("Pre-Window"));
connect(this, SIGNAL(closed()), mw, SIGNAL(closePreWindowSig()));
connect(mw, SIGNAL(clearAllHighLight()), this, SIGNAL(clearAllHighLight()));
@ -37,7 +39,7 @@ namespace MainWidget
connect(mw, SIGNAL(startSketchSig(bool, double *, double *)), this, SLOT(startSketch(bool, double *, double *)));
//网格
// connect(this, SIGNAL(updateMeshActorSig()), this, SLOT(updateMeshActor()));
connect(this, SIGNAL(highLighSet(QMultiHash<int, int> *)), this, SLOT(highLighSet(QMultiHash<int, int> *)));
connect(this, SIGNAL(highLighSet(QMultiHash<int, int> *)), this, SLOT(highLighSet(QMultiHash<int, int> *))); // 绑定父类Graph3DWindow的highLignset(信号)与本类highLighSet(槽)
connect(mw, SIGNAL(updateMeshDispalyStateSig(int, bool)), this, SLOT(updateMeshDispaly(int, bool)));
connect(mw, SIGNAL(removeMeshActorSig(int)), this, SLOT(removeMeshActor(int)));
connect(mw, SIGNAL(removeSetDataSig(int)), this, SIGNAL(removeSetDataSig(int)));

View File

@ -38,7 +38,7 @@ add_library(MainWindow
#-----------------------------------------------------------------------------
target_compile_definitions(MainWindow PRIVATE "MAINWINDOW_API")
list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
list(APPEND _depend_library Common LAMPTool WBCLFZSystemModule PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
if(_WIN_)
list(APPEND _depend_library XGenerateReport)
endif()

View File

@ -45,6 +45,7 @@
#include "MainWidgets/projectSolveDialog.h"
#include "MainWindowPy.h"
#include "MeshData/meshKernal.h"
#include "MeshData/meshSet.h"
#include "MeshData/meshSingleton.h"
#include "ModelData/modelDataBaseExtend.h"
#include "ModelData/modelDataSingleton.h"
@ -72,6 +73,8 @@
#include <QMessageBox>
#include <QSignalMapper>
#include <QTreeWidgetItem>
#include <vtkCellDataToPointData.h>
#include <pcl/io/vtk_lib_io.h>
// ribbon
#include "SARibbonBar/SARibbonBar.h"
#include "SARibbonBar/SARibbonCategory.h"
@ -82,12 +85,22 @@
#include "Common/Types.h"
#include "PostInterface/AnimationToolBar.h"
#include "PostInterface/RenderDirector.h"
// pcl
#include "MainWidgets/DialogPCLBilateralFilter.h"
#include "MainWidgets/DialogPCLGPMesh.h"
#include "MainWidgets/DialogPCLGuassFilter.h"
#include "MainWidgets/DialogPCLRadiusOutlierRemoval.h"
#include "MainWidgets/DialogPCLStatisticalRemoveFilter.h"
#include "IO/vtkDataRelated.h"
#include "LAMPTool/BaseTool.h"
//logger
// logger
#include "Common/DebugLogger.h"
namespace GUI {
MainWindow::MainWindow(bool useRibbon): SARibbonMainWindow(nullptr, useRibbon), _ui(new Ui::MainWindowRibbon)
MainWindow::MainWindow(bool useRibbon)
: SARibbonMainWindow(nullptr, useRibbon)
, _ui(new Ui::MainWindowRibbon)
{
if(useRibbon) {
_ui->setupRibbonUi(this);
@ -150,7 +163,8 @@ namespace GUI {
// ribbon customize
// MainWindow的构造函数最后
if(useRibbon) {
const QString strCostomizePath =QApplication::applicationDirPath() + "/customization.xml";
const QString strCostomizePath =
QApplication::applicationDirPath() + "/customization.xml";
sa_apply_customize_from_xml_file(strCostomizePath, this, m_ribbonActionMgr);
}
}
@ -210,6 +224,7 @@ namespace GUI {
connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this,
SLOT(printMessage(Common::Message, QString)));
// 文件
connect(_ui->actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew()));
connect(_ui->actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen()));
connect(_ui->actionSave, SIGNAL(triggered()), this, SLOT(on_actionSave()));
@ -239,6 +254,10 @@ namespace GUI {
connect(_ui->actionFilterMesh, SIGNAL(triggered()), this, SLOT(on_FilterMesh()));
connect(_ui->actionVTKTranslation, SIGNAL(triggered()), this, SLOT(on_VTKTranslation()));
// 点云
// 设置视角
_viewSignalMapper = new QSignalMapper(this);
connect(_ui->actionFitView, SIGNAL(triggered()), _viewSignalMapper, SLOT(map()));
@ -261,13 +280,16 @@ namespace GUI {
_selectSignalMapper = new QSignalMapper(this);
connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
// connect(_ui->actionSelectGeoBody, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionSelectMeshNode, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionSelectMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 单点
connect(_ui->actionSelectMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
_selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody,
//(int)ModuleBase::SelectModel::GeometryBody);
_selectSignalMapper->setMapping(_ui->actionSelectMeshNode,
(int)ModuleBase::SelectModel::MeshNode);
_selectSignalMapper->setMapping(_ui->actionSelectMeshCell,
@ -276,8 +298,9 @@ namespace GUI {
(int)ModuleBase::SelectModel::BoxMeshNode);
_selectSignalMapper->setMapping(_ui->actionBoxMeshCell,
(int)ModuleBase::SelectModel::BoxMeshCell);
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int)));
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SLOT(selectModelChanged(int)));
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int))); // 选择模式更改信号
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SLOT(selectModelChanged(int))); // 选择模型更改为
// 网格显示模式
// _displayModeSignalMapper = new QSignalMapper(this);
connect(_ui->actionDisplayNode, SIGNAL(triggered()), this, SLOT(setMeshDisplay()));
@ -330,6 +353,10 @@ namespace GUI {
connect(this, SIGNAL(updatePreGeometryActorSig()), this, SLOT(updatePreGeometryActor()));
connect(this, SIGNAL(openPlot()), _signalHandler, SLOT(openPlotFile()));
// 点云模块
}
void MainWindow::registerMoudel()
@ -380,7 +407,8 @@ namespace GUI {
QString lang = Setting::BusAPI::instance()->getLanguage();
QString title;
ConfigOption::GlobalConfig* g = ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
ConfigOption::GlobalConfig* g =
ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
title = g->getSoftName();
if(lang.toLower() == "chinese")
@ -466,7 +494,8 @@ namespace GUI {
if(_processWindow != nullptr)
_processWindow->reTranslate();
ConfigOption::GlobalConfig* g =ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
ConfigOption::GlobalConfig* g =
ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
QString title = "MicrowaveMeasurementSimulationSubSystemCAE"; // 修改 标识 LAMPCAE
if(lang.toLower() == "chinese") {
QString f = g->getChineseName();
@ -626,16 +655,18 @@ namespace GUI {
void MainWindow::on_importPcl()
{
QStringList suffixlist = IO::IOConfigure::getPclImporters();
DebugInfo("import point cloud data file format : %s \n ",suffixlist.join(";").toUtf8().constData());
DebugInfo("import point cloud data file format : %s \n ",
suffixlist.join(";").toUtf8().constData());
// QStringList list = IO::IOConfigure::getMeshImporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
QStringList pclsuffix =
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix(ConfigOption::MeshDataType::PointCloud).split(
";");
QStringList pclsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getImportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : pclsuffix) {
@ -667,15 +698,12 @@ namespace GUI {
if(fileName.isEmpty())
return;
QString pyCode = QString("MainWindow.importPcl(\"%1\",\"%2\",%3)")
.arg(fileName)
.arg(aSuffix)
.arg(modelID);
.arg(fileName)
.arg(aSuffix)
.arg(modelID);
Py::PythonAgent::getInstance()->submit(pyCode);
}
void MainWindow::on_exportGeometry()
{
QString dir = Setting::BusAPI::instance()->getWorkingDir();
@ -754,7 +782,8 @@ namespace GUI {
Py::PythonAgent::getInstance()->submit(pyCode);
}
void MainWindow::on_exportPcl(){
void MainWindow::on_exportPcl()
{
QStringList suffixlist = IO::IOConfigure::getPclExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
@ -766,9 +795,10 @@ namespace GUI {
return;
}
QStringList meshsuffix =
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix(ConfigOption::MeshDataType::PointCloud).split(
";");
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
@ -916,6 +946,10 @@ namespace GUI {
Setting::BusAPI::instance()->setGraphOptions();
}
/*
*
* @param model ModuleBase::SelectModel
*/
void MainWindow::selectModelChanged(int model)
{
_ui->actionSelectOff->setChecked(false);
@ -1446,4 +1480,73 @@ namespace GUI {
return m_ribbonActionMgr;
}
void MainWindow::on_pclStatisticalRemoveFilter() {
MainWidget::DialogPCLStatisticalRemoveFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclRadiusOutlierRemoval() {
MainWidget::DialogPCLRadiusOutlierRemoval dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclGuassFilter() {
MainWidget::DialogPCLGuassFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclBilateralFilter() {
MainWidget::DialogPCLBilateralFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclGPMesh() {
MainWidget::DialogPCLGPMesh dlg(this);
connect(&dlg, SIGNAL(excuteAlg( QString , double , double ,int ,double ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg( QString , double , double ,int ,double ,double ,double )));
dlg.exec();
}
void MainWindow::PCLStatisticalRemoveFilterAlg(QString componentIds, double MeanK,double StddevThresh) {
}
void MainWindow::PCLRadiusOutlierRemovalFilterAlg(QString componentIds, double RadiusSearch,
double MinNeighborsInRadius)
{
emit this->printMessage(Common::Message::Normal,"PCLRadiusOutlierRemovalFilterAlg");
}
void MainWindow::PCLGuassFilterAlg(QString componentIds, double sigma, double threshold) {
emit this->printMessage(Common::Message::Normal,"PCLGuassFilterAlg");
}
void MainWindow::PCLGPMeshAlg(QString componentIds, double SearchRadius, double Mu,
int MaximumNearestNeighbors, double MaximumSurfaceAngle,
double MaximumAngle, double MinimumAngle)
{
emit this->printMessage(Common::Message::Normal,"PCLGPMeshAlg");
}
void MainWindow::PCLBilateralFilterAlg(QString componentIds, double sigmaR, double sigmaS) {
emit this->printMessage(Common::Message::Normal,"PCLBilateralFilterAlg");
}
} // namespace GUI

View File

@ -337,6 +337,19 @@ namespace GUI {
// 更新工具栏信息
// void updateActionsStates();
// 统计滤波
void on_pclStatisticalRemoveFilter();
// 半径滤波
void on_pclRadiusOutlierRemoval();
// 高斯滤波
void on_pclGuassFilter();
// 双边滤波
void on_pclBilateralFilter();
// GP网格重建
void on_pclGPMesh();
private slots:
/*关闭主窗口 */
void closeWindow();
@ -398,6 +411,19 @@ namespace GUI {
// 创建VTK空间变换窗口
void on_VTKTranslation();
// StatisticalRemoveFilter
void PCLStatisticalRemoveFilterAlg(QString componentIds,double MeanK,double stddev);
// PCLRadiusOutlierRemoval
void PCLRadiusOutlierRemovalFilterAlg(QString componentIds,double RadiusSearch,double MinNeighborsInRadius);
// PCLGuassFilter
void PCLGuassFilterAlg(QString componentIds,double sigma,double threshold);
// PCLGPMesh
void PCLGPMeshAlg( QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
// PCLBilateralFilter
void PCLBilateralFilterAlg(QString componentIds,double sigmaR,double sigmaS);
private:
/*初始化Menu*/
// void initMenu();

View File

@ -268,7 +268,7 @@
<x>0</x>
<y>0</y>
<width>1678</width>
<height>17</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -511,9 +511,9 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/filter.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/filter.png</iconset>
</property>
<addaction name="actionPCLStatisticalRemoveFilter"/>
<addaction name="actionPCLDBRemoveFilter"/>
<addaction name="actionPCLRadiusOutlierRemoval"/>
<addaction name="actionPCLGuassFilter"/>
<addaction name="actionPCLAverageFilter"/>
<addaction name="actionPCLBilateralFilter"/>
</widget>
<widget class="QMenu" name="menureSurfaceMesh">
<property name="title">
@ -1909,13 +1909,13 @@
<string>StatisticalRemoveFilter</string>
</property>
</action>
<action name="actionPCLDBRemoveFilter">
<action name="actionPCLRadiusOutlierRemoval">
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</iconset>
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</iconset>
</property>
<property name="text">
<string>DBRemoveFilter</string>
<string>RadiusOutlierRemoval</string>
</property>
</action>
<action name="actionPCLGuassFilter">
@ -1927,13 +1927,13 @@
<string>GuassFilter</string>
</property>
</action>
<action name="actionPCLAverageFilter">
<action name="actionPCLBilateralFilter">
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</iconset>
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</iconset>
</property>
<property name="text">
<string>AverageFilter</string>
<string>BilateralFilter</string>
</property>
</action>
<action name="actionPCLGPMesh">

View File

@ -2365,6 +2365,7 @@ void MAINWINDOWAPI importPcl(char* f, char* s, int modelId)
{
GUI::MainWindowPy::importPcl(f, s, modelId);
}
void MAINWINDOWAPI exportPcl(char* f, char* s, int modelId)
{
GUI::MainWindowPy::exportPcl(f, s, modelId);

View File

@ -43,6 +43,8 @@ namespace GUI {
static void quit();
static void solveProject(int projectIndex, int solverIndex);
static void createSet(const char* name, const char* type, const char* idstring);
static void createGeoComponent(char* name, char* type, char* strgIDs, char* striIDs);
static void createVTKTransform(const char* componentIds, const char* rotate,
const char* moveLocation, const char* scale);
@ -208,6 +210,16 @@ namespace GUI {
int val);
static void deleteGeometry(int id);
// 点云操作
// 模型仿真操作
// 数据分析
private:
static MainWindow* _mainWindow;
static SignalHandler* _signalHander;
@ -403,6 +415,12 @@ void MAINWINDOWAPI script_Properties_streamline_reflection(int id, char* type, i
void MAINWINDOWAPI script_Properties_streamline_reflectionAxes(int id, char* type, int obj_id,
int val);
void MAINWINDOWAPI deleteGeometry(int id);
/// 点云相关模型
}
#endif

View File

@ -656,37 +656,38 @@ namespace Ui {
actionPCLStatisticalRemoveFilter = new QAction(MainWindow);
actionPCLStatisticalRemoveFilter->setObjectName(QString::fromUtf8("actionPCLStatisticalRemoveFilter"));
QIcon icon110;
icon110.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/Histogram.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLStatisticalRemoveFilter->setIcon(icon110);
actionPCLDBRemoveFilter = new QAction(MainWindow);
actionPCLDBRemoveFilter->setObjectName(QString::fromUtf8("actionPCLDBRemoveFilter"));
QIcon icon111;
icon111.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLDBRemoveFilter->setIcon(icon111);
actionPCLGuassFilter = new QAction(MainWindow);
actionPCLGuassFilter->setObjectName(QString::fromUtf8("actionPCLGuassFilter"));
QIcon icon112;
icon112.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/nihe.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLGuassFilter->setIcon(icon112);
actionPCLAverageFilter = new QAction(MainWindow);
actionPCLAverageFilter->setObjectName(QString::fromUtf8("actionPCLAverageFilter"));
QIcon icon113;
icon113.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLAverageFilter->setIcon(icon113);
actionPCLGPMesh = new QAction(MainWindow);
actionPCLGPMesh->setObjectName(QString::fromUtf8("actionPCLGPMesh"));
QIcon icon114;
icon114.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/grey.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLGPMesh->setIcon(icon114);
actionLoadFile = new QAction(MainWindow);
actionLoadFile->setObjectName(QString::fromUtf8("actionLoadFile"));
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
gridLayout = new QGridLayout(centralwidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
mdiArea = new QMdiArea(centralwidget);
mdiArea->setObjectName(QString::fromUtf8("mdiArea"));
QIcon icon110;
icon110.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/Histogram.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLStatisticalRemoveFilter->setIcon(icon110);
actionPCLRadiusOutlierRemoval = new QAction(MainWindow);
actionPCLRadiusOutlierRemoval->setObjectName(QString::fromUtf8("actionPCLRadiusOutlierRemoval"));
QIcon icon111;
icon111.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLRadiusOutlierRemoval->setIcon(icon111);
actionPCLGuassFilter = new QAction(MainWindow);
actionPCLGuassFilter->setObjectName(QString::fromUtf8("actionPCLGuassFilter"));
QIcon icon112;
icon112.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/nihe.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLGuassFilter->setIcon(icon112);
actionPCLBilateralFilter = new QAction(MainWindow);
actionPCLBilateralFilter->setObjectName(QString::fromUtf8("actionPCLBilateralFilter"));
QIcon icon113;
icon113.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLBilateralFilter->setIcon(icon113);
actionPCLGPMesh = new QAction(MainWindow);
actionPCLGPMesh->setObjectName(QString::fromUtf8("actionPCLGPMesh"));
QIcon icon114;
icon114.addFile(QString::fromUtf8(":/PointCloudProcess/PointCloudProcess/images/grey.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPCLGPMesh->setIcon(icon114);
actionLoadFile = new QAction(MainWindow);
actionLoadFile->setObjectName(QString::fromUtf8("actionLoadFile"));
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
gridLayout = new QGridLayout(centralwidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
mdiArea = new QMdiArea(centralwidget);
mdiArea->setObjectName(QString::fromUtf8("mdiArea"));
gridLayout->addWidget(mdiArea, 0, 0, 1, 1);
@ -882,9 +883,9 @@ namespace Ui {
PCLFile_operator_pannel->addMediumAction(actionLoadPointCloud);
PCLFile_operator_pannel->addMediumAction(actionSavePointCloud);
PCLFilter_pannel->addMediumAction(actionPCLStatisticalRemoveFilter);
PCLFilter_pannel->addMediumAction(actionPCLDBRemoveFilter);
PCLFilter_pannel->addMediumAction(actionPCLRadiusOutlierRemoval);
PCLFilter_pannel->addMediumAction(actionPCLGuassFilter);
PCLFilter_pannel->addMediumAction(actionPCLAverageFilter);
PCLFilter_pannel->addMediumAction(actionPCLBilateralFilter);
PCLReSurfaceMesh_pannel->addLargeAction(actionPCLGPMesh);
}
@ -1158,9 +1159,9 @@ namespace Ui {
actionFilter->setText(QCoreApplication::translate("MainWindow", "Filter", nullptr));
actionPointCloudStatisticalRemove->setText(QCoreApplication::translate("MainWindow", "StatisticalRemove", nullptr));
actionPCLStatisticalRemoveFilter->setText(QCoreApplication::translate("MainWindow", "StatisticalRemoveFilter", nullptr));
actionPCLDBRemoveFilter->setText(QCoreApplication::translate("MainWindow", "DBRemoveFilter", nullptr));
actionPCLGuassFilter->setText(QCoreApplication::translate("MainWindow", "GuassFilter", nullptr));
actionPCLAverageFilter->setText(QCoreApplication::translate("MainWindow", "AverageFilter", nullptr));
actionPCLRadiusOutlierRemoval->setText(QCoreApplication::translate("MainWindow", "RadiusOutlierRemoval", nullptr));
actionPCLGuassFilter->setText(QCoreApplication::translate("MainWindow", "GuassFilter", nullptr));
actionPCLBilateralFilter->setText(QCoreApplication::translate("MainWindow", "BilateralFilter", nullptr));
actionPCLGPMesh->setText(QCoreApplication::translate("MainWindow", "GPMesh", nullptr));
actionLoadFile->setText(QCoreApplication::translate("MainWindow", "LoadFile", nullptr));
} // retranslateUi

View File

@ -317,7 +317,7 @@ namespace ModuleBase
{
// emit higtLightActorDisplayPoint(true);
emit clearAllHighLight();
int *clickPos = this->GetInteractor()->GetEventPosition();
int *clickPos = this->GetInteractor()->GetEventPosition(); // 鼠标坐标
vtkSmartPointer<vtkPointPicker> picker = vtkSmartPointer<vtkPointPicker>::New();
picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());
if (picker->GetPointId() >= 0)
@ -327,8 +327,8 @@ namespace ModuleBase
int id = picker->GetPointId();
vtkDataSet *dataset = picker->GetActor()->GetMapper()->GetInput();
vtkDataArray *idArray = dataset->GetPointData()->GetArray("IDS");
double *k_index = idArray->GetTuple2(id);
_selectItems.insert(k_index[0], k_index[1]);
double *k_index = idArray->GetTuple2(id); // 参考 meshKernalViewObject.cpp:generateIDProp 函数方法,
_selectItems.insert(k_index[0], k_index[1]); // (网格id,点序号)
emit highLight(&_selectItems);
}
}

View File

@ -99,7 +99,7 @@ target_compile_definitions(PluginMeshDataExchange PRIVATE "NOMINMAX") # 禁用vc
target_compile_definitions(PluginMeshDataExchange PRIVATE "MESHDATAEXCHANGEPLUGIN_API")
list(APPEND _depend_library
Common PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow)
Common PointCloudOperator PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow)

View File

@ -1,6 +1,7 @@
//
// Created by 30453 on 2024/4/1.
//
/*
* Created by 30453 on 2024/4/1
* 2024.4.3
* **/
#include "PointClouddataExchange.h"
#include "MeshData/meshSingleton.h"
@ -28,8 +29,8 @@
#include <QDebug>
#include <QFileInfo>
#include <vtkPointCloudFilter.h>
#include "PointCloudOperator/PointCloudCommon.h"
// debug
#include "Common/DebugLogger.h"
@ -78,6 +79,7 @@ namespace MeshData {
if (suffix == "pcd")
{
dataset = readPCD();
DebugInfo("pcd data point count %d \n",dataset->GetNumberOfPoints());
}
else if (suffix == "ply")
{
@ -138,15 +140,20 @@ namespace MeshData {
{
if (!_threadRuning)
return nullptr;
// 打开点云数据
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
int readstate =pcl::io::loadPCDFile(_fileName.toUtf8().constData(), *cloud_with_rgba); // 读取数据
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_with_rgba,polydata);
vtkDataSet* tempvtkdataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
pcl::PCLPointCloud2::Ptr cloud2(new pcl::PCLPointCloud2);
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
std::string inFileName=ba.data();
vtkSmartPointer<vtkPolyData> polydata=vtkSmartPointer<vtkPolyData>::New();
if(pcl::io::loadPCDFile(inFileName,*cloud2)==0){
pcl::io::pointCloudTovtkPolyData(cloud2,polydata);
}else {
return nullptr;
}
vtkPolyData* tempvtkdataset=vtkPolyData::New();
tempvtkdataset->DeepCopy(polydata);
DebugInfo("deep copy sucessfully!\n");
DebugInfo("pcd data point count %d \n",tempvtkdataset->GetNumberOfPoints());
return tempvtkdataset; // 默认完成 vtkpolydata --> vtkdataset
}
vtkDataSet* PointClouddataExchange::readPLY()
@ -154,15 +161,21 @@ namespace MeshData {
if (!_threadRuning)
return nullptr;
// 打开点云数据
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
int readstate =pcl::io::loadPLYFile(_fileName.toUtf8().constData(), *cloud_with_rgba); // 读取数据
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_with_rgba,polydata);
vtkDataSet* tempvtkdataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
pcl::PCLPointCloud2::Ptr cloud2(new pcl::PCLPointCloud2);
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
std::string inFileName=ba.data();
vtkSmartPointer<vtkPolyData> polydata=vtkSmartPointer<vtkPolyData>::New();
if(pcl::io::loadPLYFile(inFileName,*cloud2)==0){
pcl::io::pointCloudTovtkPolyData(cloud2,polydata);
}else {
return nullptr;
}
vtkPolyData* tempvtkdataset=vtkPolyData::New();
tempvtkdataset->DeepCopy(polydata);
DebugInfo("deep copy sucessfully!\n");
DebugInfo("pcd data point count %d \n",tempvtkdataset->GetNumberOfPoints());
return tempvtkdataset; // 默认完成 vtkpolydata --> vtkdataset
}
@ -218,12 +231,11 @@ namespace MeshData {
{
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
DebugInfo("PointClouddataExchange::writePCD FileName :%s ",ba);
// 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();
DebugInfo("PointClouddataExchange::writePCD Filter prepare :ok modelID :%d\n",_modelId);
if (_modelId > 0)
{
@ -248,7 +260,7 @@ namespace MeshData {
if (kernal != nullptr)
{
vtkDataSet *dataset = kernal->getMeshData();
DebugInfo("PointClouddataExchange::writePCD writer over : iKernal %d , %d is nullptr ,points Count %d\n",i,(int)(dataset==nullptr),dataset->GetNumberOfPoints());
if (dataset != nullptr)
geometryFilter->AddInputData(dataset);
}
@ -256,14 +268,14 @@ namespace MeshData {
}
geometryFilter->Update();
vtkSmartPointer<vtkPolyData> outputDataSet = geometryFilter->GetOutput();
DebugInfo("PointClouddataExchange::writePCD writer over :ok outputDataSet Point Count : %d\n",outputDataSet->GetNumberOfPoints());
// 将输出的点云数据集转换为 PCL 格式
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outputDataSet,*cloud_with_rgba);
DebugInfo("PointClouddataExchange::writePCD writer over :ok cloud_with_rgba Point Count : %d\n",cloud_with_rgba->size());
std::string outFileName=ba.data();
pcl::io::savePCDFileBinary(outFileName,*cloud_with_rgba);
DebugInfo("PointClouddataExchange::writePCD writer over :ok \n");
return true;
}
bool PointClouddataExchange::writePLY()
@ -271,10 +283,8 @@ namespace MeshData {
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
vtkUnstructuredGrid *ungird = vtkUnstructuredGrid::New();
vtkSmartPointer<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
// 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();
if (_modelId > 0)
{
@ -303,7 +313,7 @@ namespace MeshData {
}
}
}
filter->Update();
geometryFilter->Update();
vtkSmartPointer<vtkPolyData> polyData = geometryFilter->GetOutput();
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(polyData,*cloud_with_rgba);

View File

@ -1,6 +1,7 @@
//
// Created by 30453 on 2024/4/1.
//
/*
* Created by 30453 on 2024/4/1
* 2024.4.3
* **/
#ifndef LAMPCAE_POINTCLOUDDATAEXCHANGE_H
#define LAMPCAE_POINTCLOUDDATAEXCHANGE_H
@ -116,8 +117,6 @@
#include <vtkRenderWindow.h>
namespace MeshData {
class MeshData;

View File

@ -20,6 +20,7 @@
#include <QFileInfo>
GUI::MainWindow* MeshData::MeshDataExchangePlugin::_mainwindow = nullptr;
namespace MeshData {
MeshDataExchangePlugin::MeshDataExchangePlugin(GUI::MainWindow* m)
{

View File

@ -1,321 +0,0 @@
#include "PointCloudChecker.h"
#include "PointCloudKernal.h"
#include "PointCloudSingleton.h"
#include <vtkDataSet.h>
#include <vtkCell.h>
#include <vtkCellQuality.h>
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <math.h>
#include <vtkUnstructuredGrid.h>
#include <QDebug>
namespace PointCloudData
{
PointCloudChecker::PointCloudChecker()
{
_PointCloudData = PointCloudData::getInstance();
_cellQuality = vtkSmartPointer<vtkCellQuality>::New();
_qualityArray = vtkSmartPointer<vtkDoubleArray>::New();
_cellQuality->SetUndefinedQuality(-1e66);
_cellQuality->SetUnsupportedGeometry(-1e66);
}
PointCloudChecker::~PointCloudChecker()
{
// const int n = _resultList.size();
// for (int i = 0; i < n; ++i)
// {
// vtkDataSet* d = _resultList.at(i);
// d->Delete();
// }
// _resultList.clear();
}
void PointCloudChecker::run()
{
_qualityArray->SetNumberOfValues(0);
_inputCount.clear();
_checkedCount.clear();
// const int nc = _resultList.size();
// for (int i = 0; i < nc; ++i)
// {
// vtkDataSet* d = _resultList.at(i);
// d->Delete();
// }
_resultList.clear();
if (_measure == NONE) return;
const int n = _PointCloudData->getKernalCount();
for (int i = 0; i < n; ++i)
{
PointCloudKernal* k = _PointCloudData->getKernalAt(i);
this->checkKernal(k);
}
_qualityArray->Modified();
countResult();
}
void PointCloudChecker::setQualityMeasure(QualityMeasure m)
{
_measure = m;
_cellQuality->SetQualityMeasure(m);
}
void PointCloudChecker::checkKernal(PointCloudKernal* k)
{
vtkDataSet* checkingDataset = k->getPointCloudData();
_cellQuality->SetInputData(checkingDataset);
_cellQuality->Update();
vtkDataSet* res = _cellQuality->GetOutput();
// vtkUnstructuredGrid* g = vtkUnstructuredGrid::New();
// g->DeepCopy(res);
_resultList.append(res);
this->collectInfo(res);
}
void PointCloudChecker::collectInfo(vtkDataSet* res)
{
vtkDataArray* qua = res->GetCellData()->GetScalars("CellQuality");
const int n = res->GetNumberOfCells();
for (int i = 0; i < n; ++i)
{
vtkCell* cell = res->GetCell(i);
VTKCellType type = (VTKCellType)cell->GetCellType();
++_inputCount[type];
double q = qua->GetComponent(i, 0);
if (q > -1e65)
{
_qualityArray->InsertNextValue(q);
_checkedCount[type].append(q);
}
}
}
QString PointCloudChecker::VTKCellTypeToString(VTKCellType type)
{
QString stype("Undefined");
switch (type)
{
case VTK_VERTEX:
stype = "Vertex"; break;
case VTK_POLY_VERTEX:
stype = "PolyVertex"; break;
case VTK_LINE:
stype = "Line"; break;
case VTK_POLY_LINE:
stype = "PolyLine"; break;
case VTK_TRIANGLE:
stype = "Tri3"; break;
case VTK_TRIANGLE_STRIP:
stype = "Tri3Strip"; break;
case VTK_POLYGON:
stype = "Polygon"; break;
case VTK_PIXEL:
stype = "Pixel"; break;
case VTK_QUAD:
stype = "Quad4"; break;
case VTK_TETRA:
stype = "Tet4"; break;
case VTK_VOXEL:
stype = "Voxel"; break;
case VTK_HEXAHEDRON:
stype = "Hex8"; break;
case VTK_WEDGE:
stype = "Wedge"; break;
case VTK_PYRAMID:
stype = "Pyramid"; break;
case VTK_PENTAGONAL_PRISM:
stype = "PentaPrism"; break;
case VTK_HEXAGONAL_PRISM:
stype = "HexaPrism"; break;
case VTK_QUADRATIC_EDGE:
stype = "QuaEdge"; break;
case VTK_QUADRATIC_TRIANGLE:
stype = "QuaTriangle"; break;
case VTK_QUADRATIC_LINEAR_QUAD:
stype = "QuaLinearQuad"; break;
case VTK_QUADRATIC_QUAD:
stype = "QuaQuad"; break;
case VTK_BIQUADRATIC_QUAD:
stype = "BiquaQuad"; break;
case VTK_QUADRATIC_TETRA:
stype = "QuaTetra"; break;
case VTK_QUADRATIC_PYRAMID:
stype = "QuaPyramid"; break;
case VTK_QUADRATIC_HEXAHEDRON:
stype = "QuaHexa"; break;
case VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON:
stype = "BiquaQuaHexa"; break;
case VTK_TRIQUADRATIC_HEXAHEDRON:
stype = "TriquaHexa"; break;
case VTK_QUADRATIC_LINEAR_WEDGE:
stype = "QuaLinearWedge"; break;
case VTK_QUADRATIC_WEDGE:
stype = "QuaWedge"; break;
case VTK_BIQUADRATIC_QUADRATIC_WEDGE:
stype = "BiquaQuaWedge"; break;
default:
break;
}
return stype;
}
QList<VTKCellType> PointCloudChecker::getInputCellType()
{
return _inputCount.keys();
}
int PointCloudChecker::getInputCellCount(VTKCellType type)
{
int count = 0;
if (_inputCount.contains(type))
count = _inputCount.value(type);
return count;
}
int PointCloudChecker::getInputCellCount()
{
int count = 0;
QList<VTKCellType> typelist = this->getInputCellType();
const int n = typelist.size();
for (int i = 0; i < n; ++i)
{
VTKCellType t = typelist.at(i);
count += this->getInputCellCount(t);
}
return count;
}
QList<VTKCellType> PointCloudChecker::getQualityCellType()
{
return _checkedCount.keys();
}
int PointCloudChecker::gettQualityCellCount(VTKCellType type)
{
int count = 0;
if (_checkedCount.contains(type))
count = _checkedCount.value(type).size();
return count;
}
int PointCloudChecker::gettQualityCellCount()
{
int count = 0;
QList<VTKCellType> typelist = this->getQualityCellType();
const int n = typelist.size();
for (int i = 0; i < n; ++i)
{
VTKCellType t = typelist.at(i);
count += this->gettQualityCellCount(t);
}
return count;
}
void PointCloudChecker::getQualityRange(double* range)
{
_qualityArray->GetRange(range);
// range[0] = r[0];
// range[1] = r[1];
}
double PointCloudChecker::getAverageQuality()
{
const int n = _qualityArray->GetNumberOfValues();
if (n == 0) return -1e66;
double sum = 0;
for (int i = 0; i < n; ++i)
{
sum += _qualityArray->GetValue(i);
}
return sum / n;
}
void PointCloudChecker::countResult()
{
_ticks.clear();
_cellCount.clear();
const int count = gettQualityCellCount();
if (count == 0) return;
double range[2];
this->getQualityRange(range);
if (range[1] - range[0] < 1e-8)
{
_ticks.append((range[0] + range[1]) / 2);
QList<VTKCellType> types = this->getQualityCellType();
for (int i = 0; i < types.size(); ++i)
{
VTKCellType t = types.at(i);
int n = this->gettQualityCellCount(t);
_cellCount[t].append(n);
}
return;
}
QList<VTKCellType> types = this->getQualityCellType();
for (int i = 0; i < types.size(); ++i)
{
VTKCellType t = types.at(i);
//int n = this->gettQualityCellCount(t);
_cellCount[t].resize(10);
}
double ran = range[1] - range[0];
double step = ran / 10.0;
for (int i = 0; i < 10; ++i)
_ticks.append(range[0] + step / 2 + step*i);
for (int i = 0; i < types.size(); ++i)
{
VTKCellType t = types.at(i);
QList<double> qual = _checkedCount[t];
int cellcount = qual.size();
for (int c = 0; c < cellcount; ++c)
{
double v = qual.at(c);
for (int j = 0; j < 10; ++j)
{
double ti = _ticks.at(j);
if (v >= ti - step / 2 && v < ti + step / 2)
{
++_cellCount[t][j];
continue;
}
}
}
}
}
QVector<double> PointCloudChecker::getTicks()
{
return _ticks;
}
QVector<double> PointCloudChecker::getCountList(VTKCellType t)
{
QVector<double> d;
if (_cellCount.contains(t))
d = _cellCount.value(t);
return d;
}
QList<vtkDataSet*> PointCloudChecker::getResultList()
{
return _resultList;
}
}

View File

@ -1,114 +0,0 @@
#ifndef PointCloudCHECKER_H
#define PointCloudCHECKER_H
#include <QThread>
#include "PointCloudDataAPI.h"
#include <vtkCellType.h>
#include <vtkSmartPointer.h>
#include <QHash>
#include <QList>
#include <QString>
#include <QVector>
#define BARCOUNT 10;
class vtkDataSet;
class vtkCell;
class vtkCellQuality;
class vtkDoubleArray;
namespace PointCloudData
{
class PointCloudData;
class PointCloudKernal;
enum QualityMeasure
{
NONE = 0,
AREA,
ASPECT_BETA,
ASPECT_FROBENIUS,
ASPECT_GAMMA,
ASPECT_RATIO,
COLLAPSE_RATIO,
CONDITION,
DIAGONAL,
DIMENSION,
DISTORTION,
EDGE_RATIO,
JACOBIAN,
MAX_ANGLE,
MAX_ASPECT_FROBENIUS,
MAX_EDGE_RATIO,
MED_ASPECT_FROBENIUS,
MIN_ANGLE,
NORMAL,
ODDY,
RADIUS_RATIO,
RELATIVE_SIZE_SQUARED,
SCALED_JACOBIAN,
SHAPE,
SHAPE_AND_SIZE,
SHEAR,
SHEAR_AND_SIZE,
SKEW,
STRETCH,
TAPER,
VOLUME,
WARPAGE
};
class POINTCLOUDDATAAPI PointCloudChecker :public QThread
{
public:
PointCloudChecker();
~PointCloudChecker();
static QString VTKCellTypeToString(VTKCellType type);
virtual void run();
void setQualityMeasure(QualityMeasure m);
QList<VTKCellType> getInputCellType();
int getInputCellCount(VTKCellType type);
int getInputCellCount();
QList<VTKCellType> getQualityCellType();
int gettQualityCellCount(VTKCellType type);
int gettQualityCellCount();
void getQualityRange(double* r);
double getAverageQuality();
QVector<double> getTicks();
QVector<double> getCountList(VTKCellType t);
QList<vtkDataSet*> getResultList();
private:
void checkKernal(PointCloudKernal* k);
void collectInfo(vtkDataSet* outInfo);
void countResult();
private:
vtkSmartPointer<vtkCellQuality> _cellQuality{};
PointCloudData* _PointCloudData{};
QualityMeasure _measure{ NONE };
vtkSmartPointer<vtkDoubleArray> _qualityArray{};
QHash<VTKCellType, int> _inputCount{};
QHash<VTKCellType, QList<double>> _checkedCount{};
QList<vtkDataSet*> _resultList{};
QVector<double> _ticks{};
QHash<VTKCellType, QVector<double>> _cellCount{};
};
}
#endif

View File

@ -1,76 +0,0 @@
#include "PointCloudCommon.h"
#include <vtkCellType.h>
int VTKCellTypeToDim(int type)
{
int dim = -1;
switch (VTKCellType(type))
{
case VTK_EMPTY_CELL: break;
case VTK_VERTEX:
case VTK_POLY_VERTEX: dim = 0; break;
case VTK_LINE:
case VTK_POLY_LINE: dim = 1; break;
case VTK_TRIANGLE:
case VTK_TRIANGLE_STRIP:
case VTK_POLYGON:
case VTK_PIXEL:
case VTK_QUAD: dim = 2; break;
case VTK_TETRA:
case VTK_VOXEL:
case VTK_HEXAHEDRON:
case VTK_WEDGE:
case VTK_PYRAMID:
case VTK_PENTAGONAL_PRISM:
case VTK_HEXAGONAL_PRISM: dim = 3; break;
// Quadratic, isoparametric cells
case VTK_QUADRATIC_EDGE: dim = 1; break;
case VTK_QUADRATIC_TRIANGLE:
case VTK_QUADRATIC_QUAD:
case VTK_QUADRATIC_POLYGON: dim = 2; break;
case VTK_QUADRATIC_TETRA:
case VTK_QUADRATIC_HEXAHEDRON:
case VTK_QUADRATIC_WEDGE:
case VTK_QUADRATIC_PYRAMID: dim = 3; break;
case VTK_BIQUADRATIC_QUAD: dim = 2; break;
case VTK_TRIQUADRATIC_HEXAHEDRON: dim = 3; break;
case VTK_QUADRATIC_LINEAR_QUAD: dim = 2; break;
case VTK_QUADRATIC_LINEAR_WEDGE:
case VTK_BIQUADRATIC_QUADRATIC_WEDGE:
case VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON: dim = 3; break;
case VTK_BIQUADRATIC_TRIANGLE: dim = 2; break;
// Cubic, isoparametric cell
case VTK_CUBIC_LINE: dim = 1; break;
// Special class of cells formed by convex group of points
case VTK_CONVEX_POINT_SET: dim = 0; break;
// Polyhedron cell (consisting of polygonal faces)
case VTK_POLYHEDRON: dim = 2; break;
// Higher order cells in parametric form
case VTK_PARAMETRIC_CURVE: dim = 1; break;
case VTK_PARAMETRIC_SURFACE:
case VTK_PARAMETRIC_TRI_SURFACE:
case VTK_PARAMETRIC_QUAD_SURFACE: dim = 2; break;
case VTK_PARAMETRIC_TETRA_REGION:
case VTK_PARAMETRIC_HEX_REGION: dim = 3; break;
// Higher order cells
case VTK_HIGHER_ORDER_EDGE: dim = 1; break;
case VTK_HIGHER_ORDER_TRIANGLE:
case VTK_HIGHER_ORDER_QUAD:
case VTK_HIGHER_ORDER_POLYGON: dim = 2; break;
case VTK_HIGHER_ORDER_TETRAHEDRON:
case VTK_HIGHER_ORDER_WEDGE:
case VTK_HIGHER_ORDER_PYRAMID:
case VTK_HIGHER_ORDER_HEXAHEDRON: dim = 3; break;
case VTK_NUMBER_OF_CELL_TYPES: dim = -1; break;
default: break;
}
return dim;
}

View File

@ -1,14 +0,0 @@
#ifndef _MESHCOMMON_H_
#define _MESHCOMMON_H_
#include "PointCloudDataAPI.h"
#include <QList>
extern "C"
{
int MESHDATAAPI VTKCellTypeToDim(int ctype);
}
#endif

View File

@ -1,13 +0,0 @@
#ifndef _POINTCLOUDDATAAPI_H_
#define _POINTCLOUDDATAAPI_H_
#include <QtCore/QtGlobal>
#if defined(POINTCLOUDDATA_API)
#define POINTCLOUDDATAAPI Q_DECL_EXPORT
#else
#define POINTCLOUDDATAAPI Q_DECL_IMPORT
#endif
#endif

View File

@ -1,44 +0,0 @@
#include "PointCloudFactory.h"
#include "PointCloudSet.h"
#include "CgnsBCZone.h"
#include "CgnsFamily.h"
namespace PointCloudData
{
QHash<int, CREATEPointCloudSET> PointCloudFactory::_createSetFun = QHash<int, CREATEPointCloudSET>();
PointCloudData::PointCloudSet* PointCloudFactory::CreatePointCloudSet(int type)
{
SetType stype = (SetType)type;
PointCloudSet* set = nullptr;
switch (stype)
{
case PointCloudData::Node:
set = new PointCloudSet("", Node); break;
case PointCloudData::Element:
set = new PointCloudSet("", Element); break;
case PointCloudData::Family:
set = new CgnsFamily; break;
case PointCloudData::BCZone:
set = new CgnsBCZone; break;
default:
CREATEPointCloudSET fun = _createSetFun.value(type);
if (fun!= nullptr)
set = fun(type);
break;
}
return set;
}
void PointCloudFactory::registerFunction(int type, CREATEPointCloudSET fun)
{
_createSetFun.insert(type, fun);
}
void PointCloudFactory::remove(int type)
{
_createSetFun.remove(type);
}
}

View File

@ -1,27 +0,0 @@
#ifndef _PointCloudFACTORY_H__
#define _PointCloudFACTORY_H__
#include "PointCloudSet.h"
#include <QHash>
typedef PointCloudData::PointCloudSet* (*CREATEPointCloudSET)(int);
namespace PointCloudData
{
class POINTCLOUDDATAAPI PointCloudFactory
{
public:
static PointCloudSet* CreatePointCloudSet(int type);
static void registerFunction(int type, CREATEPointCloudSET fun);
static void remove(int type);
private:
static QHash<int, CREATEPointCloudSET> _createSetFun;
};
}
#endif

View File

@ -1,263 +0,0 @@
#include "PointCloudKernal.h"
#include <vtkDataSet.h>
#include <vtkPoints.h>
#include <vtkCell.h>
#include <QDataStream>
#include <QString>
#include <QDomDocument>
#include <QDomElement>
#include <QDomAttr>
#include <QDomText>
#include <vtkIdList.h>
#include <vtkUnstructuredGrid.h>
#include <QDebug>
namespace PointCloudData
{
int PointCloudKernal::idOffset = 0;
int PointCloudKernal::pointIDOffset = 1;
PointCloudKernal::PointCloudKernal()
{
idOffset++;
setID(idOffset);
_pointIDOffset = pointIDOffset;
// _PointCloud = vtkSmartPointer<vtkUnstructuredGrid>::New();
_specificColor.first = false;
appendProperty(QObject::tr("Visible"), _visible);
}
void PointCloudKernal::setPointCloudData(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr dataset)
{
_PointCloud = dataset;
_pointIDOffset = pointIDOffset;
pointIDOffset += dataset->size();
appendProperty(QObject::tr("Points"), (int)dataset->size());
}
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr PointCloudKernal::getPointCloudData()
{
return _PointCloud;
}
pcl::PointXYZRGBA PointCloudKernal::getPointAt(const int index)
{
return _PointCloud->at(index);
}
bool PointCloudKernal::isVisible()
{
return _visible;
}
void PointCloudKernal::setVisible(bool v)
{
_visible = v;
appendProperty(QObject::tr("Visible"), _visible);
}
void PointCloudKernal::dataToStream(QDataStream* s)
{
*s << _id << _name << _PointCloud->size() ;
}
void PointCloudKernal::setID(int id)
{
DataBase::setID(id);
if (id > idOffset)
idOffset = id;
}
void PointCloudKernal::setPath(const QString& path)
{
_path = path;
}
QString PointCloudKernal::getPath()
{
return _path;
}
void PointCloudKernal::setPointIDOFfset(int offset)
{
_pointIDOffset = offset;
if (pointIDOffset < offset)
pointIDOffset = offset;
}
QDomElement& PointCloudKernal::writeToProjectFile(QDomDocument* doc, QDomElement* parent)
{
QDomElement kernelele = doc->createElement("PointCloudKernel");
QDomAttr idAttr = doc->createAttribute("ID");
idAttr.setValue(QString::number(_id));
kernelele.setAttributeNode(idAttr);
QDomAttr visible = doc->createAttribute("Visible");
visible.setValue("True");
if (!_visible) visible.setValue("False");
kernelele.setAttributeNode(visible);
QDomElement nameele = doc->createElement("Name");
QDomText nameText = doc->createTextNode(_name);
nameele.appendChild(nameText);
kernelele.appendChild(nameele);
if (!_path.isEmpty())
{
QDomElement pathele = doc->createElement("Path");
QDomText pathtext = doc->createTextNode(_path);
pathele.appendChild(pathtext);
kernelele.appendChild(pathele);
this->writePCDFile(_path);
}
return kernelele;
}
void PointCloudKernal::readDataFromProjectFile(QDomElement* kernelele)
{
QString sid = kernelele->attribute("ID");
this->setID(sid.toInt());
QString svis = kernelele->attribute("Visible");
bool visible = true;
if (svis.toLower() == "false") visible = false;
this->setVisible(visible);
QDomNodeList nameNodeList = kernelele->elementsByTagName("Name");
if (nameNodeList.size() != 1) return;
QString name = nameNodeList.at(0).toElement().text();
this->setName(name);
QDomNodeList pathList = kernelele->elementsByTagName("Path");
if (pathList.size() > 0)
{
QString path = pathList.at(0).toElement().text();
this->setPath(path);
this->readBinaryFile(path);
}
}
int PointCloudKernal::getPointCount()
{
if (_PointCloud != nullptr)
return _PointCloud->size();
return -1;
}
void PointCloudKernal::resetOffset()
{
idOffset = 0;
pointIDOffset = 1;
}
void PointCloudKernal::setDimension(int d)
{
_dimension = d;
}
int PointCloudKernal::getDimension()
{
return _dimension;
}
//写出二进制文件
void PointCloudKernal::writeBinaryFile(QDataStream* dataStream){
*dataStream << _id << _visible << _name << _path; // 保存存储文件的相对文件名
}
//读入二进制文件
void PointCloudKernal::readBinaryFile(QDataStream* dataStream){
int KernalID = 0; //KernalID
bool visible = false;
QString PointCloudName, PointCloudPath;
*dataStream >> KernalID >> visible >> PointCloudName >> PointCloudPath;
this->setID(KernalID);
this->setVisible(visible);
this->setName(PointCloudName);
this->setPath(PointCloudPath);
this->readPCDFile(PointCloudPath);
}
void PointCloudKernal::writePCDFile(const QString& datafilepath)
{
pcl::io::savePCDFileBinary(datafilepath.toUtf8().constData(),*(this->getPointCloudData()));
}
void PointCloudKernal::readPCDFile(const QString& dataStream)
{
// 定义点云
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PCLPointCloud2::Ptr cloud2(new pcl::PCLPointCloud2);
// 读取点云,失败返回-1
if (pcl::io::loadPCDFile(dataStream.toUtf8().constData(), *cloud2) == -1)
{
PCL_ERROR("couldn't read file\n");
}else{
pcl::fromPCLPointCloud2(*cloud2,*cloud);
this->setPointCloudData(cloud);
this->setPath(dataStream);
}
}
void PointCloudKernal::setPointCloudSetting(DataProperty::DataBase* data)
{
_PointCloudSetting = data;
}
DataProperty::DataBase* PointCloudKernal::getPointCloudSetting()
{
return _PointCloudSetting;
}
void PointCloudKernal::setSpecificColor(bool enable, QColor c)
{
_specificColor.first = enable;
_specificColor.second = c;
this->UpdatePointCloudCloudColor();
}
void PointCloudKernal::setSpecificColor(bool enable,std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t alpha)
{
_specificColor.first = enable;
_specificColor.second.setRedF(r);
_specificColor.second.setGreenF(g);
_specificColor.second.setBlueF(b);
_specificColor.second.setAlpha(alpha);
this->UpdatePointCloudCloudColor();
}
QColor PointCloudKernal::getSpecificColor(bool &isEnable)
{
isEnable = _specificColor.first;
return _specificColor.second;
this->UpdatePointCloudCloudColor();
}
void PointCloudKernal::UpdatePointCloudCloudColor() {
std::uint8_t r= _specificColor.second.redF();
std::uint8_t g= _specificColor.second.greenF();
std::uint8_t b= _specificColor.second.blueF();
std::uint8_t a= _specificColor.second.alphaF();
for(std::size_t i=0;i<_PointCloud->size();i++){
(*_PointCloud)[i].r=r;
}
for(std::size_t i=0;i<_PointCloud->size();i++){
(*_PointCloud)[i].g=g;
}
for(std::size_t i=0;i<_PointCloud->size();i++){
(*_PointCloud)[i].b=b;
}
for(std::size_t i=0;i<_PointCloud->size();i++){
(*_PointCloud)[i].a=a;
}
}
}

View File

@ -1,102 +0,0 @@
#include "PointCloudPy.h"
#include "PointCloudKernal.h"
#include "PointCloudSingleton.h"
#include "PointCloudSet.h"
#include "DataProperty/DataBase.h"
PointCloudData::PointCloudData *md = PointCloudData::PointCloudData::getInstance();
POINTCLOUDDATAAPI int getPointCloudKernalCountPy()
{
return md->getKernalCount();
}
POINTCLOUDDATAAPI const char* getPointCloudKernalNameByIndexPy(const int index)
{
PointCloudData::PointCloudKernal *mk = md->getKernalAt(index);
if (!mk) return "";
std::string cppStr = mk->getName().toStdString();
const char* cStr = cppStr.c_str();
char name[128] = { 0 };
strcpy(name, cStr);
return name;
}
POINTCLOUDDATAAPI const char* getPointCloudKernalNameByKidPy(const int kid)
{
PointCloudData::PointCloudKernal *mk = md->getKernalByID(kid);
if (!mk) return "";
std::string cppStr = mk->getName().toStdString();
const char* cStr = cppStr.c_str();
char name[128] = { 0 };
strcpy(name, cStr);
return name;
}
POINTCLOUDDATAAPI void removePointCloudKernalByIndexPy(const int index)
{
md->removeKernalAt(index);
}
POINTCLOUDDATAAPI void removePointCloudKernalByKidPy(const int kid)
{
md->removeKernalByID(kid);
}
POINTCLOUDDATAAPI int getPointCloudSetCountPy()
{
return md->getPointCloudSetCount();
}
POINTCLOUDDATAAPI const char* getPointCloudSetNameByIndexPy(const int index)
{
PointCloudData::PointCloudSet *ms = md->getPointCloudSetAt(index);
if (!ms) return "";
std::string cppStr = ms->getName().toStdString();
const char* cStr = cppStr.c_str();
char name[128] = { 0 };
strcpy(name, cStr);
return name;
}
POINTCLOUDDATAAPI const char* getPointCloudSetNameBySidPy(const int sid)
{
PointCloudData::PointCloudSet *ms = md->getPointCloudSetByID(sid);
if (!ms) return "";
std::string cppStr = ms->getName().toStdString();
const char* cStr = cppStr.c_str();
char name[128] = { 0 };
strcpy(name, cStr);
return name;
}
POINTCLOUDDATAAPI void removePointCloudSetByIndexPy(const int index)
{
md->removePointCloudSetAt(index);
}
POINTCLOUDDATAAPI void clearPointCloudPy()
{
md->clear();
}
POINTCLOUDDATAAPI void generatePointCloudDisplayDataSetPy()
{
md->generateDisplayDataSet();
}
POINTCLOUDDATAAPI void setColor(char*lab, int id, char* color)
{
QString slab(lab);
if (slab == "PointCloudSet")
{
PointCloudData::PointCloudSet* s = md->getPointCloudSetByID(id);
if (s == nullptr) return;
auto colorPar = s->getParameterByName("Color");
if (colorPar == nullptr) return;
colorPar->setValueFromString(QString(color));
}
else
{
}
}

View File

@ -1,25 +0,0 @@
#ifndef _POINTCLOUDPY_H_
#define _POINTCLOUDPY_H_
#include "PointCloudDataAPI.h"
extern "C"
{
//POINTCLOUDKernal
POINTCLOUDDATAAPI int getPointCloudKernalCountPy();
POINTCLOUDDATAAPI const char* getPointCloudKernalNameByIndexPy(const int index);
POINTCLOUDDATAAPI const char* getPointCloudKernalNameByKidPy(const int kid);
POINTCLOUDDATAAPI void removePointCloudKernalByIndexPy(const int index);
POINTCLOUDDATAAPI void removePointCloudKernalByKidPy(const int kid);
POINTCLOUDDATAAPI void setColor(char*lab, int id, char* color);
//POINTCLOUDSet
POINTCLOUDDATAAPI int getPointCloudSetCountPy();
POINTCLOUDDATAAPI const char* getPointCloudSetNameByIndexPy(const int index);
POINTCLOUDDATAAPI const char* getPointCloudSetNameBySidPy(const int sid);
POINTCLOUDDATAAPI void removePointCloudSetByIndexPy(const int index);
POINTCLOUDDATAAPI void clearPointCloudPy();
POINTCLOUDDATAAPI void generatePointCloudDisplayDataSetPy();
}
#endif

View File

@ -1,360 +0,0 @@
#include "PointCloudSet.h"
#include "PointCloudSingleton.h"
#include "PointCloudKernal.h"
#include "DataProperty/ParameterColor.h"
#include <QDomElement>
#include <QDataStream>
#include <vtkIdTypeArray.h>
#include <vtkAppendFilter.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSet.h>
#include <vtkSelectionNode.h>
#include <vtkSmartPointer.h>
#include <vtkSelection.h>
#include <vtkExtractSelection.h>
#include <vtkAppendFilter.h>
#include <QDebug>
namespace PointCloudData
{
//int PointCloudSet::maxID = 0;
PointCloudSet::PointCloudSet(QString name, SetType t) : ComponentBase(DataProperty::ComponentType::MESH)
{
// maxID++;
// setID(maxID);
setName(name);
setType(t);
// _member = new SetMember;
DataProperty::ParameterColor* c = new DataProperty::ParameterColor();
c->setDescribe("Color");
this->setModuleType(DataProperty::Module_PointCloudSet);
this->appendParameter(c);
}
PointCloudSet::PointCloudSet() : ComponentBase(DataProperty::ComponentType::MESH)
{
// maxID++;
// setID(maxID);
// setName(name);
// _member = new SetMember;
}
PointCloudSet::~PointCloudSet()
{
// if (_member != nullptr) delete _member;
if (_displayDataSet != nullptr) _displayDataSet->Delete();
}
// void PointCloudSet::setID(int id)
// {
// DataBase::setID(id);
// if (maxID < id)
// maxID = id;
// }
void PointCloudSet::setType(PointCloudSetType t)
{
_type = t;
QString stype = "Node";
switch (t)
{
case PointXYZRGBA: stype = "PointXYZRGBA"; break;
default: break;
}
this->appendProperty("Type", stype);
}
PointCloudSetType PointCloudSet::getSetType()
{
return _type;
}
QColor PointCloudSet::getColor()
{
DataProperty::ParameterColor* c = dynamic_cast<DataProperty::ParameterColor*>(getParameterByName("Color"));
if (c == nullptr) return QColor();
return c->getColor();
}
void PointCloudSet::appendMember(int ker, int id)
{
// if (_members.contains(ker, id)) return;
_members.insert(ker, id);
}
QList<int> PointCloudSet::getKernals()
{
return _members.uniqueKeys();
}
QList<int> PointCloudSet::getKernalMembers(int k)
{
if (_members.contains(k))
return _members.values(k);
return QList<int>();
}
int PointCloudSet::getAllCount()
{
return _members.size();
}
QDomElement& PointCloudSet::writeToProjectFile(QDomDocument* doc, QDomElement* parent)
{
QDomElement setEle = doc->createElement("PointCloudSet");
QDomAttr idAttr = doc->createAttribute("ID");
idAttr.setValue(QString::number(_id));
setEle.setAttributeNode(idAttr);
QDomAttr name = doc->createAttribute("Name");
name.setValue(_name);
setEle.setAttributeNode(name);
QString stype = "Node";
if (_type == Element) stype = "Element";
QDomAttr typeAttr = doc->createAttribute("Type");
typeAttr.setValue(stype);
setEle.setAttributeNode(typeAttr);
QList<int> kernalids = _members.uniqueKeys();
for (int kid : kernalids)
{
QDomElement kele = doc->createElement("Kernal");
kele.setAttribute("ID", kid);
QDomElement memle = doc->createElement("Member");
QList<int> memids = _members.values(kid);
QStringList text;
for (int id : memids)
text.append(QString::number(id));
QDomText memText = doc->createTextNode(text.join(","));
memle.appendChild(memText);
kele.appendChild(memle);
setEle.appendChild(kele);
}
parent->appendChild(setEle);
return setEle;
}
void PointCloudSet::readDataFromProjectFile(QDomElement* setEle)
{
QString name = setEle->attribute("Name");
QString stype = setEle->attribute("Type");
QString sID = setEle->attribute("ID");
PointCloudSetType type = None;
if (stype.toLower() == "node") PointCloudSetType = Node;
else if (stype.toLower() == "element") type = Element;
this->setID(sID.toInt());
this->setName(name);
this->setType(type);
QDomNodeList kerList = setEle->elementsByTagName("Kernal");
for (int i = 0; i < kerList.size(); ++i)
{
QDomElement kerele = kerList.at(i).toElement();
QString skid = kerele.attribute("ID");
bool ok = false;
const int kid = skid.toInt(&ok);
if (!ok) continue;
QDomNodeList memList = kerele.elementsByTagName("Member");
for (int j = 0; j < memList.size(); ++j)
{
QDomElement memele = memList.at(j).toElement();
QString text = memele.text();
QStringList sids = text.split(",");
for (QString s : sids)
{
int mid = s.toInt(&ok);
if (!ok) continue;
this->appendMember(kid, mid);
}
}
}
}
void PointCloudSet::generateDisplayDataSet()
{
if (_displayDataSet != nullptr) return;
if (_members.isEmpty()) return;
appendProperty("Count", _members.values().size());
PointCloudData* meshdata = PointCloudData::getInstance();
QList<int> kids = _members.uniqueKeys();
vtkSmartPointer<vtkAppendFilter> appendFliter = vtkSmartPointer<vtkAppendFilter>::New();
for (int kid : kids)
{
QList<int> member = _members.values(kid);
auto k = meshdata->getKernalByID(kid);
if (member.isEmpty() || k ==nullptr) continue;
vtkDataSet* dataset = k->getPointCloudData();
if (dataset == nullptr) continue;
vtkSmartPointer<vtkIdTypeArray> idArray = vtkSmartPointer<vtkIdTypeArray>::New();
for (int id : member) idArray->InsertNextValue(id);
vtkSmartPointer<vtkSelectionNode> selectionNode = vtkSmartPointer<vtkSelectionNode>::New();
if (_type == Element)
{
selectionNode->SetFieldType(vtkSelectionNode::CELL);
}
else if (_type == Node)
{
selectionNode->SetFieldType(vtkSelectionNode::POINT);
}
selectionNode->SetContentType(vtkSelectionNode::INDICES);
selectionNode->SetSelectionList(idArray);
vtkSmartPointer<vtkSelection> selection = vtkSmartPointer<vtkSelection>::New();
selection->AddNode(selectionNode);
vtkSmartPointer<vtkExtractSelection> extractionSelection = vtkSmartPointer<vtkExtractSelection>::New();
extractionSelection->SetInputData(0, dataset);
extractionSelection->SetInputData(1, selection);
extractionSelection->Update();
appendFliter->AddInputData(extractionSelection->GetOutput());
}
appendFliter->Update();
_displayDataSet = vtkUnstructuredGrid::New();
_displayDataSet->DeepCopy(appendFliter->GetOutput());
}
vtkDataSet* PointCloudSet::getDisplayDataSet()
{
return _displayDataSet;
}
PointCloudSetType PointCloudSet::stringToSettype(QString s)
{
PointCloudSetType t = None;
if (s == "PointXYZRGBA") t = PointXYZRGBA;
else t=None;
return t;
}
//写set部分的二进制
void PointCloudSet::writeBinaryFile(QDataStream* dataStream)
{
QList<int> kids = _members.uniqueKeys();
const int nk = kids.size();
*dataStream << (int)_type << _id << _name << nk; //setID,setType,setName,KernalIDs
for (int kid : kids)
{
QList<int> memids = _members.values(kid);
const int n = memids.size();
*dataStream << kid << n;
for (int mem : memids)
*dataStream << mem;
}
}
//读取set部分的二进制
void PointCloudSet::readBinaryFile(QDataStream* dataStream)
{
int SetID{ 0 }, nKernal{ 0 }; //, nMember{0}; //setID,KernalID,MemberNumber
QString setName;
*dataStream >> SetID >> setName >> nKernal;
this->setID(SetID);
this->setName(setName);
for (int nk = 0; nk < nKernal; ++nk)
{
int kid = 0, ncount = 0 , mid = 0;
*dataStream >> kid >>ncount;
for (int i = 0; i < ncount; ++i)
{
*dataStream >> mid;
appendMember(kid, mid);
}
}
}
void PointCloudSet::appendTempMem(int m)
{
_tempMemberID.append(m);
}
void PointCloudSet::setKeneralID(int id)
{
for (int m : _tempMemberID)
this->appendMember(id, m);
_tempMemberID.clear();
}
bool PointCloudSet::isContainsKernal(int id)
{
return _members.contains(id);
}
void PointCloudSet::dataToStream(QDataStream* s)
{
*s << _id << _name << _members.size();
}
void PointCloudSet::isVisible(bool v)
{
_visible = v;
}
bool PointCloudSet::isVisible()
{
return _visible;
}
void PointCloudSet::merge(PointCloudSet* set)
{
if (set->getSetType() != _type) return;
QList<int> ks = set->getKernals();
for (int k : ks)
{
QList<int> mem = set->getKernalMembers(k);
for (int m : mem)
this->appendMember(k, m);
}
}
void PointCloudSet::cut(PointCloudSet* set)
{
if (set->getSetType() != _type) return;
QList<int> ks = set->getKernals();
for (int k : ks)
{
if (!_members.contains(k)) continue;
QList<int> mem = set->getKernalMembers(k);
for (int m : mem)
_members.remove(k, m);
}
}
QString PointCloudSet::setTypeToString(PointCloudSetType type)
{
QString qtype{};
switch (type)
{
case PointXYZRGBA : qtype = "PointXYZRGBA"; break;
default : break;
}
return qtype;
}
BoundPointCloudSet::BoundPointCloudSet(): PointCloudSet()
{
}
void BoundPointCloudSet::setCellFaces(const QMap<int, QVector<int>> cellFaces)
{
m_CellFaces = cellFaces;
}
QMap<int, QVector<int>> BoundPointCloudSet::getCellFaces()
{
return m_CellFaces;
}
}

View File

@ -1,229 +0,0 @@
/*
* PointCloudKernal
*
* */
#ifndef POINTCLOUDSET_H_
#define POINTCLOUDSET_H_
#include "PointCloudDataAPI.h"
#include "DataProperty/ComponentBase.h"
#include <QString>
#include <QMultiHash>
#include <QColor>
#include <QMap>
// Point Cloud Library
#include <QColorDialog>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/console/time.h>
#include <pcl/filters/convolution_3d.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/radius_outlier_removal.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp>
#include <iostream>
#include <pcl/console/time.h> // TicToc
#include <pcl/features/normal_3d.h>
#include <pcl/filters/bilateral.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/fast_bilateral.h>
#include <pcl/filters/fast_bilateral_omp.h>
#include <pcl/filters/passthrough.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h>
#include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <vector>
#include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h>
#include <sstream>
#include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h>
#include <vtkPLYReader.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>
#include <Eigen/Core>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/features/moment_of_inertia_estimation.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <string>
#include <vector>
#include <vtkAutoInit.h>
//可视化相关头文件
#include <vtkActor.h>
#include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
// Boost
#include <boost/math/special_functions/round.hpp>
// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
namespace PointCloudData
{
enum PointCloudSetType
{
None = 0,
PointXYZRGBA, // 表示点云类别
UserDef = 101,
EndType = 100000,
};
class SetMember;
class POINTCLOUDDATAAPI PointCloudSet : public DataProperty::ComponentBase
{
public :
//构造函数
PointCloudSet(QString name, PointCloudSetType type);
PointCloudSet();
~PointCloudSet();
//获取最大ID
//int static getMaxID();
//重置最大ID
//void static resetMaxID();
///设置ID谨慎调用
//void setID(int id) override;
///设置类型
void setType(PointCloudSetType t);
///获取类型
PointCloudSetType getSetType();
///获取颜色
QColor getColor();
//添加成员
void appendMember(int ker, int id);
//获取Kernal ID列表
QList<int> getKernals();
//根据kernal ID获取成员
QList<int> getKernalMembers(int k);
//获取数量
int getAllCount();
//临时保存MemberID当void setKeneralID(int id)时清空指定为Keneral为id的的子集
void appendTempMem(int m);
//设置Kenenal 与 void appendTempMem(int m)配合使用
void setKeneralID(int id);
//是否包含kernal
bool isContainsKernal(int id);
//设置可见性
void isVisible(bool v);
//获取可见性
bool isVisible();
//合并组件
void merge(PointCloudSet* set);
//减去组件
void cut(PointCloudSet* set);
//md5
void dataToStream(QDataStream* s) override;
//写出到XML文件
virtual QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override;
//从XML文件读取数据
virtual void readDataFromProjectFile(QDomElement* e) override;
//写出二进制文件
virtual void writeBinaryFile(QDataStream* dataStream);
//读入二进制文件
virtual void readBinaryFile(QDataStream* dataStream);
//生成可以显示的模型, 每个实例只能调用一次
virtual void generateDisplayDataSet();
//获取显示模型
virtual vtkDataSet* getDisplayDataSet();
//字符串转化为枚举
static PointCloudSetType stringToSettype(QString s);
//枚举转字符串
static QString setTypeToString(PointCloudSetType);
protected:
PointCloudSetType _type{ None };
bool _visible{ true };
QMultiHash<int, int> _members{}; //keneralID - node/elementID
QList<int> _tempMemberID{};
vtkDataSet* _displayDataSet{};
private:
// static int maxID;
};
//用于流体网格边界信息存储。边界由多个单元的一个或多个面组成。
class POINTCLOUDDATAAPI BoundPointCloudSet : public PointCloudSet
{
public:
BoundPointCloudSet();
~BoundPointCloudSet() = default;
void setCellFaces(const QMap<int, QVector<int>> cellFaces);
QMap<int, QVector<int>> getCellFaces();
protected:
//key为单元索引value为该单元的面索引
QMap<int, QVector<int>> m_CellFaces{};
};
}
#endif

View File

@ -1,341 +0,0 @@
#include "PointCloudSingleton.h"
#include "PointCloudKernal.h"
#include "PointCloudSet.h"
#include "PointCloudFactory.h"
#include <assert.h>
#include <QDataStream>
#include <QCryptographicHash>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNodeList>
#include <QFileInfo>
#include <QDebug>
namespace PointCloudData
{
PointCloudData* PointCloudData::_instance = nullptr;
PointCloudData* PointCloudData::getInstance()
{
if (_instance == nullptr)
{
_instance = new PointCloudData;
}
return _instance;
}
PointCloudData::~PointCloudData()
{
for (int i = 0; i < _pointcloudList.size(); ++i)
{
PointCloudKernal* k = _pointcloudList.at(i);
delete k;
}
_pointcloudList.clear();
}
void PointCloudData::appendPointCloudKernal(PointCloudKernal* keneral)
{
_pointcloudList.append(keneral);
}
int PointCloudData::getKernalCount()
{
return _pointcloudList.size();
}
PointCloudKernal* PointCloudData::getKernalAt(const int index)
{
if(index >= 0 && index < _pointcloudList.size())
return _pointcloudList.at(index);
return nullptr;
}
PointCloudKernal* PointCloudData::getKernalByID(const int id)
{
const int n = _pointcloudList.size();
for (int i = 0; i < n; ++i)
{
PointCloudKernal* k = _pointcloudList.at(i);
if (k->getID() == id)
return k;
}
return nullptr;
}
void PointCloudData::removeKernalAt(const int index)
{
PointCloudKernal* k = getKernalAt(index);
QList<PointCloudSet*> setlist{};
for (int i = 0; i < _setList.size(); ++i)
{
PointCloudSet* s = _setList.at(i);
// if (s->getDataSetID() == k->getID())
int kid = k->getID();
if (s->isContainsKernal(kid))
setlist.append(s);
}
for (int i = 0; i < setlist.size(); ++i)
{
PointCloudSet* s = setlist.at(i);
_setList.removeOne(s);
delete s;
}
delete k;
_pointcloudList.removeAt(index);
}
void PointCloudData::removeKernalByID(const int id)
{
auto k = this->getKernalByID(id);
int index = _pointcloudList.indexOf(k);
if (index < 0) return;
this->removeKernalAt(index);
}
void PointCloudData::clear()
{
int n = this->getKernalCount();
for (int i = 0; i < n; ++i)
{
PointCloudKernal* k = this->getKernalAt(i);
delete k;
}
_pointcloudList.clear();
n = _setList.size();
for (int i = 0; i < n; ++i)
{
PointCloudSet *s = _setList.at(i);
delete s;
}
_setList.clear();
PointCloudKernal::resetOffset();
DataProperty::ComponentBase::resetMaxID();
}
QString PointCloudData::getMD5()
{
const int n = _pointcloudList.size();
if (n < 1) return"";
QDataStream stream;
for (int i = 0; i < n; ++i)
{
_pointcloudList[i]->dataToStream(&stream);
}
for (auto set : _setList)
{
set->dataToStream(&stream);
}
char* s;
stream >> s;
QString md5 = QCryptographicHash::hash(s, QCryptographicHash::Md5);
return md5;
}
QDomElement& PointCloudData::writeToProjectFile(QDomDocument* doc, QDomElement* parent)
{
QDomElement meshNode = doc->createElement("PointCloud");
const int n = _pointcloudList.size();
QDomElement meshKernalList = doc->createElement("Kernel");
for (int i = 0; i < n; ++i)
{
PointCloudKernal* k = _pointcloudList.at(i);
k->writeToProjectFile(doc, &meshKernalList);
}
meshNode.appendChild(meshKernalList);
const int nset = _setList.size();
QDomElement setList = doc->createElement("Set");
for (int i = 0; i < nset; ++i)
{
PointCloudSet* s = _setList.at(i);
s->writeToProjectFile(doc, &setList);
}
meshNode.appendChild(setList);
parent->appendChild(meshNode);
return meshNode;
}
void PointCloudData::readFromProjectFile(QDomNodeList* nodelist)
{
QDomElement meshRoot = nodelist->at(0).toElement();
QDomNodeList meshList = meshRoot.elementsByTagName("PointCloudKernel");
const int nPointCloud = meshList.size();
for (int i = 0; i < nPointCloud; ++i)
{
QDomElement meshKernelEle = meshList.at(i).toElement();
{ //废弃代码
// QDomNodeList pathlist = meshKernelEle.elementsByTagName("Path");
// if (pathlist.size() != 1) continue;
// QDomElement pathele = pathlist.at(0).toElement();
// QString fpath = pathele.text();
// QFileInfo finfo(fpath);
// if (!finfo.exists()) return;
// QString suffix = finfo.suffix().toLower();
// if (suffix == "vtk" || suffix == "stl")
// {
// VTKdataExchange reader(fpath);
// if (!reader.read()) continue;
// }
// else if (suffix == "neu")
// {
// NEUdataExchange reader(fpath);
// if (!reader.read()) continue;
// }
}
PointCloudKernal* k = new PointCloudKernal;
_pointcloudList.append(k);
k->readDataFromProjectFile(&meshKernelEle);
}
QDomNodeList setList = meshRoot.elementsByTagName("PointCloudSet");
const int nSet = setList.size();
for (int i = 0; i < nSet; ++i)
{
PointCloudSet* s = nullptr;
QDomElement setEle = setList.at(i).toElement();
s = new PointCloudSet;
_setList.append(s);
s->readDataFromProjectFile(&setEle); //保存属性
// s->generateDisplayDataSet();
}
}
int PointCloudData::getIDByDataSet(vtkDataSet* datset)
{
const int n = _pointcloudList.size();
for (int i = 0; i < n; ++i)
{
PointCloudKernal* k = _pointcloudList.at(i);
vtkDataSet* s = k->getPointCloudData();
if (s == datset)
return k->getID();
}
return -1;
}
void PointCloudData::appendPointCloudSet(PointCloudSet* s)
{
_setList.append(s);
}
int PointCloudData::getPointCloudSetCount()
{
return _setList.size();
}
PointCloudSet* PointCloudData::getPointCloudSetAt(const int index)
{
assert(index >= 0 && index < _setList.size());
return _setList.at(index);
}
PointCloudSet* PointCloudData::getPointCloudSetByID(const int id)
{
const int n = _setList.size();
for (int i = 0; i < n; ++i)
{
PointCloudSet* set = _setList.at(i);
int sid = set->getID();
if (sid == id) return set;
}
return nullptr;
}
PointCloudSet* PointCloudData::getPointCloudSetByName(const QString name)
{
const int n = _setList.size();
for (int i = 0; i < n; ++i)
{
PointCloudSet* set = _setList.at(i);
QString n = set->getName();
if (name == n) return set;
}
return nullptr;
}
void PointCloudData::removePointCloudSetAt(const int index)
{
assert(index >= 0 && index < _setList.size());
PointCloudSet* s = _setList.at(index);
delete s;
_setList.removeAt(index);
}
QList<int> PointCloudData::getSetIDFromKernal(int kid)
{
QList<int> ids;
int n = _setList.size();
for (int i = 0; i < n; ++i)
{
PointCloudSet* set = _setList.at(i);
//int id = set->getDataSetID();
//if (id == kid)
if (set->isContainsKernal(kid))
ids.append(set->getID());
}
return ids;
}
bool PointCloudData::isContainsKernal(PointCloudKernal* ker)
{
return _pointcloudList.contains(ker);
}
void PointCloudData::generateDisplayDataSet()
{
const int n = this->getPointCloudSetCount();
for (int i = 0; i < n; ++i)
{
PointCloudSet* s = this->getPointCloudSetAt(i);
s->generateDisplayDataSet();
}
}
void PointCloudData::writeBinaryFile(QDataStream* dataStream)
{
//写出二进制文件
const int nk = _pointcloudList.size();
*dataStream << nk;
for (int i = 0; i < nk; ++i)
{
PointCloudKernal* k = _pointcloudList.at(i);
k->writePCDFile(dataStream);
}
const int ns = _setList.size();
*dataStream << ns;
for (int i = 0; i < ns; ++i)
{
PointCloudSet* s = _setList.at(i);
s->writeBinaryFile(dataStream);
}
}
void PointCloudData::readBinaryFile(QDataStream* dataStream)
{
//读入二进制文件
int nk = 0;
int ns = 0;
*dataStream >> nk;
for (int i = 0; i < nk; ++i)
{
PointCloudKernal* k = new PointCloudKernal;
_pointcloudList.append(k);
k->readBinaryFile(dataStream);
}
*dataStream >> ns;
for (int i = 0; i < ns; ++i)
{
int type = 0;
*dataStream >> type;
PointCloudSet* s = PointCloudFactory::CreatePointCloudSet(type);
// switch (type)
// {
// case 1:
// case 2: s = new PointCloudSet(QString(), SetType(type)); break;
// case 3: s = new CgnsFamily; break;
// case 4: s = new CgnsBCZone; break;
// default:break;
// }
if (s == nullptr) continue;
_setList.append(s);
s->readBinaryFile(dataStream);
}
}
}

View File

@ -22,37 +22,10 @@ include_directories(C:/PCL/include/pcl-1.14)
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)
# qscintilla2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src)
# lamptool
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include)
# qcustomplot
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot)
# qhexedit
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit)
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/SqliteDBProcess/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/modelProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/EchoShowProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/OCCViewer)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/PointCloudProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/SharedModuleLib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/TableProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/TaskXml)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
@ -62,26 +35,6 @@ link_directories("C:/PCL/3rdParty/FLANN/lib")
link_directories("C:/VTK/lib")
link_directories("C:/PCL/lib")
#
#-----------------------------------------------------------------------------
# include
#-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
file(GLOB _header "*.h")
file(GLOB _source "*.cpp")
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
add_library(PointCloudData
${_header}
${_source}
)
#-----------------------------------------------------------------------------
@ -109,52 +62,81 @@ include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
#-----------------------------------------------------------------------------
# include
#-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/WBCLFZSystemModule.qrc")
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/qianfan.qrc")
set(_lang "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/translations.qrc")
qt5_add_resources(_resource ${_qrc} ${_lang})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
file(GLOB_RECURSE _ui "*.ui")
file(GLOB_RECURSE _header "*.h" "*.hxx")
file(GLOB_RECURSE _source "*.cpp")
qt5_wrap_ui(_interface ${_ui})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
add_library(PointCloudOperator
${_resource}
${_interface}
${_header}
${_source}
)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
target_compile_definitions(PointCloudData PRIVATE "POINTCLOUDDATA_API")
#list(APPEND _depend_library qcustomplot LAMPTool qscintilla2 qhexedit)
target_compile_definitions(PointCloudOperator PRIVATE "POINTCLOUDOPERATORAPI_API")
list(APPEND _depend_library Common MeshData DataProperty )
list(APPEND _runtimes_libraries
Qt5::Widgets Qt5::Xml VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersStatistics VTK::FiltersVerdict VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ParallelCore VTK::ParallelDIY VTK::doubleconversion VTK::expat VTK::lz4 VTK::lzma VTK::sys VTK::verdict VTK::zlib
)
list(APPEND _runtimes_libraries
Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport
)
list(APPEND _runtimes_libraries
OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKCAF OpenCASCADE::TKCDF OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIGES OpenCASCADE::TKLCAF OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKVCAF OpenCASCADE::TKXCAF OpenCASCADE::TKXDEIGES OpenCASCADE::TKXSBase OpenCASCADE::TKernel Qt5::Widgets Qt5::Xml VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib VTK::IOGeometry
)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
target_link_libraries(PointCloudData PRIVATE
target_link_libraries(PointCloudOperator PRIVATE
${_runtimes_libraries}
${_depend_library}
${PCL_LIBRARIES}
DataProperty
Common
)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
add_dependencies(PointCloudData ${_depend_library} DataProperty)
add_dependencies(PointCloudOperator ${_depend_library} Common)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
set(LAMPCAE_PointCloudData_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)
set(LAMPCAE_PointCloudOperator_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -0,0 +1,114 @@
/**
* @file PCLConvertor.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/4
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include "PCLConvertor.h"
// pcl 相关
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp>
#include <iostream>
#include <pcl/console/time.h> // TicToc
#include <pcl/features/normal_3d.h>
#include <pcl/filters/bilateral.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/fast_bilateral.h>
#include <pcl/filters/fast_bilateral_omp.h>
#include <pcl/filters/passthrough.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h>
#include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <vector>
#include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h>
#include <sstream>
#include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h>
#include <vtkPLYReader.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>
#include <Eigen/Core>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/features/moment_of_inertia_estimation.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <string>
#include <vector>
#include <vtkAutoInit.h>
//可视化相关头文件
#include <vtkActor.h>
#include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
// Boost
#include <boost/math/special_functions/round.hpp>
// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
namespace PointCloudOperator {
PCLConvertor::PCLConvertor(QObject* parent)
: QObject(parent)
{
}
} // namespace PointCloudOperator

View File

@ -1,30 +1,19 @@
/*************************
1.
2.
*************************/
#ifndef POINTCLOUDKERNAL_H
#define POINTCLOUDKERNAL_H
/**
* @file PCLConvertor.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/4
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include "PointCloudDataAPI.h"
#include "DataProperty/DataBase.h"
#include <vtkSmartPointer.h>
#include <QString>
#include <QColor>
#include <QPair>
#ifndef LAMPCAE_PCLCONVERTOR_H
#define LAMPCAE_PCLCONVERTOR_H
#include "PointCloudOperatorAPI.h"
// qt 相关头文件
#include <QObject>
// Point Cloud Library
#include <QColorDialog>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/console/time.h>
#include <pcl/filters/convolution_3d.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/radius_outlier_removal.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/io/pcd_io.h>
// 常用pcl 头文件库
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
@ -95,6 +84,8 @@
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
@ -117,87 +108,43 @@
// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
#include "ModuleBase/ThreadControl.h"
class QDataStream;
namespace PointCloudOperator {
namespace PointCloudData
{
class POINTCLOUDDATAAPI PointCloudKernal : public DataProperty::DataBase
{
/*!
* pcl
*/
class POINTCLOUDOPERATORAPI PCLConvertor:public QObject {
Q_OBJECT
public:
PointCloudKernal();
~PointCloudKernal() = default;
//重置节点和单元的偏移量
static void resetOffset();
PCLConvertor(QObject* parent=nullptr);
~PCLConvertor() = default;
void setID(int id) override;
// int getID();
// QString getName();
// void setName(const QString &name);
//设置点云数据
void setPointCloudData(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr dataset);
//获取网格数据vtk表示
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr getPointCloudData();
//获取节点坐标
pcl::PointXYZRGBA getPointAt(const int index);
//是否可见
bool isVisible();
//设置可见状态
void setVisible(bool v);
//获取点云数目
int getPointCount();
void setPath(const QString& path);
QString getPath();
//标注维度
void setDimension(int d);
//获取维度
int getDimension();
void dataToStream(QDataStream* s) override;
//写xml
QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* ele) override;
//读xml
void readDataFromProjectFile(QDomElement* e) override;
//写出pcd 文件
void writePCDFile(const QString& datafilepath);
//读取pcd 文件
void readPCDFile(const QString& datafilepath);
//写出二进制文件
void writeBinaryFile(QDataStream* dataStream);
//读入二进制文件
void readBinaryFile(QDataStream* dataStream);
//设置点云属性
void setPointCloudSetting(DataProperty::DataBase* data);
//获取点云属性
DataProperty::DataBase* getPointCloudSetting();
//设置特有颜色
void setSpecificColor(bool enable ,QColor color);
void setSpecificColor(bool enable, std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t alpha= 255);
//获取特有颜色
QColor getSpecificColor(bool& enable);
private:
///设置节点ID偏移量为读入工程文件调用
void setPointIDOFfset(int offset); //
void UpdatePointCloudCloudColor();
private:
bool _visible{ true };
QString _path{};
int _pointIDOffset{ -1 }; //起始ID终止ID=起始ID+PointCloud.pointnum-1
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr _PointCloud{}; // 点云实体
int _dimension{ 3 };
QPair<bool, QColor> _specificColor;
DataProperty::DataBase* _PointCloudSetting{};// 点云的属性
private:
static int idOffset;
static int pointIDOffset; // 点云id
public:
template <typename PointT>
static bool PointCloudToVtkDataset(const pcl::PointCloud<PointT>& cloud, vtkDataSet* const pdata);
template <typename PointT>
static bool VtkDatasetToPointCloud(vtkDataSet* const pdata,const pcl::PointCloud<PointT>& cloud);
};
}
#endif
} // namespace PointCloudOperator
#endif // LAMPCAE_PCLCONVERTOR_H

View File

@ -0,0 +1,94 @@
/**
* @file PointCloudCommon.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/6
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include "PointCloudCommon.h"
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/features/normal_3d.h>
#include <pcl/common/concatenate.h>
namespace PointCloudOperator {
PointCloudCommon::PointCloudCommon(QObject* parent)
: QObject(parent)
{
}
void
PointCloudCommon::NormalEstimation(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in,
pcl::PointCloud<pcl::Normal>::Ptr normals)
{
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> n;
// pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>);
tree->setInputCloud(cloud_in);
n.setInputCloud(cloud_in);
n.setSearchMethod(tree);
n.setKSearch(10);
n.compute(*normals);
}
void
PointCloudCommon::NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_in,
pcl::PointCloud<pcl::Normal>::Ptr normals)
{
pcl::NormalEstimation<pcl::PointXYZRGBA, pcl::Normal> n;
pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGBA>);
tree->setInputCloud(cloud_in);
n.setInputCloud(cloud_in);
n.setSearchMethod(tree);
n.setKSearch(10);
n.compute(*normals);
}
void
PointCloudCommon::NormalEstimation(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud_in,
pcl::PointCloud<pcl::Normal>::Ptr normals)
{
pcl::NormalEstimation<pcl::PointXYZI, pcl::Normal> n;
pcl::search::KdTree<pcl::PointXYZI>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZI>);
tree->setInputCloud(cloud_in);
n.setInputCloud(cloud_in);
n.setSearchMethod(tree);
n.setKSearch(10);
n.compute(*normals);
}
Eigen::Vector3i PointCloudCommon::jetColorMap(float value,float min_intensity,float max_intensity)
{
float r = 0, g = 0, b = 0;
float normalized_value = (value - min_intensity) / (max_intensity - min_intensity);
if (normalized_value < 0.125) {
r = 0;
g = 0;
b = 0.5 + 4 * normalized_value;
} else if (normalized_value < 0.375) {
r = 0;
g = 4 * normalized_value - 0.5;
b = 1;
} else if (normalized_value < 0.625) {
r = 4 * normalized_value - 1.5;
g = 1;
b = 1.5 - 4 * normalized_value;
} else if (normalized_value < 0.875) {
r = 1;
g = 1.875 - 4 * normalized_value;
b = 0;
} else {
r = 1.75 - 4 * normalized_value;
g = 0;
b = 0;
}
return Eigen::Vector3i(static_cast<int>(255 * r), static_cast<int>(255 * g), static_cast<int>(255 * b));
}
} // namespace PointCloudOperator

View File

@ -1,24 +1,19 @@
/***************************
1.
**************************/
#ifndef POINTCLOUDDATA_H
#define POINTCLOUDDATA_H
/**
* @file PointCloudCommon.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/6
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include "PointCloudDataAPI.h"
#include <QList>
#include "DataProperty/DataBase.h"
// Point Cloud Library
#include <QColorDialog>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/console/time.h>
#include <pcl/filters/convolution_3d.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/radius_outlier_removal.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/io/pcd_io.h>
#ifndef LAMPCAE_POINTCLOUDCOMMON_H
#define LAMPCAE_POINTCLOUDCOMMON_H
#include "PointCloudOperatorAPI.h"
// qt 相关头文件
#include <QObject>
// 常用pcl 头文件库
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
@ -89,6 +84,8 @@
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
@ -115,82 +112,27 @@
class QDomDocument;
class QDomElement;
class QDomNodeList;
class QDataStream;
namespace PointCloudData
{
class PointCloudKernal;
class PointCloudSet;
namespace PointCloudOperator {
class POINTCLOUDDATAAPI PointCloudData : public DataProperty::DataBase
class POINTCLOUDOPERATORAPI PointCloudCommon:public QObject
{
Q_OBJECT
public:
//获取单例指针
static PointCloudData* getInstance();
//添加Kernal
void appendPointCloudKernal(PointCloudKernal* keneral);
//获取Kernal数量
int getKernalCount();
//获取第index个Kernal
PointCloudKernal* getKernalAt(const int index);
//通过ID获取Kernal
PointCloudKernal* getKernalByID(const int id);
//通过网格的数据表示获取Kernal ID
int getIDByDataSet(vtkDataSet* datset);
//移除第index个Kernal
void removeKernalAt(const int index);
//移除ID为i的Kernal
void removeKernalByID(const int id);
//添加组件
void appendPointCloudSet(PointCloudSet* s);
//获取组件数目
int getPointCloudSetCount();
//获取第index个组件
PointCloudSet* getPointCloudSetAt(const int index);
//通过ID获取网格组件
PointCloudSet* getPointCloudSetByID(const int id);
//通过名字获取组件,大小写敏感
PointCloudSet* getPointCloudSetByName(const QString name);
//移除第index个组件
void removePointCloudSetAt(const int index);
//获取与ID为kid的Kernal相关的全部组件ID
QList<int> getSetIDFromKernal(int kid);
/**
* @brief MeshKernal
* @param ker Kernal
* @return true
* @return false
*/
bool isContainsKernal(PointCloudKernal* ker);
/**
* @brief
*/
void clear();
QString getMD5();
///写出到工程文件
QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override;
//写出二进制文件
void writeBinaryFile(QDataStream* dataStream);
///从工程文件读入数据
void readFromProjectFile(QDomNodeList* nodelist);
//读入二进制文件
void readBinaryFile(QDataStream* dataFile);
///产生全部组件的显示模型
void generateDisplayDataSet();
PointCloudCommon(QObject* parent=nullptr);
~PointCloudCommon()=default;
public:
static void NormalEstimation(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals);
static void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals);
static void NormalEstimation(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals);
// Jet 色带颜色映射函数
static Eigen::Vector3i jetColorMap(float value,float min_intensity,float max_intensity);
private:
PointCloudData() = default;
~PointCloudData();
private:
static PointCloudData* _instance;
QList<PointCloudKernal*> _pointcloudList{};
QList<PointCloudSet*> _setList{};
};
} // namespace PointCloudOperator
}
#endif
#endif // LAMPCAE_POINTCLOUDCOMMON_H

View File

@ -0,0 +1,25 @@
/**
* @file PointCloudFilter.cpp
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/4
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#include "PointCloudFilter.h"
#include <pcl/filters/convolution_3d.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/radius_outlier_removal.h>
#include <pcl/filters/statistical_outlier_removal.h>
namespace PointCloudOperator {
PointCloudFilter::PointCloudFilter(QObject* parent)
: QObject(parent)
{
}
} // namespace PointCloudOperator

View File

@ -0,0 +1,128 @@
/**
* @file PointCloudFilter.h
* @brief
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/4
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_POINTCLOUDFILTER_H
#define LAMPCAE_POINTCLOUDFILTER_H
// qt 相关头文件
#include <QObject>
// 常用pcl 头文件库
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp>
#include <iostream>
#include <pcl/console/time.h> // TicToc
#include <pcl/features/normal_3d.h>
#include <pcl/filters/bilateral.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/fast_bilateral.h>
#include <pcl/filters/fast_bilateral_omp.h>
#include <pcl/filters/passthrough.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h>
#include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <vector>
#include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h>
#include <sstream>
#include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h>
#include <vtkPLYReader.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>
#include <Eigen/Core>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/features/moment_of_inertia_estimation.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <string>
#include <vector>
#include <vtkAutoInit.h>
//可视化相关头文件
#include <vtkActor.h>
#include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
// Boost
#include <boost/math/special_functions/round.hpp>
// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
#include "PointCloudOperatorAPI.h"
namespace PointCloudOperator {
class POINTCLOUDOPERATORAPI PointCloudFilter :public QObject
{
Q_OBJECT
public:
PointCloudFilter(QObject* parent=nullptr);
~PointCloudFilter()=default;
public:
};
} // namespace PointCloudOperator
#endif // LAMPCAE_POINTCLOUDFILTER_H

View File

@ -0,0 +1,13 @@
#ifndef _POINTCLOUDOPERATORAPI_H__
#define _POINTCLOUDOPERATORAPI_H__
#include <QtCore/QtGlobal>
#if defined(POINTCLOUDOPERATORAPI_API)
#define POINTCLOUDOPERATORAPI Q_DECL_EXPORT
#else
#define POINTCLOUDOPERATORAPI Q_DECL_IMPORT
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More