From 72e392fd70f849726469c4b61c63317442e0db86 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Wed, 21 May 2025 22:27:56 -0500 Subject: [PATCH 01/13] Worked on stand astig removal feature. Change size of images so that they do not depend upon display resolution but only on printer paper size. Added astig polar plot to stand removal report. Saved user data of report to recall when run again. Updated polar plot logic to enable report to grab it's image and also make it's size proportional to the users screen size. --- astigpolargraph.cpp | 35 ++++------ astigpolargraph.h | 12 +++- astigpolargraph.ui | 2 +- mainwindow.cpp | 12 +++- standastigwizard.cpp | 34 +++++++-- surfacemanager.cpp | 159 +++++++++++++++++++++++++++++-------------- surfacemanager.h | 2 +- 7 files changed, 171 insertions(+), 85 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index ce49c900..3b05d10a 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -2,13 +2,16 @@ #include "ui_astigpolargraph.h" #include "surfacemanager.h" -void astigPolargraph::makeChart(){ - +astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : + QDialog(parent), + ui(new Ui::astigPolargraph) +{ + ui->setupUi(this); QPolarChart *chart = new QPolarChart(); // process each wave front and place astig on the chart - ui->waveFrontTable->setRowCount(m_list.size()); + ui->waveFrontTable->setRowCount(list.size()); QValueAxis *angularAxis = new QValueAxis(); angularAxis->setTickCount(9); // First and last ticks are co-located on 0/360 angle. @@ -25,15 +28,15 @@ void astigPolargraph::makeChart(){ QVector wavefronts =SurfaceManager::get_instance()->m_wavefronts; - for(int ndx = 0; ndx < m_list.length(); ++ndx){ - wavefront *wf = wavefronts[m_list[ndx]]; - QString name = wf->name; + for(int ndx = 0; ndx < list.length(); ++ndx){ + + QString name = list[ndx].m_name; int slashndx = name.lastIndexOf('/'); QString shortName = name.mid(name.lastIndexOf('/',slashndx-1)); QTableWidgetItem *item = new QTableWidgetItem(shortName, 0); ui->waveFrontTable->setItem(ndx,0,item); - double xastig = wf->InputZerns[4]; - double yastig = wf->InputZerns[5]; + double xastig = list[ndx].m_xastig; + double yastig = list[ndx].m_yastig; double mag = sqrt(xastig * xastig + yastig * yastig); if (mag > maxAstig) maxAstig = mag; @@ -69,7 +72,7 @@ void astigPolargraph::makeChart(){ } chart->setTitle("Magnitude and axis of high edge"); - if (m_list.length() > 4) + if (list.length() > 4) chart->legend()->setAlignment(Qt::AlignRight); else chart->legend()->setAlignment(Qt::AlignBottom); @@ -79,20 +82,6 @@ void astigPolargraph::makeChart(){ ui->polarChart->setChart(chart); - - -} -astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : - QDialog(parent), - ui(new Ui::astigPolargraph), m_list(list) -{ - ui->setupUi(this); - //For some reason the original starter code of makeChart was in this function but it caused a crash. - // I could never figure out why because that code was taken from a working Qt example. When - // moved to inside another function it worked. So there you go. Exact same code with no changes worked there but not here. - makeChart(); - - } astigPolargraph::~astigPolargraph() diff --git a/astigpolargraph.h b/astigpolargraph.h index e8d3dbcb..a3ad5daa 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -13,19 +13,25 @@ namespace Ui { class astigPolargraph; } +class astigSample{ +public: + QString m_name; + double m_xastig; + double m_yastig; + astigSample(QString name, double xastig, double yastig): m_name(name), m_xastig(xastig), m_yastig(yastig){}; +}; class astigPolargraph : public QDialog { Q_OBJECT public: - explicit astigPolargraph(QList list,QWidget *parent = nullptr); + explicit astigPolargraph(QList list,QWidget *parent = nullptr); ~astigPolargraph(); private: Ui::astigPolargraph *ui; - QList m_list; // list index of selected wave fronts in surface manager's list. - void makeChart(); + }; #endif // ASTIGPOLARGRAPH_H diff --git a/astigpolargraph.ui b/astigpolargraph.ui index 566f4f73..5c0600d6 100644 --- a/astigpolargraph.ui +++ b/astigpolargraph.ui @@ -55,7 +55,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::NoButton diff --git a/mainwindow.cpp b/mainwindow.cpp index 758e184a..025f5412 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2074,8 +2074,16 @@ void MainWindow::on_actionastig_in_polar_triggered() { surfaceAnalysisTools *saTools = surfaceAnalysisTools::get_Instance(); QList list = saTools->SelectedWaveFronts(); - astigPolargraph * graph = new astigPolargraph( list); - graph->resize(2000,1000); + QList samples; + foreach(int i, list){ + wavefront *wf = m_surfaceManager->m_wavefronts[i]; + astigSample sample(wf->name, wf->InputZerns[4], wf->InputZerns[5]); + samples << sample; + } + astigPolargraph * graph = new astigPolargraph(samples); + QScreen *screen = QGuiApplication::primaryScreen(); + QSizeF physicalSize = screen->availableSize(); + graph->resize(physicalSize.width()/2,physicalSize.height()/2); graph->exec(); } diff --git a/standastigwizard.cpp b/standastigwizard.cpp index 6c617378..8f0eb553 100644 --- a/standastigwizard.cpp +++ b/standastigwizard.cpp @@ -42,8 +42,12 @@ standAstigWizard::standAstigWizard(SurfaceManager *sm, QWidget *parent, Qt::Wind setWindowTitle(tr("Stand Astig analysis")); setPixmap(QWizard::WatermarkPixmap, QPixmap(":/res/wats2.png")); setPixmap(QWizard::LogoPixmap, QPixmap(":/res/mirror_stand.png")); - //AstigReportTitle = mirrorDlg::get_Instance()->m_name; - //resize( QSize(600, 489)); + + + QScreen *screen = QGuiApplication::primaryScreen(); + + resize(screen->availableSize().width() * .5 ,screen->availableSize().height() * .5); + } standAstigWizard::~standAstigWizard() @@ -122,6 +126,7 @@ makeAverages::makeAverages(QWidget *parent) ); txt->setReadOnly(true); QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(txt); setLayout(layout); } @@ -227,9 +232,15 @@ define_input::define_input(QWidget *parent) QPushButton *browsePath = new QPushButton("..."); CWRb = new QRadioButton("Rotate CW"); CCWRb = new QRadioButton("Rotate CCW"); - CCWRb->setChecked(true); + if (set.value("stand astig ccw", true).toBool()) + CCWRb->setChecked(true); + else + CWRb->setChecked(true); + connect(browsePath, SIGNAL(pressed()), this, SLOT(setBasePath())); + + browsePath->setStyleSheet(""); QGridLayout *l = new QGridLayout(); @@ -246,6 +257,12 @@ define_input::define_input(QWidget *parent) listDisplay = new QListWidget(); listDisplay->setSelectionMode( QAbstractItemView::MultiSelection); listDisplay->setContextMenuPolicy(Qt::CustomContextMenu); + int size = set.beginReadArray("stand astig removal files"); + for (int i = 0; i < size; ++i) { + set.setArrayIndex(i); + listDisplay->addItem(set.value("item").toString()); + } + set.endArray(); connect(listDisplay, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); @@ -260,6 +277,7 @@ define_input::define_input(QWidget *parent) m_log = new QTextEdit(); m_log->append("Ready to add wave fronts to process."); l->addWidget(m_log,21,0,1,0); + setLayout(l); } @@ -270,7 +288,15 @@ void define_input::compute(){ QMessageBox::warning(0, "", "You must first add at least 2 wavefront files to the list."); return; } - + QSettings set; + set.setValue("stand astig ccw",CCWRb->isChecked() ); + set.beginWriteArray("stand astig removal files"); + // save the listDisplay of files to process + for (int i = 0; i < listDisplay->count(); ++i) { + set.setArrayIndex(i); + set.setValue("item", listDisplay->item(i)->text()); + } + set.endArray(); AstigReportTitle = title->text(); runpb->setText("Working"); runpb->setEnabled(false); diff --git a/surfacemanager.cpp b/surfacemanager.cpp index bfbf9eb6..8cb546d5 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -72,6 +72,7 @@ #include "oglrendered.h" #include "ui_oglrendered.h" #include "spdlog/spdlog.h" +#include "astigpolargraph.h" cv::Mat theMask; cv::Mat deb; @@ -1909,31 +1910,41 @@ void plotlineThruAstigs(QwtPlot *plt, cv::Mat xastig, cv::Mat yastig, QListphysicalDotsPerInchX(); + + int Width; + + printer.setPageSize(QPageSize(printer.pageLayout().pageSize())); + QPainter painterPDF( &printer ); + + // I want to create images that are about 1/2 as wide as the printer paper. + // So get the printer paper size + // THen get the screen resolution + // then calculate how many pixels create that size image on the screen + + // get the size of the printed page in inches. + QSize printerSizePixels = printer.pageLayout().paintRectPixels(printer.resolution()).size(); + qreal pageWidthInches = printerSizePixels.width()/printer.resolution(); + qreal imageWidthInches= .8 * pageWidthInches/2; + + Width = imageWidthInches * screenDPI; + return Width; +} // calculate stand astig for each input // for each input rotate the average by the input angle and subtract it from the input // plot the astig of each of the inputs which will be the stand only astig. // on input list is the list of wavefront files and thier rotation angle. // inputs are the actual wavefronts at original rotations. // avgNdx is the index in the m_wavefronts list of the average with stand removed. -textres SurfaceManager::Phase2(QList list, QList inputs, int avgNdx ){ +textres SurfaceManager::Phase2(QList list, QList inputs, int avgNdx , int Width, QPrinter &printer){ QTextEdit *editor = new QTextEdit; QTextDocument *doc = editor->document(); textres results; - results.Edit = editor; - const int Width = 800 * .6; - const int Height = 600 * .6; - QImage contour(Width ,Height, QImage::Format_ARGB32 ); - - QPrinter printer(QPrinter::HighResolution); - printer.setColorMode( QPrinter::Color ); - printer.setFullPage( true ); - printer.setOutputFileName( "stand.pdf" ); - printer.setOutputFormat( QPrinter::PdfFormat ); - //printer.setResolution(85); - printer.setPageSize(QPageSize(QPageSize::A4)); - QPainter painterPDF( &printer ); cv::Mat xastig = cv::Mat::zeros(list.size(), 1, numType); cv::Mat yastig = cv::Mat::zeros(list.size(), 1, numType); cv::Mat standxastig = cv::Mat::zeros(list.size(), 1, numType); @@ -1941,8 +1952,15 @@ textres SurfaceManager::Phase2(QList list, QList inp cv::Mat standastig = cv::Mat::zeros(list.size(), 1, numType); QVector standwfs; QVector astigMag; - editor->resize(printer.pageLayout().paintRectPixels(printer.resolution()).size()); + + int Height = Width; + + QImage contour(Width , Height, QImage::Format_ARGB32 ); + + results.Edit = editor; + editor->resize(Width, Height); doc->setPageSize(printer.pageLayout().paintRectPixels(printer.resolution()).size()); + cv::Mat standavg = cv::Mat::zeros(inputs[0]->workData.size(), numType); cv::Mat standavgZernMat = cv::Mat::zeros(inputs[0]->workData.size(), numType); double mirrorXaverage = 0; @@ -2021,7 +2039,7 @@ textres SurfaceManager::Phase2(QList list, QList inp } fittedcircle2 = Circle(xmean/xastig.rows, ymean/xastig.rows, avgRadius/xastig.rows ); fittedcircle = fittedcircle2; -qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; + fittedcircle = fittedcircle1; if (xastig.rows == 2 || fittedcircle1.r > 1.5 * fittedcircle2.r ){ fittedcircle = fittedcircle2; @@ -2118,6 +2136,7 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; QPolygonF mirrorAstigAtEachRotation; double mirrorAstigRadius =0; plotlineThruAstigs(pl1, xastig, yastig, list); + QList samples; for (int i = 0; i < list.size(); ++i){ if (cnt++ == 0) imagesHtml.append(""); @@ -2166,15 +2185,21 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; wf->name = QString("%1").arg(list[i]->angle, 6, 'f', 2, QLatin1Char('0')); cp->setSurface(wf); - cp->resize(Width,Height); + cp->resize(Width,.8 * Height); cp->replot(); + astigSample sample(wf->name, wf->InputZerns[4], wf->InputZerns[5]); + samples << sample; + QSize s = cp->size(); contour.fill( QColor( Qt::white ).rgb() ); - renderer.render( cp, &painter, QRect(0,0,Width,Height) ); + renderer.render( cp, &painter, QRect(0,0,s.width(),s.height() )); + QString imageName = QString("mydata://zern%1.png").arg(wf->name); imageName.replace("-","CCW"); doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour)); results.res.append (imageName); - imagesHtml.append("

"); + + imagesHtml.append(QString(" ") + wf->name + "

"); + if (cnt == 2){ cnt = 0; imagesHtml.append(""); @@ -2200,20 +2225,20 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; minMaxIdx(wf2->data, &mmin,&mmax); wf2->min = mmin; wf2->max = mmax; - //wf2->workMask = m_wavefronts[0]->workMask.clone(); + wf2->name = QString("Average Stand zernike based"); ContourPlot *cp1 = new ContourPlot(); - //cp1->m_zRangeMode = "Min/Max"; + cp1->setSurface(wf2); - cp1->resize(Width, Height); + cp1->resize(Width, .8 * Height); cp1->replot(); - QImage contour2(500, 500, QImage::Format_ARGB32 ); + QImage contour2(Width, Width, QImage::Format_ARGB32 ); contour2.fill( QColor( Qt::white ).rgb() ); QPainter painter2( &contour2 ); renderer.setDiscardFlag(QwtPlotRenderer::DiscardLegend, false); renderer.render( cp1, &painter2, QRect(0,0,Width,Height) ); - QString imageName = "mydata://StandCotourZerns.png"; + QString imageName = "mydata://StandContourZerns.png"; doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour2)); wf2->data = wf2->workData = standavg; @@ -2232,7 +2257,7 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; contour2.fill( QColor( Qt::white ).rgb() ); renderer.render( cp1, &painter2, QRect(0,0,Width,Height) ); cp1->m_zRangeMode = "Auto"; // restore contour plot to auto scaling. - imageName = QString("mydata://StandCotourMat.png"); + imageName = QString("mydata://StandContourMat.png"); doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour2)); @@ -2309,15 +2334,22 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; curveAvgMirror->setPen(pen); curveAvgMirror->setSamples(stdCircle); curveAvgMirror->attach(pl1); - pl1->resize(500,500); + pl1->resize(1.5 * Width,1.5 * Width); pl1->replot(); - QwtPlotRenderer renderer3; - QImage contour3(500, 500, QImage::Format_ARGB32 ); + + QImage contour3(1.5 * Width, 1.5 * Width , QImage::Format_ARGB32 ); contour3.fill( QColor( Qt::white ).rgb() ); QPainter painter3( &contour3 ); renderer.setDiscardFlag(QwtPlotRenderer::DiscardLegend, false); - renderer.render( pl1, &painter3, QRect(0,0,500,500) ); + renderer.render( pl1, &painter3, QRect(0,0,1.5 * Width,1.5 * Width) ); + +// QPixmap pixmap = QPixmap::fromImage(contour3); // Create a QPixmap from the QImage +// QLabel* label = new QLabel(); // Create a QLabel +// label->setPixmap(pixmap); // Set the QPixmap to the QLabel +// label->show(); // Show the QLabel + + imageName = QString("mydata://plot.png"); doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour3)); results.res.append (imageName); @@ -2336,18 +2368,37 @@ qDebug() << "circle fit"<< avgRadius << fittedcircle1.r << fittedcircle2.r; "The stand removal was good. Idealy the STD (standard deviation) should be" " less than .1 which means less than .1 wave pv on the surface of the mirror" "
The colored plus signs are what is calculated for test stand induced astig." - "at each rotation angle.


" + "at each rotation angle.


The plot below is a polar plot of each rotations test stand astig." + "The ideal would be they are all the same magnitude and angle. If any one is much different than the rest then the astig removal may not be good."); + astigPolargraph *polar = new astigPolargraph(samples); + polar->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint); + polar->resize(Width * 2, 2 * Width); + QImage polarImage(2 * Width, 2 * Width , QImage::Format_ARGB32 ); + polarImage.fill( QColor( Qt::white ).rgb() ); + QPainter painterPolar( &polarImage ); + + + polar->render( &painterPolar); + + imageName = QString("mydata://polarplot.png"); + doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(polarImage)); + results.res.append (imageName); + html.append("

"); + html.append("
" + "

The contours above are the average system induced forces derived from the average of all rotations.
" + "The left contour is based on the zernike values and the contour on the right is based on the wavefront.

"); - "
" - "

The contours above are the average system induced forces derived from the average of all rotations.
" - "The left contour is based on the zernike values and the contour on the right is based on the wavefront.

" - "

The contour plots below are of what is beleived to be test stand only induced errors at each rotation. " + + + html.append( "

The contour plots below are of what is beleived to be test stand only induced errors at each rotation. " "Check that they are similar at each rotation. If not then maybe " "stand (system) induced error is not same at each rotation then the stand removal is not reliable. " "However it is unlikely that they will all look exactly the same.

"); + + html.append(imagesHtml); html.append(""); editor->setHtml(html); @@ -2392,21 +2443,20 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListresize(printer.pageLayout().paintRectPixels(printer.resolution()).size()); const int contourWidth = 2 * 340/3; const int contourHeight = 2 * 360/3; - QImage contour = QImage(contourWidth ,contourHeight, QImage::Format_ARGB32 ); + QImage contour = QImage(Width ,Width, QImage::Format_ARGB32 ); QwtPlotRenderer renderer; @@ -2455,8 +2505,9 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListsetSurface(wf); + plot->resize(Width, .8 * Width); plot->replot(); - renderer.render( plot, &painter, QRect(0,0,contourWidth,contourHeight) ); + renderer.render( plot, &painter, QRect(0,0,Width,.8 * Width) ); QString imageName = QString("mydata://%1.png").arg(list[i]->fname); QString angle = QString("%1 Deg").arg(-list[i]->angle, 6, 'f', 2); @@ -2472,18 +2523,17 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListfname << " angle " << list[i]->angle; rotateThese(wrapAngle(list[i]->angle),l); rotated.append(m_wavefronts[ndx]); wf = m_wavefronts[ndx]; loadComplete(); plot->setSurface(wf); + plot->resize(Width, .8 * Width); plot->replot(); contour.fill( QColor( Qt::white ).rgb() ); - renderer.render( plot, &painter, QRect(0,0,contourWidth,contourHeight) ); + renderer.render( plot, &painter, QRect(0,0,Width, .8 * Width) ); angle = QString("%1 Deg").arg(-list[i]->angle, 6, 'f', 2); imageName = QString("mydata://CR%1%2.png").arg(list[i]->fname).arg(angle); // clazy:exclude=qstring-arg @@ -2525,11 +2575,11 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListsetSurface(m_wavefronts[m_currentNdx]); - contour = QImage(550,450, QImage::Format_ARGB32 ); + contour = QImage(1.5 * Width,1.5 * Width, QImage::Format_ARGB32 ); contour.fill( QColor( Qt::white ).rgb() ); QPainter painter( &contour ); - - renderer.render( plotAvg, &painter, QRect(0,0,550,450) ); + plotAvg->resize(1.5 * Width, 1.5 * .8 * Width); + renderer.render( plotAvg, &painter, QRect(0,0,1.5 * Width, 1.5 * Width) ); QString imageName = "mydata://AvgAstigremoved.png"; doc2->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour)); @@ -2540,6 +2590,7 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListsetHtml(html); //page2->show(); + /**************************************************************************************************/ // PHASE 2 // calculate stand astig for each input @@ -2548,13 +2599,18 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListm_log->setText("computing stand astigs"); QApplication::processEvents(); - textres page3res = Phase2(list, inputs, avgNdx); + textres page3res = Phase2(list, inputs, avgNdx, Width, printer); QTabWidget *tabw = new QTabWidget(); tabw->setTabShape(QTabWidget::Triangular); tabw->addTab(editor, "Page 1 input analysis"); tabw->addTab(page2, "Page 2 Stand removed."); tabw->addTab(page3res.Edit, "Page 3 stand analysis"); - tabw->resize(800,600); + QScreen *screen = QGuiApplication::primaryScreen(); + QSizeF physicalSize = screen->availableSize(); + + + //tabw->resize(Width,2 * Width); + tabw->setGeometry(Width, 200, 2 * Width, physicalSize.height()* .7); tabw->show(); // build pdf doc from the three textedits @@ -2562,10 +2618,10 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListdocument()->resource(QTextDocument::ImageResource,res)); } - pdfDoc.addResource(QTextDocument::ImageResource, QString("mydata://StandCotourZerns.png"), - page3res.Edit->document()->resource(QTextDocument::ImageResource,QString("mydata://StandCotourZerns.png") )); - pdfDoc.addResource(QTextDocument::ImageResource, QString("mydata://StandCotourMat.png"), - page3res.Edit->document()->resource(QTextDocument::ImageResource,QString("mydata://StandCotourMat.png") )); + pdfDoc.addResource(QTextDocument::ImageResource, QString("mydata://StandContourZerns.png"), + page3res.Edit->document()->resource(QTextDocument::ImageResource,QString("mydata://StandContourZerns.png") )); + pdfDoc.addResource(QTextDocument::ImageResource, QString("mydata://StandContourMat.png"), + page3res.Edit->document()->resource(QTextDocument::ImageResource,QString("mydata://StandContourMat.png") )); foreach(QString res, doc1Res){ pdfDoc.addResource(QTextDocument::ImageResource, res, editor->document()->resource(QTextDocument::ImageResource,res)); } @@ -2606,6 +2662,7 @@ void SurfaceManager::computeTestStandAstig(){ spdlog::get("logger")->trace("new standAstigWizard"); m_standAstigWizard = new standAstigWizard(this); m_standAstigWizard->setAttribute( Qt::WA_DeleteOnClose, true ); + m_standAstigWizard->show(); } else{ diff --git a/surfacemanager.h b/surfacemanager.h index 7e064f79..c1182160 100644 --- a/surfacemanager.h +++ b/surfacemanager.h @@ -135,7 +135,7 @@ class SurfaceManager : public QObject explicit SurfaceManager(QObject *parent=0, surfaceAnalysisTools *tools = 0, ProfilePlot *profilePlot =0, contourView *contourView = 0, SurfaceGraph *glPlot = 0, metricsDisplay *mets = 0); - textres Phase2(QList list, QList inputs, int avgNdx); + textres Phase2(QList list, QList inputs, int avgNdx, int Width, QPrinter &printer); signals: void currentNdxChanged(int); From 88e64b0cfe8e904aa62c0a0e7605406b17e7045b Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Wed, 21 May 2025 22:36:25 -0500 Subject: [PATCH 02/13] removed some commented out code --- surfacemanager.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 8cb546d5..8cb2ae52 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -2296,11 +2296,6 @@ textres SurfaceManager::Phase2(QList list, QList inp mirrorXastig /= count; mirrorYastig /= count; - //QwtPlotMarker *mirrorMeanMark = new QwtPlotMarker(); - //mirrorMeanMark->setValue(QPointF(bestFitAstig.a, bestFitAstig.b)); - //mirrorMeanMark->setSymbol(new QwtSymbol(QwtSymbol::Triangle,QColor(0,255,0,40), QColor(0,0,0), QSize(30,30))); - //mirrorMeanMark->attach(pl1); - QPolygonF stdCircle; double SE = standStd[0]/sqrt(standastig.rows); for (double rho = 0; rho <= 2 * M_PI; rho += M_PI/32.){ @@ -2344,12 +2339,6 @@ textres SurfaceManager::Phase2(QList list, QList inp renderer.setDiscardFlag(QwtPlotRenderer::DiscardLegend, false); renderer.render( pl1, &painter3, QRect(0,0,1.5 * Width,1.5 * Width) ); -// QPixmap pixmap = QPixmap::fromImage(contour3); // Create a QPixmap from the QImage -// QLabel* label = new QLabel(); // Create a QLabel -// label->setPixmap(pixmap); // Set the QPixmap to the QLabel -// label->show(); // Show the QLabel - - imageName = QString("mydata://plot.png"); doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(contour3)); results.res.append (imageName); From 2dc922ad7c571c595602008024d2d11f8c5d6b8f Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Thu, 22 May 2025 02:53:25 -0500 Subject: [PATCH 03/13] added double click on polar table item to toggle line visibility. So that item can be identified in the polar plot. --- astigpolargraph.cpp | 35 ++++++++++++++++++++++++++++++++++- astigpolargraph.h | 8 ++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index 3b05d10a..f85899de 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -8,7 +8,7 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : { ui->setupUi(this); - QPolarChart *chart = new QPolarChart(); + chart = new QPolarChart(); // process each wave front and place astig on the chart ui->waveFrontTable->setRowCount(list.size()); @@ -60,6 +60,7 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : chart->addSeries(line); line->attachAxis(radialAxis); line->attachAxis(angularAxis); + line->setName(name); chart->legend()->markers(line)[0]->setVisible(false); line->setPen(QPen(series->brush(),5)); @@ -87,4 +88,36 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : astigPolargraph::~astigPolargraph() { delete ui; + delete chart; } + +// if table row is double clicked set all polar plot lines invisible but the one that was clicked in the table. +// if they were invisible then make them visible. +void astigPolargraph::on_waveFrontTable_cellDoubleClicked(int row, int column) +{ + QTableWidgetItem *item = ui->waveFrontTable->item(row,0); + QString name = item->text(); + int lastndx = name.lastIndexOf('/'); + if (lastndx != -1) + name = name.mid(lastndx); + + + int seriesCount = chart->series().count(); + + for (int i = 0; i < seriesCount; ++i) { + QAbstractSeries* series = chart->series().at(i); + if (series) { + + if (series->type()== QAbstractSeries::SeriesTypeLine){ + if (series->name() != name){ + if (series->isVisible()) + series->setVisible(false); + else + series->setVisible(true); + } + } + + } + } +} + diff --git a/astigpolargraph.h b/astigpolargraph.h index a3ad5daa..8aca7e03 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -9,11 +9,12 @@ #include #include #include "wavefront.h" - +QT_CHARTS_USE_NAMESPACE namespace Ui { class astigPolargraph; } class astigSample{ + public: QString m_name; double m_xastig; @@ -29,9 +30,12 @@ class astigPolargraph : public QDialog explicit astigPolargraph(QList list,QWidget *parent = nullptr); ~astigPolargraph(); +private slots: + void on_waveFrontTable_cellDoubleClicked(int row, int column); + private: Ui::astigPolargraph *ui; - + QPolarChart *chart; }; #endif // ASTIGPOLARGRAPH_H From 7304adf85e3192acb373d6a228dddd47f1923354 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Thu, 22 May 2025 03:35:43 -0500 Subject: [PATCH 04/13] added when double clicking astig polar table display the wave front as the current wave front. Disabled the load of last remove test stand astig files. Because that needs more work to enable by adding the files and rotation direction to the rotation list. --- astigpolargraph.cpp | 1 + astigpolargraph.h | 3 ++- mainwindow.cpp | 3 +++ standastigwizard.cpp | 10 +++++----- surfacemanager.cpp | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index f85899de..50c91c12 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -97,6 +97,7 @@ void astigPolargraph::on_waveFrontTable_cellDoubleClicked(int row, int column) { QTableWidgetItem *item = ui->waveFrontTable->item(row,0); QString name = item->text(); + emit waveSeleted(name); int lastndx = name.lastIndexOf('/'); if (lastndx != -1) name = name.mid(lastndx); diff --git a/astigpolargraph.h b/astigpolargraph.h index 8aca7e03..01a7329e 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -29,7 +29,8 @@ class astigPolargraph : public QDialog public: explicit astigPolargraph(QList list,QWidget *parent = nullptr); ~astigPolargraph(); - +signals: + void waveSeleted(QString); private slots: void on_waveFrontTable_cellDoubleClicked(int row, int column); diff --git a/mainwindow.cpp b/mainwindow.cpp index 025f5412..064123c9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2081,9 +2081,12 @@ void MainWindow::on_actionastig_in_polar_triggered() samples << sample; } astigPolargraph * graph = new astigPolargraph(samples); + connect(graph, SIGNAL(waveSeleted(QString)), m_surfaceManager, SLOT(wavefrontDClicked(QString))); QScreen *screen = QGuiApplication::primaryScreen(); QSizeF physicalSize = screen->availableSize(); graph->resize(physicalSize.width()/2,physicalSize.height()/2); graph->exec(); + graph->disconnect(); + delete graph; } diff --git a/standastigwizard.cpp b/standastigwizard.cpp index 8f0eb553..adecf2dc 100644 --- a/standastigwizard.cpp +++ b/standastigwizard.cpp @@ -257,11 +257,11 @@ define_input::define_input(QWidget *parent) listDisplay = new QListWidget(); listDisplay->setSelectionMode( QAbstractItemView::MultiSelection); listDisplay->setContextMenuPolicy(Qt::CustomContextMenu); - int size = set.beginReadArray("stand astig removal files"); - for (int i = 0; i < size; ++i) { - set.setArrayIndex(i); - listDisplay->addItem(set.value("item").toString()); - } +// int size = set.beginReadArray("stand astig removal files"); +// for (int i = 0; i < size; ++i) { +// set.setArrayIndex(i); +// listDisplay->addItem(set.value("item").toString()); +// } set.endArray(); connect(listDisplay, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 8cb2ae52..b826870e 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -2368,7 +2368,7 @@ textres SurfaceManager::Phase2(QList list, QList inp polar->render( &painterPolar); - + delete polar; imageName = QString("mydata://polarplot.png"); doc->addResource(QTextDocument::ImageResource, QUrl(imageName), QVariant(polarImage)); results.res.append (imageName); From 2f8f2fd4a7c742c097bd1f5f676bae24f49b7839 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Thu, 22 May 2025 04:14:31 -0500 Subject: [PATCH 05/13] added auto resize columns to contents to astig polar table. --- astigpolargraph.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index 50c91c12..b44967d1 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -80,9 +80,10 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : maxAstig = ceil(maxAstig); radialAxis->setRange(0, maxAstig); angularAxis->setRange(0, 360); - + ui->waveFrontTable->resizeColumnsToContents(); ui->polarChart->setChart(chart); + } astigPolargraph::~astigPolargraph() From 4ba6488174296ebf051a20a90f99344713223c03 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Thu, 22 May 2025 20:15:15 -0500 Subject: [PATCH 06/13] changed way polar values are selected. Removed double clicking the table and added a hover over astig plot right end point. That will select that wave front in the wave front list and highlight the table entry as well. --- astigpolargraph.cpp | 75 +++++++++++++++++++++++++++++---------------- astigpolargraph.h | 8 +++-- astigpolargraph.ui | 24 +++++++++++++++ surfacemanager.cpp | 3 +- 4 files changed, 81 insertions(+), 29 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index 262232aa..9fd65078 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -4,8 +4,8 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : - QDialog(parent), - ui(new Ui::astigPolargraph) + + QDialog(parent),ui(new Ui::astigPolargraph) { ui->setupUi(this); @@ -14,7 +14,10 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : // process each wave front and place astig on the chart ui->waveFrontTable->setRowCount(list.size()); + ui->waveFrontTable->setSelectionBehavior(QAbstractItemView::SelectRows); + // Configure selection mode (e.g., single selection) + ui->waveFrontTable->setSelectionMode(QAbstractItemView::SingleSelection); QValueAxis *angularAxis = new QValueAxis(); angularAxis->setTickCount(9); // First and last ticks are co-located on 0/360 angle. angularAxis->setLabelFormat("%.0f"); @@ -43,7 +46,12 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : if (mag > maxAstig) maxAstig = mag; double angle = (atan2(yastig,xastig)/2.) * 180./M_PI; + angle = 90 - angle; + + astigSample sample(name, angle, mag); + + m_list << sample; QScatterSeries *series = new QScatterSeries(); int lastndx = name.lastIndexOf('/'); @@ -63,6 +71,7 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : line->attachAxis(radialAxis); line->attachAxis(angularAxis); line->setName(name); + connect(line, &QLineSeries::hovered, this, &astigPolargraph::tooltip); chart->legend()->markers(line)[0]->setVisible(false); line->setPen(QPen(series->brush(),5)); @@ -85,6 +94,13 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : ui->waveFrontTable->resizeColumnsToContents(); ui->polarChart->setChart(chart); +} +void astigPolargraph::tooltip(QPointF point, bool state) +{ + if (state) { + findClosestPoint(point); + } + } astigPolargraph::~astigPolargraph() @@ -93,34 +109,41 @@ astigPolargraph::~astigPolargraph() delete chart; } -// if table row is double clicked set all polar plot lines invisible but the one that was clicked in the table. -// if they were invisible then make them visible. -void astigPolargraph::on_waveFrontTable_cellDoubleClicked(int row, int column) -{ - QTableWidgetItem *item = ui->waveFrontTable->item(row,0); - QString name = item->text(); +void astigPolargraph::hideHoverHelp(){ + ui->hoverText->hide(); +} +int astigPolargraph::findClosestPoint(const QPointF clickedPoint){ + + QPointF closest(INT_MAX, INT_MAX); + qreal distance(INT_MAX); + int closeNdx = -1; + int ndx = 0; + for (auto sample : m_list) { + QPointF currentPoint(sample.m_xastig, sample.m_yastig); + qreal currentDistance = qSqrt((currentPoint.x() - clickedPoint.x()) + * (currentPoint.x() - clickedPoint.x()) + + (currentPoint.y() - clickedPoint.y()) + * (currentPoint.y() - clickedPoint.y())); + + if (currentDistance < distance) { + distance = currentDistance; + closest = currentPoint; + closeNdx = ndx; + + } + ++ndx; + } + QString name = m_list[closeNdx].m_name; emit waveSeleted(name); - int lastndx = name.lastIndexOf('/'); - if (lastndx != -1) - name = name.mid(lastndx); - + int slashndx = name.lastIndexOf('/'); + QString shortName = name.mid(name.lastIndexOf('/',slashndx-1)); - int seriesCount = chart->series().count(); + QList items = ui->waveFrontTable->findItems(shortName, Qt::MatchEndsWith); - for (int i = 0; i < seriesCount; ++i) { - QAbstractSeries* series = chart->series().at(i); - if (series) { - if (series->type()== QAbstractSeries::SeriesTypeLine){ - if (series->name() != name){ - if (series->isVisible()) - series->setVisible(false); - else - series->setVisible(true); - } - } + if (items.length() > 0){ - } + ui->waveFrontTable->selectRow(items[0]->row()); } + return closeNdx; } - diff --git a/astigpolargraph.h b/astigpolargraph.h index a1e98b5a..fc0faa54 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -29,15 +29,19 @@ class astigPolargraph : public QDialog public: explicit astigPolargraph(QList list,QWidget *parent = nullptr); ~astigPolargraph(); + signals: void waveSeleted(QString); private slots: - void on_waveFrontTable_cellDoubleClicked(int row, int column); + void tooltip(QPointF point, bool state); private: + int findClosestPoint(const QPointF clickedPoint ); Ui::astigPolargraph *ui; QPolarChart *chart; - + QList m_list; +public: + void hideHoverHelp(); }; #endif // ASTIGPOLARGRAPH_H diff --git a/astigpolargraph.ui b/astigpolargraph.ui index 5c0600d6..deefb0a8 100644 --- a/astigpolargraph.ui +++ b/astigpolargraph.ui @@ -16,6 +16,30 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Hover over right side end point to highlight associated wave front. + + + + + + + diff --git a/surfacemanager.cpp b/surfacemanager.cpp index b826870e..d608fdfb 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -1958,7 +1958,7 @@ textres SurfaceManager::Phase2(QList list, QList inp QImage contour(Width , Height, QImage::Format_ARGB32 ); results.Edit = editor; - editor->resize(Width, Height); + editor->resize(Width * 1.2, Height); doc->setPageSize(printer.pageLayout().paintRectPixels(printer.resolution()).size()); cv::Mat standavg = cv::Mat::zeros(inputs[0]->workData.size(), numType); @@ -2360,6 +2360,7 @@ textres SurfaceManager::Phase2(QList list, QList inp "at each rotation angle.


The plot below is a polar plot of each rotations test stand astig." "The ideal would be they are all the same magnitude and angle. If any one is much different than the rest then the astig removal may not be good."); astigPolargraph *polar = new astigPolargraph(samples); + polar->hideHoverHelp(); polar->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint); polar->resize(Width * 2, 2 * Width); QImage polarImage(2 * Width, 2 * Width , QImage::Format_ARGB32 ); From 94da42fd1ab929380a1805ab021e84aece32c2a9 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Fri, 23 May 2025 01:54:24 -0500 Subject: [PATCH 07/13] modified polar plot line pin to adjust to screen resolution so it not so thick on low resolution screens. --- astigpolargraph.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index 9fd65078..b6507c68 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -11,7 +11,6 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : chart = new QPolarChart(); - // process each wave front and place astig on the chart ui->waveFrontTable->setRowCount(list.size()); ui->waveFrontTable->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -32,7 +31,11 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : double maxAstig = 1.; QVector wavefronts =SurfaceManager::get_instance()->m_wavefronts; - + QScreen *screen = QGuiApplication::primaryScreen(); + qreal screenDPI = screen->physicalDotsPerInchX(); + int pensize = 5 * screenDPI/256.; // adjust pen size to screen resolution. 256 is DPI of my 4K 17 inch laptop + if (pensize < 1) + pensize = 1; for(int ndx = 0; ndx < list.length(); ++ndx){ QString name = list[ndx].m_name; @@ -74,7 +77,7 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : connect(line, &QLineSeries::hovered, this, &astigPolargraph::tooltip); chart->legend()->markers(line)[0]->setVisible(false); - line->setPen(QPen(series->brush(),5)); + line->setPen(QPen(series->brush(),pensize)); QTableWidgetItem *pv = new QTableWidgetItem(QString().number(mag), 0); item->setForeground(series->brush()); From fd4630fd04f1dc8cc674d8e983858389ea357ec2 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Fri, 23 May 2025 04:44:49 -0500 Subject: [PATCH 08/13] added click astig table selectes wave front and highlights polar plot line. Second click restore line --- astigpolargraph.cpp | 39 +++++++++++++++++++++++++++++++++++++++ astigpolargraph.h | 4 ++++ 2 files changed, 43 insertions(+) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index b6507c68..02f0e896 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -150,3 +150,42 @@ int astigPolargraph::findClosestPoint(const QPointF clickedPoint){ } return closeNdx; } + +void astigPolargraph::on_waveFrontTable_itemClicked(QTableWidgetItem *item) +{ + QString name = ui->waveFrontTable->item(item->row(),0)->text(); + emit waveSeleted(name); + + int lastndx = name.lastIndexOf('/'); + if (lastndx != -1) + name = name.mid(lastndx); + + + int seriesCount = chart->series().count(); + + for (int i = 0; i < seriesCount; ++i) { + QAbstractSeries* series = chart->series().at(i); + if (series) { + + if (series->type()== QAbstractSeries::SeriesTypeLine){ + if (series->name() == name){ + QLineSeries *line = static_cast(series); + // Create a pen object to get the current pen attributes. + QPen pen = line->pen(); + if (pen.style() == Qt::DotLine){ + pen.setStyle(Qt::SolidLine); + pen.setWidth(pen.width()/4); + } + else { + pen.setStyle(Qt::DotLine); + pen.setWidth(pen.width() * 4); + } + + line->setPen(pen); + } + } + + } + } +} + diff --git a/astigpolargraph.h b/astigpolargraph.h index fc0faa54..7a277f0b 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -9,6 +9,8 @@ #include #include #include "wavefront.h" +#include + QT_CHARTS_USE_NAMESPACE namespace Ui { class astigPolargraph; @@ -35,6 +37,8 @@ class astigPolargraph : public QDialog private slots: void tooltip(QPointF point, bool state); + void on_waveFrontTable_itemClicked(QTableWidgetItem *item); + private: int findClosestPoint(const QPointF clickedPoint ); Ui::astigPolargraph *ui; From 430c5d8a2bbcf5495ad07367927435d0311cec79 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Fri, 23 May 2025 14:14:30 -0500 Subject: [PATCH 09/13] Added do not null to save and load wave fronts for those that should not have the null added to them. Updated subtract dialog help info. Chaned subtract dialog not to show the currently selected wave front since you usually don't want to subtract the same wave front from itself. --- subtractwavefronatsdlg.ui | 2 +- surfacemanager.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/subtractwavefronatsdlg.ui b/subtractwavefronatsdlg.ui index 171959ac..86274b58 100644 --- a/subtractwavefronatsdlg.ui +++ b/subtractwavefronatsdlg.ui @@ -17,7 +17,7 @@ - <html><head/><body><p>Select wavefront to be subtracted from the currently viewed wavefront. Remember to disable the software null in the mirror configuration in order to view the result properly.</p><p>When you subtract two wavefronts that both needed to have SA software null subtracted from them because the interferogram that made them was taken at ROC of the mirror under test, the result will have not have the original SA in it.</p><p>As a result subtracting the artificial null will artificially change the SA of the result. Usually you don't want that to happen.</p><p>So in this case do not check this check box.</p><p>If you are using the subtraction operation to remove system errors for example then you want to have this check box checked.</p><p><br/></p></body></html> + <html><head/><body><p>Select wavefront to be subtracted from the currently viewed wavefront. </p><p><span style=" font-weight:700;">When to check the &quot;Use softwar Null after subtraction&quot;.</span></p><p>When you subtract two wavefronts that both needed to have SA software null subtracted from them because for example the interferogram that made them was taken at ROC of the mirror under test, the result will have not have the original SA in it. Usually that is what you want. You just want to see the difference. In that case do not check the box.</p><p>If you are using the subtraction operation to remove system errors, for example if you have a test stand only induced wave front you want to subtract from the selected wave front then you want to <span style=" font-weight:700;">check that box</span>.</p><p><br/></p></body></html> true diff --git a/surfacemanager.cpp b/surfacemanager.cpp index d608fdfb..4ebd3e60 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -949,6 +949,9 @@ void SurfaceManager::writeWavefront(QString fname, wavefront *wf, bool saveNulle file << "DIAM " << wf->diameter << std::endl; file << "ROC " << wf->roc << std::endl; file << "Lambda " << wf->lambda << std::endl; + if (!wf->useSANull){ + file << "Do Not use null" << 1 << std::endl; + } mirrorDlg &md = *mirrorDlg::get_Instance(); if (md.isEllipse()){ file << "ellipse_vertical_axis " << md.m_verticalAxis; @@ -1146,7 +1149,7 @@ wavefront * SurfaceManager::readWaveFront(QString fileName){ md->m_outlineShape = ELLIPSE; iss >> dummy >> md->m_verticalAxis; } - if (l.startsWith("nulled")){ + if (l.startsWith("Do Not use null")){ wf->useSANull = false; } } @@ -1781,10 +1784,15 @@ void SurfaceManager::subtract(wavefront *wf1, wavefront *wf2, bool use_null){ void SurfaceManager::subtractWavefronts(){ QList list; + QList doThese = m_surfaceTools->SelectedWaveFronts(); for (int i = 0; i < m_wavefronts.size(); ++i){ - list.append(m_wavefronts[i]->name); + if (m_wavefronts[i]->name != doThese[0]) + list.append(m_wavefronts[i]->name); } subtractWavefronatsDlg dlg(list); + QScreen *screen = QGuiApplication::primaryScreen(); + QSizeF physicalSize = screen->availableSize(); + dlg.resize(physicalSize.width()/2,physicalSize.height()/2); if (dlg.exec()){ int ndx2 = dlg.getSelected(); if (ndx2 == -1){ From 3f9086df7b9688111c6f6d5626da52315caef5c9 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Fri, 23 May 2025 18:26:46 -0500 Subject: [PATCH 10/13] added click as well as hover to select polar line --- astigpolargraph.cpp | 6 ++++++ astigpolargraph.h | 2 +- astigpolargraph.ui | 2 +- surfacemanager.cpp | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index 02f0e896..aa880750 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -75,6 +75,7 @@ astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : line->attachAxis(angularAxis); line->setName(name); connect(line, &QLineSeries::hovered, this, &astigPolargraph::tooltip); + connect(line, &QLineSeries::clicked, this, &astigPolargraph::clicked); chart->legend()->markers(line)[0]->setVisible(false); line->setPen(QPen(series->brush(),pensize)); @@ -105,7 +106,12 @@ void astigPolargraph::tooltip(QPointF point, bool state) } } +void astigPolargraph::clicked(QPointF point) +{ + + findClosestPoint(point); +} astigPolargraph::~astigPolargraph() { delete ui; diff --git a/astigpolargraph.h b/astigpolargraph.h index 7a277f0b..9a1e7013 100644 --- a/astigpolargraph.h +++ b/astigpolargraph.h @@ -36,7 +36,7 @@ class astigPolargraph : public QDialog void waveSeleted(QString); private slots: void tooltip(QPointF point, bool state); - + void clicked(QPointF point); void on_waveFrontTable_itemClicked(QTableWidgetItem *item); private: diff --git a/astigpolargraph.ui b/astigpolargraph.ui index deefb0a8..7cddb452 100644 --- a/astigpolargraph.ui +++ b/astigpolargraph.ui @@ -32,7 +32,7 @@ - Hover over right side end point to highlight associated wave front. + Hover or left click over right side end point to highlight associated wave front. diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 4ebd3e60..6c79629d 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -1786,7 +1786,7 @@ void SurfaceManager::subtractWavefronts(){ QList list; QList doThese = m_surfaceTools->SelectedWaveFronts(); for (int i = 0; i < m_wavefronts.size(); ++i){ - if (m_wavefronts[i]->name != doThese[0]) + if (!m_wavefronts[i]->name.contains(doThese[0])) list.append(m_wavefronts[i]->name); } subtractWavefronatsDlg dlg(list); From 9ca57d4b16f353b9148b0d998f83a3efdbefb715 Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Mon, 26 May 2025 13:07:59 -0500 Subject: [PATCH 11/13] updated version history and my .pro file --- DFTFringe_Dale.pro | 2 +- RevisionHistory.html | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/DFTFringe_Dale.pro b/DFTFringe_Dale.pro index b0208d0f..c4307ac2 100644 --- a/DFTFringe_Dale.pro +++ b/DFTFringe_Dale.pro @@ -423,7 +423,7 @@ RC_FILE = DFTFringe.rc QMAKE_CXXFLAGS += -std=c++11 # The application version -VERSION = Dale7.3.0 +VERSION = Dale7.3.2 # Define the preprocessor macro to get the application version in our application. DEFINES += APP_VERSION=\\\"$$VERSION\\\" diff --git a/RevisionHistory.html b/RevisionHistory.html index f6b877b6..af98d5eb 100644 --- a/RevisionHistory.html +++ b/RevisionHistory.html @@ -425,9 +425,18 @@
  • Added polar plot of the astig of selected wave fronts under View menu.
  • Changed create movie feature to add user provided prefix to each from created.
  • Added hot keys to import interferogram
  • -
  • Added hot key to help
  • +
  • Added hot key help
  • User can move mouse cursor over any profile shown, click and drag it up or down. Useful for comparing two work sessions results so that they match at zero height.
  • If mouse is over the profile plot the scroll wheel can increase or decrease the y axis range.
  • Added auto collimation setting to Ronchi and Foucault feature
  • Remembered last ROC offset value in Ronchi and Foucault feature to remember last setting when wave front is changed to a different value
  • + +d +
    • Version 7.3.2
    • +
        +
      • Added hover and click to astig polar plot to select the wave front and show it as the currently selected wave front. Added click to astig polar table to highlight the line on the plot and disaply as current wave front.
      • +
      • Corrected test stand astig removal featue to display the correct image sizes on the report no matter what the screen resolution is.
      • +
      • Corrected bug when subtracted wave front result is saved and then loaded so that it does not lose the fact to use or not use the null.
      • +
      • Updated the subtract dialog to display a resonable size based on screen resolution. Improved help information.
      • +
      From d361f8bfa2bc829dd5b7157ff0fe0e4464ca9cdf Mon Sep 17 00:00:00 2001 From: Dale O Eason Date: Tue, 27 May 2025 21:52:22 -0500 Subject: [PATCH 12/13] Update RevisionHistory.html Co-authored-by: Julien Staub --- RevisionHistory.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RevisionHistory.html b/RevisionHistory.html index af98d5eb..2d6af3c9 100644 --- a/RevisionHistory.html +++ b/RevisionHistory.html @@ -435,8 +435,8 @@ d
      • Version 7.3.2
        • -
        • Added hover and click to astig polar plot to select the wave front and show it as the currently selected wave front. Added click to astig polar table to highlight the line on the plot and disaply as current wave front.
        • -
        • Corrected test stand astig removal featue to display the correct image sizes on the report no matter what the screen resolution is.
        • +
        • Added hover and click to astig polar plot to select the wave front and show it as the currently selected wave front. Added click to astig polar table to highlight the line on the plot and display as current wave front.
        • +
        • Corrected test stand astig removal feature to display the correct image sizes on the report no matter what the screen resolution is.
        • Corrected bug when subtracted wave front result is saved and then loaded so that it does not lose the fact to use or not use the null.
        • -
        • Updated the subtract dialog to display a resonable size based on screen resolution. Improved help information.
        • +
        • Updated the subtract dialog to display a reasonable size based on screen resolution. Improved help information.
        From 832feb68dc53c98539cc7355446dd33d915f3a3c Mon Sep 17 00:00:00 2001 From: Dale Eason Date: Wed, 28 May 2025 12:25:36 -0500 Subject: [PATCH 13/13] deleted some unused variables and a debug --- surfacemanager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 6c79629d..b186dccc 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -1563,7 +1563,7 @@ void SurfaceManager::average(QList wfList){ QApplication::setOverrideCursor(Qt::WaitCursor); -qDebug() << "maxkey" << maxkey << rrows << rcols << sizes[maxkey]; + cv::Mat mask = wfList[sizes[maxkey][0]]->workMask.clone(); if (mask.cols != rcols || mask.rows != rrows){ cv::resize(mask,mask,Size(rrows,rcols)); @@ -2452,8 +2452,7 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListresize(printer.pageLayout().paintRectPixels(printer.resolution()).size()); - const int contourWidth = 2 * 340/3; - const int contourHeight = 2 * 360/3; + QImage contour = QImage(Width ,Width, QImage::Format_ARGB32 );