diff --git a/IgramArea.h b/IgramArea.h
index f53886f6..0b80ffe5 100644
--- a/IgramArea.h
+++ b/IgramArea.h
@@ -223,6 +223,7 @@ public slots:
cv::Point2d findBestCenterOutline(cv::Mat gray, int start, int end, int step, double &resp, int *radius, bool useExisting);
QString m_outlineMsg;
double m_edgeMaskWidth;
+ void saveRegions();
public:
void deleteRegions();
cv::Point2d findBestOutsideOutline(cv::Mat gray, int start, int end, int step, double &resp, int *radius, int pass);
diff --git a/foucaultview.ui b/foucaultview.ui
index 5f9f16f9..17bb3a7e 100644
--- a/foucaultview.ui
+++ b/foucaultview.ui
@@ -479,10 +479,10 @@
1
- 1.000000000000000
+ -20.000000000000000
- 10.000000000000000
+ 20.000000000000000
0.500000000000000
diff --git a/igramarea.cpp b/igramarea.cpp
index 06fa1a90..068f54fd 100644
--- a/igramarea.cpp
+++ b/igramarea.cpp
@@ -26,7 +26,7 @@
#include
#include
-#include
+#include
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "graphicsutilities.h"
@@ -150,6 +150,7 @@ void IgramArea::computeEdgeRadius(){
mirrorDlg &md = *mirrorDlg::get_Instance();
double pixelsPermm =(m_outside.m_radius/(md.diameter/2.));
m_edgeMaskWidth = md.aperatureReduction * pixelsPermm;
+
}
void IgramArea::aperatureChanged(){
@@ -1696,8 +1697,9 @@ void IgramArea::drawBoundary()
painter.setBrush(Qt::NoBrush);
}
outside.draw(painter,1.,s2);
- if (md.m_clearAperature != md.diameter){
+ if ( md.m_aperatureReductionEnabled && md.m_clearAperature != md.diameter){
painter.setPen(QPen(edgePenColor, edgePenWidth, Qt::DotLine));
+ computeEdgeRadius();
painter.drawEllipse(outside.m_center,
outside.m_radius - m_edgeMaskWidth,
outside.m_radius- m_edgeMaskWidth);
@@ -1958,6 +1960,21 @@ void IgramArea::paintEvent(QPaintEvent *event)
+}
+void IgramArea::saveRegions(){
+ QString text;
+ QTextStream regions(&text);
+
+ for (int i = 0; i < m_polygons.size(); ++i){
+ regions << "Poly";
+ for(int j = 0; j < m_polygons[i].size(); ++j){
+ regions << " " << QString().number(m_polygons[i][j].x) << ","<<
+ QString().number(m_polygons[i][j].y);
+ }
+ regions << "\n";
+ }
+ QSettings set;
+ set.setValue("lastRegions", text);
}
void IgramArea::createActions()
@@ -1986,7 +2003,7 @@ void IgramArea::crop() {
set.setValue("lastOutsideRad", radx);
set.setValue("lastOutsideCx",cx);
set.setValue("lastOutsideCy",cy);
-qDebug() << "crop saving" << cx << cy << radx;
+
int width = igramGray.width();
int height = igramGray.height();
int right = width - (radx + cx);
@@ -2018,19 +2035,16 @@ qDebug() << "crop saving" << cx << cy << radx;
x = igramGray.width()/2;
y = igramGray.height()/2;
- QString text;
- QTextStream regions(&text);
+
for (int i = 0; i < m_polygons.size(); ++i){
- regions << "Poly";
for(int j = 0; j < m_polygons[i].size(); ++j){
- regions << " " << QString().number(m_polygons[i][j].x) << ","<<
- QString().number(m_polygons[i][j].y);
m_polygons[i][j].x -=crop_dx;
m_polygons[i][j].y -= crop_dy;
}
- regions << "\n";
+
}
- set.setValue("lastRegions", text);
+ saveRegions();
+
m_outside.translate(QPointF(-crop_dx,-crop_dy));
cx = m_outside.m_center.x() + crop_dx;
cy = m_outside.m_center.y() + crop_dy;
@@ -2100,7 +2114,7 @@ void IgramArea::loadOutlineFile(QString fileName){
fsize = file.tellg() - fsize;
file.close();
file.open(fileName.toStdString().c_str());
- qDebug() << "ouline opened";
+
if (!file.is_open()) {
QMessageBox::warning(this, tr("Read Outline"),
tr("Cannot read file %1: ")
@@ -2109,11 +2123,16 @@ void IgramArea::loadOutlineFile(QString fileName){
}
m_outside = readCircle(file);
+ m_OutterP1 = m_outside.m_p1.m_p;
+ m_OutterP2 = m_outside.m_p2.m_p;
+ outterPcount = 2;
CircleOutline sideLobe = readCircle(file);
emit dftCenterFilter(sideLobe.m_radius);
+ char b = file.peek();
+
if ((file.tellg() > 0) && (fsize > file.tellg())) {
- if (file.peek() != 'P'){
+ if ((b != 'P') && (b != 'E')){
m_center = readCircle(file);
m_innerP1 = m_center.m_p1.m_p;
m_innerP2 = m_center.m_p2.m_p;
@@ -2140,10 +2159,46 @@ void IgramArea::loadOutlineFile(QString fileName){
}
}
+ mirrorDlg &md = *mirrorDlg::get_Instance();
+ 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().sprintf("Edge mask value in outline file for this interferogram is %6.1lf and is different than mirror config value of %6.1lf.",
+ edge, md.aperatureReduction) );
+ mb.setInformativeText(text);
+ mb.setStandardButtons( QMessageBox::Yes|QMessageBox::No );
+ mb.setWindowTitle("Existing Interferogram outline file and Mirror Config difference.");
+ int width = QGuiApplication::screens()[0]->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);
+ }
}
- m_OutterP1 = m_outside.m_p1.m_p;
- m_OutterP2 = m_outside.m_p2.m_p;
- outterPcount = 2;
+
if (!igramGray.isNull()){
computeEdgeRadius();
drawBoundary();
@@ -2213,6 +2268,11 @@ void IgramArea::writeOutlines(QString fileName){
file << std::endl;
}
}
+ if (m_edgeMaskWidth != 0){
+ mirrorDlg &md = *mirrorDlg::get_Instance();
+ file << "\nEdge Mask width" << std::endl << md.aperatureReduction << std::endl;
+ }
+
file.flush();
file.close();
@@ -2248,6 +2308,7 @@ void IgramArea::deleteOutline(){
}
m_polygons.clear();
syncRegions();
+ saveRegions();
}
else if (m_current_boundry == CenterOutline){
m_centerHist.clear();
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 93a2f4f9..4f125b3d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -62,17 +62,17 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
-qDebug() << "here";
-const QString toolButtonStyle("QToolButton {"
- "border-style: outset;"
- "border-width: 3px;"
- "border-radius:7px;"
- "border-color: darkgray;"
- "font: bold 12px;"
- "min-width: 10em;"
- "padding: 6px;}"
- "QToolButton:hover {background-color: lightblue;"
- " }");
+
+ const QString toolButtonStyle("QToolButton {"
+ "border-style: outset;"
+ "border-width: 3px;"
+ "border-radius:7px;"
+ "border-color: darkgray;"
+ "font: bold 12px;"
+ "min-width: 10em;"
+ "padding: 6px;}"
+ "QToolButton:hover {background-color: lightblue;"
+ " }");
QWidget *rw = ui->toolBar->widgetForAction(ui->actionRead_WaveFront);
//igramArea = new IgramArea(ui->tabWidget->widget(0));
diff --git a/mirrordlg.cpp b/mirrordlg.cpp
index e321c1e2..01c302c4 100644
--- a/mirrordlg.cpp
+++ b/mirrordlg.cpp
@@ -44,6 +44,7 @@ mirrorDlg::mirrorDlg(QWidget *parent) :
ui->nullCB->setChecked(doNull);
diameter = settings.value("config diameter", 200.).toDouble();
aperatureReduction = settings.value("config aperatureReduction", 0.).toDouble();
+ m_aperatureReductionEnabled = settings.value("configAperatureReductionChecked",false).toBool();
roc = settings.value("config roc", 2000.).toDouble();
FNumber = roc/(2. * diameter);
@@ -53,6 +54,7 @@ mirrorDlg::mirrorDlg(QWidget *parent) :
ui->cc->blockSignals(true);
ui->unitsCB->blockSignals(true);
ui->fringeSpacingEdit->blockSignals(true);
+
if (!doNull){
ui->roc->hide();
ui->rocLab->hide();
@@ -76,10 +78,14 @@ mirrorDlg::mirrorDlg(QWidget *parent) :
cc = settings.value("config cc", -1.).toDouble();
ui->cc->setText(QString().sprintf("%6.2lf",cc));
- ui->reduceValue->setValue(aperatureReduction);
- if (aperatureReduction > 0)
+
+ ui->ReducApp->setChecked( m_aperatureReductionEnabled);
+ if ( m_aperatureReductionEnabled)
ui->reduceValue->setEnabled(true);
+ ui->reduceValue->setValue(aperatureReduction);
+
+
ui->unitsCB->setChecked(mm);
ui->FNumber->blockSignals(false);
@@ -104,10 +110,8 @@ mirrorDlg::mirrorDlg(QWidget *parent) :
ui->cc->blockSignals(false);
ui->unitsCB->blockSignals(false);
ui->fringeSpacingEdit->blockSignals(false);
- bool showEdgeMaskCtrls = settings.value("configAperatureReductionChecked",false).toBool();
- ui->ReducApp->setChecked(showEdgeMaskCtrls);
- ui->ClearAp->setVisible(showEdgeMaskCtrls);
- ui->clearApLabel->setVisible(showEdgeMaskCtrls);
+ ui->ClearAp->setVisible( m_aperatureReductionEnabled);
+ ui->clearApLabel->setVisible( m_aperatureReductionEnabled);
m_aperatureReductionValueChanged = false;
setclearAp();
}
@@ -478,6 +482,7 @@ void mirrorDlg::on_unitsCB_clicked(bool checked)
{
mm = checked;
double div = ((mm) ? 1: 25.4);
+
ui->roc->blockSignals(true);
ui->diameter->blockSignals(true);
ui->diameter->setText(QString().sprintf("%6.2lf",diameter/div));
@@ -490,6 +495,7 @@ void mirrorDlg::on_unitsCB_clicked(bool checked)
ui->reduceValue->blockSignals(true);
QSettings set;
aperatureReduction = set.value("config aperatureReduction",0.).toDouble();
+
ui->reduceValue->setValue(aperatureReduction * ((mm) ? 1. : 1./25.4));
ui->reduceValue->blockSignals(false);
ui->ClearAp->setText(QString().sprintf("%6.2lf ", m_clearAperature * ((mm) ? 1: 1./25.4)));
@@ -598,7 +604,7 @@ void mirrorDlg::setclearAp(){
void mirrorDlg::on_ReducApp_clicked(bool checked)
{
-
+ m_aperatureReductionEnabled = checked;
ui->reduceValue->setEnabled(checked);
ui->ClearAp->setVisible(checked);
ui->clearApLabel->setVisible(checked);
@@ -606,7 +612,7 @@ void mirrorDlg::on_ReducApp_clicked(bool checked)
QSettings set;
set.setValue("configAperatureReductionChecked", checked);
if (!checked){
- aperatureReduction = 0.;
+ //aperatureReduction = 0.;
}
else {
aperatureReduction = set.value("config aperatureReduction",0.).toDouble();
@@ -618,7 +624,13 @@ 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;
diff --git a/mirrordlg.h b/mirrordlg.h
index 99082a04..c586242f 100644
--- a/mirrordlg.h
+++ b/mirrordlg.h
@@ -64,7 +64,8 @@ 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();