#include "QSimulationBPImageMultiProduction.h" #include #include #include "TBPImageAlgCls.h" #include "EchoDataFormat.h" #include #include #include "ui_QSimulationBPImageMultiProduction.h" #include "ImageNetOperator.h" QSimulationBPImageMultiProduction::QSimulationBPImageMultiProduction(QWidget *parent) : QDialog(parent),ui(new Ui::QSimulationBPImageMultiProductionClass) { ui->setupUi(this); QObject::connect(ui->pushButtonEchoSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoSelectClicked())); QObject::connect(ui->LookTableBtn, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableBtnClicked())); QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetBtnSelectClicked())); QObject::connect(ui->L1ASelectBtn, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelectBtnClicked())); QObject::connect(ui->L2SelectSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL2SelectSelectClicked())); QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted())); QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected())); } QSimulationBPImageMultiProduction::~QSimulationBPImageMultiProduction() {} void QSimulationBPImageMultiProduction::onpushButtonEchoSelectClicked() { QString fileNames = QFileDialog::getOpenFileName( this, // 父窗口 tr(u8"选择影像文件"), // 标题 QString(), // 默认路径 tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器 ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { QString message = "选择的文件有:\n"; this->ui->lineEditEchoPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); } } void QSimulationBPImageMultiProduction::onpushButtonLookTableBtnClicked() { QString fileNames = QFileDialog::getOpenFileName( this, // 父窗口 tr(u8"选择查找表文件"), // 标题 QString(), // 默认路径 tr(u8"All Files(*)") // 文件过滤器 ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { this->ui->lineEditLookTablePath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); } } void QSimulationBPImageMultiProduction::onpushButtonGridNetBtnSelectClicked() { QString fileNames = QFileDialog::getOpenFileName( this, // 父窗口 tr(u8"选择成像网格文件"), // 标题 QString(), // 默认路径 tr(u8"All Files(*)") // 文件过滤器 ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { this->ui->lineEditImageNetPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); } } void QSimulationBPImageMultiProduction::onpushButtonL1ASelectBtnClicked() { QString fileNames = QFileDialog::getSaveFileName( this, // 父窗口 tr(u8"选择影像文件"), // 标题 QString(), // 默认路径 tr(u8"All Files(*)") // 文件过滤器 ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { this->ui->lineEditL1AProductionPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); } } void QSimulationBPImageMultiProduction::onpushButtonL2SelectSelectClicked() { QString fileNames = QFileDialog::getSaveFileName( this, // 父窗口 tr(u8"选择影像文件"), // 标题 QString(), // 默认路径 tr(u8"All Files(*)") // 文件过滤器 ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { this->ui->lineEditL2ProductionPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); } } void QSimulationBPImageMultiProduction::onbtnaccepted() { QString L1ADataPath = this->ui->lineEditL1AProductionPath->text().trimmed(); QString L2DataPath = this->ui->lineEditL2ProductionPath->text().trimmed(); QString looktablePath = this->ui->lineEditLookTablePath->text().trimmed(); QString imgNetPath = this->ui->lineEditImageNetPath->text().trimmed(); QString echoDataPath = this->ui->lineEditEchoPath->text().trimmed(); this->hide(); QString echofile = echoDataPath; QString outImageFolder = getParantFromPath(L2DataPath); QString imagename = getFileNameFromPath(L2DataPath); std::shared_ptr echoL0ds(new EchoL0Dataset); echoL0ds->Open(echofile); std::shared_ptr< SARSimulationImageL1Dataset> imagL1(new SARSimulationImageL1Dataset); imagL1->setCenterAngle(echoL0ds->getCenterAngle()); imagL1->setCenterFreq(echoL0ds->getCenterFreq()); imagL1->setNearRange(echoL0ds->getNearRange()); imagL1->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2); imagL1->setFarRange(echoL0ds->getFarRange()); imagL1->setFs(echoL0ds->getFs()); imagL1->setLookSide(echoL0ds->getLookSide()); gdalImage imgxyzimg(imgNetPath); imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width); qDebug() << u8"成像中"; TBPImageAlgCls TBPimag; TBPimag.setEchoL0(echoL0ds); TBPimag.setImageL1(imagL1); long cpucore_num = std::thread::hardware_concurrency(); TBPimag.setGPU(true); TBPimag.ProcessWithGridNet(cpucore_num, imgNetPath); qDebug() << u8"系统几何校正中"; ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1ADataPath); this->show(); QMessageBox::information(this,u8"成像",u8"成像结束"); } void QSimulationBPImageMultiProduction::onbtnrejected() { this->close(); }