Skip to content

Commit

Permalink
Version 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
githubdoe committed Dec 20, 2017
1 parent 1042570 commit 38b171d
Show file tree
Hide file tree
Showing 86 changed files with 5,537 additions and 3,433 deletions.
24 changes: 19 additions & 5 deletions DFTFringe.pro
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ SOURCES += main.cpp\
regionedittools.cpp \
reportdlg.cpp \
videosetupdlg.cpp \
showaliasdlg.cpp
showaliasdlg.cpp \
colorchannel.cpp \
wavefrontaveragefilterdlg.cpp \
rejectedwavefrontsdlg.cpp \
outlinestatsdlg.cpp \
filteroutlinesdlg.cpp
punwrap.cpp

HEADERS += mainwindow.h \
Expand Down Expand Up @@ -212,7 +217,12 @@ HEADERS += mainwindow.h \
regionedittools.h \
reportdlg.h \
videosetupdlg.h \
showaliasdlg.h
showaliasdlg.h \
colorchannel.h \
wavefrontaveragefilterdlg.h \
rejectedwavefrontsdlg.h \
outlinestatsdlg.h \
filteroutlinesdlg.h
FORMS += mainwindow.ui \
dfttools.ui \
dftarea.ui \
Expand Down Expand Up @@ -275,7 +285,11 @@ FORMS += mainwindow.ui \
regionedittools.ui \
reportdlg.ui \
videosetupdlg.ui \
showaliasdlg.ui
showaliasdlg.ui \
wavefrontaveragefilterdlg.ui \
rejectedwavefrontsdlg.ui \
outlinestatsdlg.ui \
filteroutlinesdlg.ui

win32 {
CONFIG( debug, debug|release ) {
Expand All @@ -286,7 +300,7 @@ win32 {
LIBS += C:/build-qwt-Desktop_Qt_5_3_MinGW_32bit-Release/lib/qwt.dll
}
INCLUDEPATH += C:\\qwt-6.1.2\\src
INCLUDEPATH += c:\\opencvCopy\\build\\include
INCLUDEPATH += c:\\opencv\\build\\include
LIBS += C:/opencv/build-mingw/bin/*.dll
#message("using win32")
}
Expand All @@ -313,7 +327,7 @@ RC_FILE = DFTFringe.rc
QMAKE_CXXFLAGS += -std=c++11

# The application version
VERSION = 2.2
VERSION = 3.0

# Define the preprocessor macro to get the application version in our application.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
Expand Down
18 changes: 17 additions & 1 deletion RevisionHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,20 @@
<li>Added feature to display the resized interferogram that is used by the DFT analysis so that it can be compared to the full size version.
This allows one to check for fringes that may be too thin. </li>
<li> fixed rotation direction bug.</li>
<ul><ul>
</ul></ul>
<ul><li>Version 3.0</li>
<ul>
<li>Added auto mirror outline capability.</li>
<li>Added stastics of outline files.</li>
<li>Changes to igram display to display in gray using the channel selected by the user. Moved igram color channel selection to igram tools.</li>
<li>Added filter to WaveFront average dialog</li>
<li>Changed Best Fit CC display to "NA" when null is not selected. Added more info about Best Fit CC parameters</li>
<li>Added user selectable output wavelength. In Preferences</li>
<li>Several changes to Batch processing.
<ul><li>Made the dialog more responsive.</li>
<li>Added review movie options.</li>
<li>Added memory usage status</li>
<li>Changed Gaussian Blur filter value to be percent of mirror diameter.</li>
<li>Fixed loading of .bmp gray igram files</li>
</ul>
</ul></ul>
86 changes: 68 additions & 18 deletions averagewavefrontfilesdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#include "ui_averagewavefrontfilesdlg.h"
#include "surfacemanager.h"
#include "mainwindow.h"

#include "wavefrontaveragefilterdlg.h"
#include <opencv/cv.h>
#include "rejectedwavefrontsdlg.h"
#include <QFileInfo>
#include "utils.h"
void showData(const std::string &txt, Mat mat, bool useLog);
averageWaveFrontFilesDlg::averageWaveFrontFilesDlg(QStringList list, SurfaceManager *m, QWidget *parent) :
QDialog(parent),
Expand All @@ -14,6 +18,7 @@ averageWaveFrontFilesDlg::averageWaveFrontFilesDlg(QStringList list, SurfaceMana
ui->fileList->addItems(list);
ui->progressBar->setRange(0,10);
ui->progressBar->setValue(0);
useFilter = false;
}
averageWaveFrontFilesDlg::~averageWaveFrontFilesDlg()
{
Expand All @@ -30,12 +35,12 @@ void averageWaveFrontFilesDlg::on_MoveUp_clicked()
ui->fileList->insertItem(currentIndex-1, currentItem);
ui->fileList->setCurrentRow(currentIndex-1);
}

extern double outputLambda;
void averageWaveFrontFilesDlg::on_process_clicked()
{
bool first = true;
abort = false;

QStringList rejects;
bool configChanged = false;
int count = ui->fileList->count();
if (count == 0)
Expand All @@ -44,22 +49,46 @@ void averageWaveFrontFilesDlg::on_process_clicked()
ui->progressBar->setFormat("%p%");
QApplication::setOverrideCursor(Qt::WaitCursor);
cv::Mat mask;
static mirrorDlg *md = mirrorDlg::get_Instance();
int total = 0;
for(int i = 0; i < count; ++i)
{
if (abort)
break;
QListWidgetItem* item = ui->fileList->item(i);
QString name = item->text();
ui->fileList->setCurrentRow(i);
qApp->processEvents();
wavefront *wf = sm->readWaveFront(name,configChanged);
if (useFilter){
sm->makeMask(wf);
sm->generateSurfacefromWavefront(wf);
cv::Scalar mean,std;
cv::meanStdDev(wf->workData,mean,std,wf->workMask);
double stdVal = std.val[0]* md->lambda/outputLambda;
if (stdVal > filterRMS){
QFileInfo info(name);
QString item = QString().sprintf("%s RMS:%lf", info.baseName().toStdString().c_str(), stdVal);
rejects << item;
ui->fileList->item(i)->setForeground(Qt::red);
qApp->processEvents();
delete wf;
continue;
}
}

if (first){
first = false;
average = sm->readWaveFront(name, configChanged );
average = wf;
sm->makeMask(average, false);
mask = average->mask.clone();
total = 1;

}
else {
wavefront *second = sm->readWaveFront(name, configChanged);
wavefront *second = wf;

++total;
sm->makeMask(second, false);
int size1 = average->data.rows * average->data.cols;
int size2 = second->data.rows * second->data.cols;
Expand All @@ -74,24 +103,32 @@ void averageWaveFrontFilesDlg::on_process_clicked()
cv::bitwise_and(mask, resizeMask, mask);
delete second;
}

ui->progressBar->setValue(i);
qApp->processEvents();

}
average->mask = mask.clone();
average->data.copyTo(average->data,average->mask);
if (abort){
if (average)
delete average;
average = 0;
if (total > 1){
average->mask = mask.clone();
average->data.copyTo(average->data,average->mask);
if (abort){
if (average)
delete average;
average = 0;
}
else {
average->data/= total;
// set average to surface manager.
}
ui->progressBar->setValue(0);
ui->progressBar->setFormat("Done");

emit averageComplete( average );
}
else {
average->data/= count;
// set average to surface manager.
if (rejects.size() > 0){
rejectedWavefrontsDlg dlg(rejects);
dlg.exec();
}
ui->progressBar->setValue(0);
ui->progressBar->setFormat("Done");
QApplication::restoreOverrideCursor();
emit averageComplete( average );
}

void averageWaveFrontFilesDlg::on_addFiles_clicked()
Expand Down Expand Up @@ -127,3 +164,16 @@ void averageWaveFrontFilesDlg::on_deleteFiles_clicked()
delete currentItem;
ui->fileList->setCurrentRow(currentIndex-1);
}


void averageWaveFrontFilesDlg::on_filterCB_clicked(bool checked)
{
useFilter = checked;
if (checked) {
wavefrontAverageFilterDlg dlg;
if (dlg.exec()){
filterRMS = dlg.rms();

}
}
}
4 changes: 4 additions & 0 deletions averagewavefrontfilesdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ private slots:

void on_deleteFiles_clicked();

void on_filterCB_clicked(bool checked);

private:
Ui::averageWaveFrontFilesDlg *ui;
bool abort;
double filterRMS;
bool useFilter;
};

#endif // AVERAGEWAVEFRONTFILESDLG_H
14 changes: 12 additions & 2 deletions averagewavefrontfilesdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<width>678</width>
<height>493</height>
</rect>
</property>
Expand Down Expand Up @@ -84,6 +84,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="filterCB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exclude wavefronts from the average that exceed an RMS value.&lt;/p&gt;&lt;p&gt;Excluded wavefronts will be colored in red at the end of the average.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand Down Expand Up @@ -130,7 +140,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Abort|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Abort|QDialogButtonBox::Cancel</set>
</property>
<property name="centerButtons">
<bool>true</bool>
Expand Down
20 changes: 18 additions & 2 deletions batchigramwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ QCheckBox *batchIgramWizard::saveFile = 0;
QCheckBox *batchIgramWizard::showProcessPlots = 0;
QCheckBox *batchIgramWizard::deletePreviousWave;
QPushButton *batchIgramWizard::saveZerns = 0;

QLabel *batchIgramWizard::memStatus = 0;
QCheckBox *batchIgramWizard::makeReviewAvi = 0;
QString batchIgramWizard::reviewFileName;
QPushButton *batchIgramWizard::playReview = 0;
batchIgramWizard::batchIgramWizard(QStringList files, QWidget *parent, Qt::WindowFlags flags) :
QWizard(parent, flags),
ui(new Ui::batchIgramWizard)
Expand Down Expand Up @@ -170,7 +173,12 @@ batchIntro::batchIntro(QStringList files, QWidget *manager, QWidget *p):
"pressed {background-color: rgb(224, 0, 0) border-style: inset;}}"
"QPushButton:!enabled { background-color:lightgray } Working");
batchIgramWizard::saveZerns = new QPushButton(tr("SaveZerns"), this);

batchIgramWizard::makeReviewAvi = new QCheckBox(tr("Make review AVI"));
batchIgramWizard::makeReviewAvi->setToolTip("Create a movie where each frame \nshows the igram, dft, 3D and contour plot\n"
" of each interferogram analyzed.");
batchIgramWizard::playReview = new QPushButton(tr("Play review movie"), this);
batchIgramWizard::playReview->setEnabled(false);
connect(batchIgramWizard::playReview, SIGNAL(pressed()), this, SLOT(play_review()));
batchIgramWizard::saveZerns->setEnabled(false);
batchIgramWizard::saveZerns->setToolTip("If wavefronts were being deleted to save space.\n"
"Use this to save the zernike values just created by\nthe "
Expand All @@ -181,6 +189,7 @@ batchIntro::batchIntro(QStringList files, QWidget *manager, QWidget *p):
hlayout->addWidget(batchIgramWizard::deletePreviousWave);
hlayout->addWidget(batchIgramWizard::addFiles);
hlayout->addWidget(batchIgramWizard::skipFile);
batchIgramWizard::memStatus = new QLabel();
QVBoxLayout *layout = new QVBoxLayout();
astigPlot = new astigScatterPlot;
m_rmsPlot = new rmsPlot;
Expand All @@ -195,6 +204,9 @@ batchIntro::batchIntro(QStringList files, QWidget *manager, QWidget *p):
layout->addWidget(filesList);
hlayout3->addWidget(batchIgramWizard::goPb,0, Qt::AlignLeft);
hlayout3->addWidget(batchIgramWizard::showProcessPlots);
hlayout3->addWidget(batchIgramWizard::makeReviewAvi);
hlayout3->addWidget(batchIgramWizard::playReview);
hlayout3->addWidget(batchIgramWizard::memStatus);
hlayout3->addWidget(batchIgramWizard::saveZerns);
layout->addLayout(hlayout3);
layout->addLayout(hlayout2);
Expand All @@ -203,6 +215,10 @@ batchIntro::batchIntro(QStringList files, QWidget *manager, QWidget *p):


}
void batchIntro::play_review(){
QDesktopServices::openUrl(QUrl(batchIgramWizard::reviewFileName));
}

void batchIntro::on_filter(bool flag){
if (flag){
wavefrontFilterDlg dlg;
Expand Down
6 changes: 6 additions & 0 deletions batchigramwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class batchIgramWizard;
}
class QListWidget;
class batchIntro;
class QLabel;
class batchIgramWizard : public QWizard
{
Q_OBJECT
Expand All @@ -33,6 +34,10 @@ class batchIgramWizard : public QWizard
static QCheckBox *deletePreviousWave;
static QCheckBox *showProcessPlots;
static QPushButton *saveZerns;
static QCheckBox *makeReviewAvi;
static QLabel *memStatus;
static QString reviewFileName;
static QPushButton *playReview;
explicit batchIgramWizard(QStringList files, QWidget *parent = 0 , Qt::WindowFlags flags = 0);
~batchIgramWizard();
void listReady(QStringList list);
Expand Down Expand Up @@ -78,6 +83,7 @@ public slots:
void eraseItem();
void showPlots(bool flags);
void on_filter(bool);
void play_review();
signals:
void processBatchList(QStringList);
private:
Expand Down
4 changes: 2 additions & 2 deletions camwizardpage1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ bool CamWizardPage1::runCalibration( cv::Size& imageSize, cv::Mat& cameraMatrix,
std::vector<float>& reprojErrs, double& totalAvgErr)
{

cameraMatrix = cv::Mat::eye(3, 3, CV_64F);
cameraMatrix = cv::Mat::eye(3, 3, CV_64FC1);
//if( s.flag & CV_CALIB_FIX_ASPECT_RATIO )
cameraMatrix.at<double>(0,0) = 1.0;

distCoeffs = cv::Mat::zeros(8, 1, CV_64F);
distCoeffs = cv::Mat::zeros(8, 1, CV_64FC1);

cv::vector<cv::vector<cv::Point3f> > objectPoints(1);
calcBoardCornerPositions( cv::Size(ui->columns->value(), ui->rows->value()), 1,
Expand Down
Loading

0 comments on commit 38b171d

Please sign in to comment.