增加输入成像平面代码

pull/6/head
陈增辉 2025-03-03 11:44:03 +08:00
parent 94fd13bac8
commit 84f1ac6a5c
5 changed files with 110 additions and 9 deletions

View File

@ -17,6 +17,10 @@ QSimulationBPImage::QSimulationBPImage(QWidget *parent)
QObject::connect(ui->pushButtonImageSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageSelectClicked()));
QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted()));
QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected()));
QObject::connect(ui->checkBox, SIGNAL(stateChanged(int)), this, SLOT(oncheckboxTrigged(int)));
}
@ -84,7 +88,13 @@ void QSimulationBPImage::onbtnaccepted()
TBPimag.setImageL1(imagL1);
long cpucore_num = std::thread::hardware_concurrency();
TBPimag.setGPU(true);
TBPimag.Process(cpucore_num);
if (ui->checkBox->isChecked()) {
TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed());
}
else {
TBPimag.Process(cpucore_num);
}
QMessageBox::information(this,u8"成像",u8"成像结束");
}
@ -93,3 +103,28 @@ void QSimulationBPImage::onbtnrejected()
{
this->close();
}
void QSimulationBPImage::oncheckboxTrigged(int)
{
this->ui->lineEdit->setEnabled(this->ui->checkBox->isChecked());
this->ui->GridNetBtn->setEnabled(this->ui->checkBox->isChecked());
}
void QSimulationBPImage::onpushButtonGridNetSelectClicked( )
{
QString fileNames = QFileDialog::getSaveFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"All Files(*);;dat(*.dat);;tif(*.tif);;tiff(*.tiff)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileNames.isEmpty()) {
this->ui->lineEdit->setText(fileNames);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}

View File

@ -23,6 +23,9 @@ public slots:
void onbtnaccepted();
void onbtnrejected();
void oncheckboxTrigged(int);
void onpushButtonGridNetSelectClicked( );
private:
Ui::QSimulationBPImageClass* ui;
};

View File

@ -65,6 +65,60 @@
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>图像网格</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="GridNetBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">

View File

@ -215,10 +215,14 @@ ErrorCode TBPImageAlgCls::Process(long num_thread)
qDebug() << u8"创建成像平面的XYZ";
QString outRasterXYZ = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_xyz.bin");
CreatePixelXYZ(this->L0ds, outRasterXYZ);
this->outRasterXYZPath = outRasterXYZ;
return this->ProcessWithGridNet(num_thread, outRasterXYZ);
}
qDebug() << u8"频域回波-> 时域回波";
ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPath)
{
this->outRasterXYZPath = xyzRasterPath;
qDebug() << u8"频域回波-> 时域回波";
this->TimeEchoDataPath = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_Timeecho.bin");
this->EchoFreqToTime();
@ -227,8 +231,8 @@ ErrorCode TBPImageAlgCls::Process(long num_thread)
long imageheight = this->L1ds->getrowCount();
long imagewidth = this->L1ds->getcolCount();
long blokline = Memory1GB / 8 / 4 / imageheight * 32;
long blokline = Memory1GB / 8 / 4 / imageheight * 32;
blokline = blokline < 1000 ? 1000 : blokline;
long startline = 0;
@ -237,16 +241,16 @@ ErrorCode TBPImageAlgCls::Process(long num_thread)
if (startline + templine >= imageheight) {
templine = imageheight - startline;
}
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startline << "\t-\t" << startline + templine << " / " << imageheight ;
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startline << "\t-\t" << startline + templine << " / " << imageheight;
std::shared_ptr<std::complex<double>> imageRaster = this->L1ds->getImageRaster(startline, templine);
for (long i = 0; i < templine; i++) {
for (long j = 0; j < imagewidth; j++) {
imageRaster.get()[i * imagewidth + j] = std::complex<double>(0,0);
imageRaster.get()[i * imagewidth + j] = std::complex<double>(0, 0);
}
}
this->L1ds->saveImageRaster(imageRaster, startline,templine);
this->L1ds->saveImageRaster(imageRaster, startline, templine);
}
@ -256,12 +260,16 @@ ErrorCode TBPImageAlgCls::Process(long num_thread)
return this->ProcessGPU();
}
else {
QMessageBox::information(nullptr,u8"提示",u8"目前只支持显卡");
QMessageBox::information(nullptr, u8"提示", u8"目前只支持显卡");
return ErrorCode::FAIL;
}
return ErrorCode::SUCCESS;
}
ErrorCode TBPImageAlgCls::ProcessGPU()
{
// 常用参数

View File

@ -51,6 +51,7 @@ public:
public:
ErrorCode Process(long num_thread);
ErrorCode ProcessWithGridNet(long num_thread,QString xyzRasterPath);
void setGPU(bool flag);
bool getGPU( );
private: