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
1 change: 1 addition & 0 deletions IgramArea.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions foucaultview.ui
Original file line numberDiff line numberDiff line change
Expand Up@@ -479,10 +479,10 @@
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
<double>-20.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
Expand Down
91 changes: 76 additions & 15 deletions igramarea.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@
#include <QtGlobal>
#include <math.h>

#include <opencv2/opencv.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "graphicsutilities.h"
Expand DownExpand Up@@ -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(){
Expand DownExpand Up@@ -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);
Expand DownExpand Up@@ -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()
Expand DownExpand Up@@ -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);
Expand DownExpand Up@@ -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;
Expand DownExpand Up@@ -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: ")
Expand All@@ -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;
Expand All@@ -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();
Expand DownExpand Up@@ -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();

Expand DownExpand Up@@ -2248,6 +2308,7 @@ void IgramArea::deleteOutline(){
}
m_polygons.clear();
syncRegions();
saveRegions();
}
else if (m_current_boundry == CenterOutline){
m_centerHist.clear();
Expand Down
22 changes: 11 additions & 11 deletions mainwindow.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -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));

Expand Down
28 changes: 20 additions & 8 deletions mirrordlg.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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();
Expand All@@ -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);
Expand All@@ -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();
}
Expand DownExpand Up@@ -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));
Expand All@@ -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)));
Expand DownExpand Up@@ -598,15 +604,15 @@ 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);
updateZ8();
QSettings set;
set.setValue("configAperatureReductionChecked", checked);
if (!checked){
aperatureReduction = 0.;
//aperatureReduction = 0.;
}
else {
aperatureReduction = set.value("config aperatureReduction",0.).toDouble();
Expand All@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion mirrordlg.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -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();

Expand Down