补充完dB转线性值工具
parent
d72d2a366a
commit
7e5d390934
|
|
@ -1,10 +1,122 @@
|
||||||
|
#include <QFile>
|
||||||
#include "QtLinearToIntenisityDialog.h"
|
#include "QtLinearToIntenisityDialog.h"
|
||||||
|
#include <QtWidgets>
|
||||||
|
#include "ImageOperatorBase.h"
|
||||||
|
#include "ui_QtLinearToIntenisityDialog.h"
|
||||||
|
|
||||||
|
|
||||||
QtLinearToIntenisityDialog::QtLinearToIntenisityDialog(QWidget* parent)
|
QtLinearToIntenisityDialog::QtLinearToIntenisityDialog(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent), ui(new Ui::QtLinearToIntenisityDialogClass)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
connect(ui->pushButtonInRaster, SIGNAL(clicked(bool)), this, SLOT(On_pushButtonInRasterTriggled()));
|
||||||
|
connect(ui->pushButtonSave, SIGNAL(clicked(bool)), this, SLOT(On_pushButtonSaveTriggled()));
|
||||||
|
connect(ui->radioButtonIntenisty, SIGNAL(clicked(bool)), this, SLOT(On_radioButtonIntenistyTriggled()));
|
||||||
|
connect(ui->radioButtonAmp, SIGNAL(clicked(bool)), this, SLOT(On_radioButtonAmpTriggled()));
|
||||||
|
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted()));
|
||||||
|
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QtLinearToIntenisityDialog::~QtLinearToIntenisityDialog()
|
QtLinearToIntenisityDialog::~QtLinearToIntenisityDialog()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::On_pushButtonInRasterTriggled()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(
|
||||||
|
this, // 父窗口
|
||||||
|
tr(u8"选择影像"), // 标题
|
||||||
|
QString(), // 默认路径
|
||||||
|
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
|
||||||
|
);
|
||||||
|
|
||||||
|
// 如果用户选择了文件
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
|
this->ui->InputRasterLineEdit->setText(fileName);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::On_pushButtonSaveTriggled()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(
|
||||||
|
this, // 父窗口
|
||||||
|
tr(u8"选择影像"), // 标题
|
||||||
|
QString(), // 默认路径
|
||||||
|
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
|
||||||
|
);
|
||||||
|
|
||||||
|
// 如果用户选择了文件
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
|
this->ui->OutputRasterLineEdit->setText(fileName);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::On_radioButtonIntenistyTriggled()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::On_radioButtonAmpTriggled()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::onbtnaccepted()
|
||||||
|
{
|
||||||
|
this->hide();
|
||||||
|
QString inputRaster = this->ui->InputRasterLineEdit->text();
|
||||||
|
QString outputRaster = this->ui->OutputRasterLineEdit->text();
|
||||||
|
// 复制 inputRaster 到 outputRaster,如果存在就覆盖
|
||||||
|
QFile::copy(inputRaster, outputRaster);
|
||||||
|
|
||||||
|
|
||||||
|
gdalImage img(outputRaster);
|
||||||
|
long rowblock = Memory1GB / img.width / 8 * 2;
|
||||||
|
ui->progressBar->setMaximum(img.height);
|
||||||
|
ui->progressBar->setValue(0);
|
||||||
|
for (long rid = 0; rid < img.height; rid = rid + rowblock)
|
||||||
|
{
|
||||||
|
for (long bid = 0; bid < img.band_num; bid++)
|
||||||
|
{
|
||||||
|
Eigen::MatrixXd data = img.getData(rid, 0, rowblock, img.width, bid);
|
||||||
|
|
||||||
|
for (long i = 0; i < data.rows(); i++)
|
||||||
|
{
|
||||||
|
for (long j = 0; j < data.cols(); j++)
|
||||||
|
{
|
||||||
|
if (ui->radioButtonAmp->isChecked())
|
||||||
|
{
|
||||||
|
data(i, j) = std::pow(10.0,data(i,j)/20.0);
|
||||||
|
}
|
||||||
|
else if (ui->radioButtonIntenisty->isChecked())
|
||||||
|
{
|
||||||
|
data(i, j) = std::pow(10.0, data(i, j) / 10.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
img.saveImage(data, rid, 0, bid);
|
||||||
|
}
|
||||||
|
ui->progressBar->setValue(rid);
|
||||||
|
|
||||||
|
}
|
||||||
|
ui->progressBar->setValue(img.height);
|
||||||
|
|
||||||
|
QMessageBox::information(this, tr(u8"提示"), tr(u8"completed!!!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtLinearToIntenisityDialog::onbtnrejected()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "ui_QtLinearToIntenisityDialog.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class QtLinearToIntenisityDialogClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class QtLinearToIntenisityDialog : public QDialog
|
class QtLinearToIntenisityDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
|
@ -11,6 +18,14 @@ public:
|
||||||
QtLinearToIntenisityDialog(QWidget *parent = nullptr);
|
QtLinearToIntenisityDialog(QWidget *parent = nullptr);
|
||||||
~QtLinearToIntenisityDialog();
|
~QtLinearToIntenisityDialog();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void On_pushButtonInRasterTriggled();
|
||||||
|
void On_pushButtonSaveTriggled();
|
||||||
|
void On_radioButtonIntenistyTriggled();
|
||||||
|
void On_radioButtonAmpTriggled();
|
||||||
|
void onbtnaccepted();
|
||||||
|
void onbtnrejected();
|
||||||
private:
|
private:
|
||||||
Ui::QtLinearToIntenisityDialogClass ui;
|
Ui::QtLinearToIntenisityDialogClass* ui;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1036,16 +1036,16 @@ void test_double32() {
|
||||||
|
|
||||||
/** 性能测试************************************************************************/
|
/** 性能测试************************************************************************/
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
//int main(int argc, char* argv[]) {
|
||||||
|
//
|
||||||
QApplication a(argc, argv);
|
// QApplication a(argc, argv);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
//testSimualtionEchoPoint();
|
// //testSimualtionEchoPoint();
|
||||||
//testSimualtionEchoPoint_singleRFPC_doubleImage();
|
// //testSimualtionEchoPoint_singleRFPC_doubleImage();
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue