Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dftarea.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -252,6 +252,8 @@ cv::Mat DFTArea::grayComplexMatfromImage(QImage &img){

double pixelsPermm =(igramArea->m_outside.m_radius/(md.diameter/2.));
double reduction = md.aperatureReduction * pixelsPermm;
if (md.m_aperatureReductionEnabled == false)
reduction = 0;

double rad = igramArea->m_outside.m_radius - reduction;

Expand Down
84 changes: 3 additions & 81 deletions igramarea.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -152,6 +152,8 @@ void IgramArea::computeEdgeRadius(){
mirrorDlg &md = *mirrorDlg::get_Instance();
double pixelsPermm =(m_outside.m_radius/(md.diameter/2.));
m_edgeMaskWidth = md.aperatureReduction * pixelsPermm;
if (md.m_aperatureReductionEnabled == false)
m_edgeMaskWidth = 0;

}

Expand DownExpand Up@@ -2140,45 +2142,6 @@ void IgramArea::loadOutlineFile(QString fileName){
emit dftCenterFilter(filter);


// edge mask
const QJsonValue jedge = loadDoc["edge_mask_width_mm"];
mirrorDlg &md = *mirrorDlg::get_Instance();
if (jedge.isDouble()) {
const double edge = jedge.toDouble();
// if outline edge mask is different than current ask user
if (edge != md.aperatureReduction){
QString text(
"Do you want to change the mirror config value to match the value in the outline file?\n"
"If no then the current mirror config value will be used instead."
);

QMessageBox mb;
mb.setText(QString("Edge mask value in outline file for this interferogram is %1 and is different than mirror config value of %2.").arg(
edge, 6, 'f', 1).arg(md.aperatureReduction, 6, 'f', 1) );
mb.setInformativeText(text);
mb.setStandardButtons( QMessageBox::Yes|QMessageBox::No );
mb.setWindowTitle("Existing Interferogram outline file and Mirror Config difference.");
int width = QGuiApplication::primaryScreen()->geometry().width() * .5;
QSpacerItem* horizontalSpacer = new QSpacerItem(width, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = (QGridLayout*)mb.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
int resp = mb.exec();

switch (resp){
case QMessageBox::Yes:
md.changeEdgeMaskvalues(edge);

break;
case QMessageBox::No:
default: // if they click red X do same thing as "no" button
md.changeEdgeMaskvalues(md.aperatureReduction);
break;
}
}
}
else{ // just enable edge mask check box to use the current value.
md.changeEdgeMaskvalues(md.aperatureReduction);

@gr5gr5Nov 22, 2023

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this line of code (line 2180 just above) is particularly nasty and found when reading OLN file: both the older V6 style OLN file and also when reading V7. It checks the "edge mask" checkbox even if nothing is found regarding edge mask in the OLN file!

Not only did I get rid of the above code in both "writeOLN" functions, I got rid of the entire function (which is where it checks the box in the gui). That function, changeEdgeMaskvalue(), was used in many places when reading OLN files but nowhere else. So I got rid of it.

}

// mask polygons regions
m_polygons.clear();
Expand DownExpand Up@@ -2257,40 +2220,7 @@ void IgramArea::loadOutlineFileOldV6(QString fileName){
mirrorDlg &md = *mirrorDlg::get_Instance();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be deleted as md is not used anymore. This will fix the [-Wunused-variable]

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. Already merged. Didn't see your comment until now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can fix in the other PR. It's really minor.
This is how dead code comes to live 👻

if (line == "Edge Mask width"){
std::getline(file,line);
double edge = QString::fromStdString(line).toDouble();
// if outline edge mask is different than current ask user
if (edge != md.aperatureReduction){
QString text(
"Do you want to change the mirror config value to match the value in the outline file?\n"
"If no then the current mirror config value will be used instead."
);

QMessageBox mb;
mb.setText(QString("Edge mask value in outline file for this interferogram is %1 and is different than mirror config value of %2.").arg(
edge, 6, 'f', 1).arg(md.aperatureReduction, 6, 'f', 1) );
mb.setInformativeText(text);
mb.setStandardButtons( QMessageBox::Yes|QMessageBox::No );
mb.setWindowTitle("Existing Interferogram outline file and Mirror Config difference.");
int width = QGuiApplication::primaryScreen()->geometry().width() * .5;
QSpacerItem* horizontalSpacer = new QSpacerItem(width, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = (QGridLayout*)mb.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
int resp = mb.exec();

switch (resp){
case QMessageBox::Yes:
md.changeEdgeMaskvalues(edge);

break;
case QMessageBox::No:
md.changeEdgeMaskvalues(md.aperatureReduction);
break;
}
}

}
else{ // just enable edge mask check box to use the current value.
md.changeEdgeMaskvalues(md.aperatureReduction);
}
}

Expand DownExpand Up@@ -2370,10 +2300,7 @@ void IgramArea::writeOutlinesOldV6(QString fileName){
}
}
saveRegions(); // save regions to registry also
if (m_edgeMaskWidth != 0){
mirrorDlg &md = *mirrorDlg::get_Instance();
file << "\nEdge Mask width" << std::endl << md.aperatureReduction << std::endl;
}


file.flush();
file.close();
Expand DownExpand Up@@ -2404,11 +2331,6 @@ void IgramArea::writeOutlines(QString fileName){
double filterRad = set.value("DFT Center Filter",10).toDouble();
j1["dft_filter_radius"]=filterRad;

if (m_edgeMaskWidth != 0) {
mirrorDlg &md = *mirrorDlg::get_Instance();
j1["edge_mask_width_mm"] = md.aperatureReduction;
}

QJsonArray jRegions;
for (int i = 0; i < m_polygons.size(); ++ i){
if (m_polygons[i].size() > 0){
Expand Down
9 changes: 2 additions & 7 deletions mirrordlg.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -600,6 +600,8 @@ void mirrorDlg::on_buttonBox_helpRequested()
void mirrorDlg::setclearAp(){

m_clearAperature = (diameter - aperatureReduction * 2) ;
if (m_aperatureReductionEnabled == false)
m_clearAperature = diameter;
ui->ClearAp->setText(QString("%1 ").arg(m_clearAperature * ((mm) ? 1: 1./25.4), 6, 'f', 2));
}

Expand All@@ -625,13 +627,6 @@ void mirrorDlg::on_ReducApp_clicked(bool checked)
}


void mirrorDlg::changeEdgeMaskvalues(double val){
m_aperatureReductionEnabled = true;
ui->ReducApp->setChecked(true);
ui->reduceValue->setValue(val);
ui->reduceValue->setEnabled(true);

}
void mirrorDlg::on_reduceValue_valueChanged(double arg1)
{
aperatureReduction = ((mm) ? 1: 25.4) * arg1;
Expand Down
1 change: 0 additions & 1 deletion mirrordlg.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,6 @@ class mirrorDlg : public QDialog
outlineShape m_outlineShape;
bool isEllipse();
void setMinorAxis(double val);
void changeEdgeMaskvalues(double val);
bool m_aperatureReductionEnabled;
private slots:
void on_ReadBtn_clicked();
Expand Down