From 6c8b1152e77ee3f76e7ec57b19e40e1ab4e5b7bf Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Sat, 26 Jul 2025 21:53:38 +0200 Subject: [PATCH 1/3] all QT5 compatible changes required for QT6 --- IgramArea.h | 3 --- astigpolargraph.cpp | 1 + astigstatsdlg.cpp | 4 ++- astigzoomer.cpp | 3 ++- averagewavefrontfilesdlg.cpp | 2 +- cameracalibwizard.cpp | 2 +- contourplot.cpp | 1 + contourrulerparams.cpp | 2 +- contourtools.cpp | 4 +-- contourtools.h | 4 +-- dftarea.cpp | 1 - foucaultview.cpp | 28 +++++++++---------- generatetargetdlg.cpp | 22 ++++++--------- graphmodifier.cpp | 3 --- igramarea.cpp | 52 ++++++++++++++++++------------------ igramintensity.cpp | 2 ++ main.cpp | 8 +++--- mainwindow.cpp | 6 ++--- nullvariationdlg.cpp | 1 + oglview.cpp | 2 -- outlinedialog.cpp | 1 - outlinestatsdlg.cpp | 3 ++- percentcorrectiondlg.h | 1 - pixelstats.cpp | 1 + psfplot.cpp | 1 + psi_dlg.cpp | 4 +-- psi_dlg.h | 2 +- settingsdebug.cpp | 1 - settingsgeneral2.cpp | 2 +- settingsigram.cpp | 2 +- settingsprofile.cpp | 6 ++--- showallcontoursdlg.cpp | 1 - simulationsview.cpp | 16 +++++------ standastigwizard.cpp | 3 ++- surfacegraph.cpp | 1 - surfacemanager.cpp | 32 +++++++++++----------- unwraperrorsview.cpp | 1 - zernikeprocess.cpp | 16 +++++------ zernikeprocess.h | 39 +-------------------------- 39 files changed, 119 insertions(+), 165 deletions(-) diff --git a/IgramArea.h b/IgramArea.h index ac2807cb..715332d0 100644 --- a/IgramArea.h +++ b/IgramArea.h @@ -73,9 +73,6 @@ #include #include "dftthumb.h" #include -#include -#include -#include #include #include "settingsigram.h" #include diff --git a/astigpolargraph.cpp b/astigpolargraph.cpp index bba6eab6..7351800d 100644 --- a/astigpolargraph.cpp +++ b/astigpolargraph.cpp @@ -1,6 +1,7 @@ #include "astigpolargraph.h" #include "ui_astigpolargraph.h" #include "surfacemanager.h" +#include astigPolargraph::astigPolargraph( QListlist, QWidget *parent) : diff --git a/astigstatsdlg.cpp b/astigstatsdlg.cpp index 31e4ce1a..4cbf1bef 100644 --- a/astigstatsdlg.cpp +++ b/astigstatsdlg.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -53,7 +55,7 @@ class Zoomer: public QwtPlotZoomer Zoomer( QWidget *canvas, QwtPlot * plot ): QwtPlotZoomer( canvas ),mPlot(plot) { - setRubberBandPen( QColor( Qt::lightGray ) ); + setRubberBandPen( QPen( Qt::lightGray ) ); setTrackerMode( QwtPlotPicker::AlwaysOn ); } diff --git a/astigzoomer.cpp b/astigzoomer.cpp index 03eceddb..64310a46 100644 --- a/astigzoomer.cpp +++ b/astigzoomer.cpp @@ -3,11 +3,12 @@ #include #include #include +#include astigZoomer::astigZoomer( QWidget *canvas, QwtPlot * plot ): QwtPlotZoomer( canvas ),mPlot(plot) { - setRubberBandPen( QColor( Qt::lightGray ) ); + setRubberBandPen( QPen( Qt::lightGray ) ); setTrackerMode( QwtPlotPicker::AlwaysOn ); } diff --git a/averagewavefrontfilesdlg.cpp b/averagewavefrontfilesdlg.cpp index e6e51556..c565936a 100644 --- a/averagewavefrontfilesdlg.cpp +++ b/averagewavefrontfilesdlg.cpp @@ -9,7 +9,7 @@ #include "utils.h" #include -void showData(const std::string &txt, Mat mat, bool useLog); +void showData(const std::string &txt, cv::Mat mat, bool useLog); averageWaveFrontFilesDlg::averageWaveFrontFilesDlg(QStringList list, SurfaceManager *m, QWidget *parent) : QDialog(parent), ui(new Ui::averageWaveFrontFilesDlg) diff --git a/cameracalibwizard.cpp b/cameracalibwizard.cpp index c17032bf..0d1421c9 100644 --- a/cameracalibwizard.cpp +++ b/cameracalibwizard.cpp @@ -1,9 +1,9 @@ #include "cameracalibwizard.h" #include "ui_cameracalibwizard.h" +#include "spdlog/spdlog.h" #include #include #include "camwizardpage1.h" -#include "spdlog/spdlog.h" cameraCalibWizard::cameraCalibWizard(QWidget *parent) : QWizard(parent), diff --git a/contourplot.cpp b/contourplot.cpp index b0f6f0a1..70dda44d 100644 --- a/contourplot.cpp +++ b/contourplot.cpp @@ -42,6 +42,7 @@ #include #include #include +#include "spdlog/spdlog.h" double zOffset = 0; diff --git a/contourrulerparams.cpp b/contourrulerparams.cpp index dc626931..31f7814d 100644 --- a/contourrulerparams.cpp +++ b/contourrulerparams.cpp @@ -35,7 +35,7 @@ void ContourRulerParams::on_radialAngleSB_valueChanged(int arg1) void ContourRulerParams::on_setColorPB_clicked() { - QColor color = QColorDialog::getColor( ui->setColorPB->palette().color(QPalette::Background)); + QColor color = QColorDialog::getColor( ui->setColorPB->palette().color(QPalette::Window)); QSettings set; set.setValue("contourRulerColor", color.name()); diff --git a/contourtools.cpp b/contourtools.cpp index 08d4bef0..22b83417 100644 --- a/contourtools.cpp +++ b/contourtools.cpp @@ -114,12 +114,12 @@ void ContourTools::on_ColorMapCB_activated(int index) -void ContourTools::on_zeroOffsetCB_activated(const QString &arg1) +void ContourTools::on_zeroOffsetCB_textActivated(const QString &arg1) { emit contourZeroOffsetChanged(arg1); } -void ContourTools::on_colorRangeCB_activated(const QString &arg1) +void ContourTools::on_colorRangeCB_textActivated(const QString &arg1) { ui->errorRangeSpin->setEnabled(arg1 == "Fractions of Wave"); emit contourColorRangeChanged(arg1); diff --git a/contourtools.h b/contourtools.h index 09dedfd2..c070e04a 100644 --- a/contourtools.h +++ b/contourtools.h @@ -56,9 +56,9 @@ private slots: void setWaveRange(double val); void on_ColorMapCB_activated(int index); - void on_zeroOffsetCB_activated(const QString &arg1); + void on_zeroOffsetCB_textActivated(const QString &arg1); - void on_colorRangeCB_activated(const QString &arg1); + void on_colorRangeCB_textActivated(const QString &arg1); void on_errorRangeSpin_valueChanged(double arg1); diff --git a/dftarea.cpp b/dftarea.cpp index f8895b45..e741faf3 100644 --- a/dftarea.cpp +++ b/dftarea.cpp @@ -30,7 +30,6 @@ #include #include #include -using namespace cv; cv::Mat makeMask(CircleOutline outside, CircleOutline center, cv::Mat data, diff --git a/foucaultview.cpp b/foucaultview.cpp index 0b917774..e4f56b3a 100644 --- a/foucaultview.cpp +++ b/foucaultview.cpp @@ -1,5 +1,6 @@ #include "foucaultview.h" #include "ui_foucaultview.h" +#include "spdlog/spdlog.h" #include "mirrordlg.h" #include #include @@ -7,7 +8,6 @@ #include #include #include "zernikeprocess.h" -#include "spdlog/spdlog.h" extern double outputLambda; @@ -220,17 +220,17 @@ void foucaultView::on_makePb_clicked() double hy = hx; cv::Mat vknife[] = {cv::Mat::zeros(size,size,CV_64FC1) - ,cv::Mat::zeros(Size(size,size),CV_64FC1)}; + ,cv::Mat::zeros(cv::Size(size,size),CV_64FC1)}; cv::Mat ronchiGrid[] = {cv::Mat::zeros(size,size,CV_64FC1) - ,cv::Mat::zeros(Size(size,size),CV_64FC1)}; + ,cv::Mat::zeros(cv::Size(size,size),CV_64FC1)}; cv::Mat slit[] = {cv::Mat::zeros(size,size,CV_64FC1) - ,cv::Mat::zeros(Size(size,size),CV_64FC1)}; + ,cv::Mat::zeros(cv::Size(size,size),CV_64FC1)}; cv::Mat ronchiSlit[] = {cv::Mat::zeros(size,size,CV_64FC1) - ,cv::Mat::zeros(Size(size,size),CV_64FC1)}; + ,cv::Mat::zeros(cv::Size(size,size),CV_64FC1)}; // compute real world pixel width. double pixwidth = outputLambda * 1.E-6* Fnumber * 2./(25.4 * pad); @@ -311,7 +311,7 @@ void foucaultView::on_makePb_clicked() } } - Mat FFT1, FFT2; + cv::Mat FFT1, FFT2; //fftw_plan p; cv::Mat complexIn; cv::Mat complexIn2; @@ -323,18 +323,18 @@ void foucaultView::on_makePb_clicked() //showData("rslit", ronchiSlit[0]); - dft(complexIn, FFT1, DFT_REAL_OUTPUT); + dft(complexIn, FFT1, cv::DFT_REAL_OUTPUT); shiftDFT(FFT1); - dft(complexIn2, FFT2, DFT_REAL_OUTPUT); + dft(complexIn2, FFT2, cv::DFT_REAL_OUTPUT); shiftDFT(FFT2); cv::Mat knifeSlit; mulSpectrums(FFT1, FFT2, knifeSlit, 0, true); - idft(knifeSlit, knifeSlit, DFT_SCALE); // gives us the correlation result... + idft(knifeSlit, knifeSlit, cv::DFT_SCALE); // gives us the correlation result... shiftDFT(knifeSlit); cv::Mat knifeSurf; mulSpectrums(knifeSlit, surf_fftRonchi, knifeSurf,0,true); - idft(knifeSurf, knifeSurf, DFT_SCALE); + idft(knifeSurf, knifeSurf, cv::DFT_SCALE); shiftDFT(knifeSurf); QImage ronchi = showMag(knifeSurf, false,"", false, gamma); @@ -372,15 +372,15 @@ void foucaultView::on_makePb_clicked() merge(slit,2,complexIn2); - dft(complexIn, FFT1, DFT_REAL_OUTPUT); - dft(complexIn2, FFT2, DFT_REAL_OUTPUT); + dft(complexIn, FFT1, cv::DFT_REAL_OUTPUT); + dft(complexIn2, FFT2, cv::DFT_REAL_OUTPUT); mulSpectrums(FFT1, FFT2, knifeSlit, 0, true); - idft(knifeSlit, knifeSlit, DFT_SCALE); // gives us the correlation result... + idft(knifeSlit, knifeSlit, cv::DFT_SCALE); // gives us the correlation result... mulSpectrums(knifeSlit, surf_fft, knifeSurf,0,true); - idft(knifeSurf, knifeSurf, DFT_SCALE); + idft(knifeSurf, knifeSurf, cv::DFT_SCALE); m_foucultQimage = showMag(knifeSurf, false,"", false, gamma); diff --git a/generatetargetdlg.cpp b/generatetargetdlg.cpp index dbe8dd39..dc098db9 100644 --- a/generatetargetdlg.cpp +++ b/generatetargetdlg.cpp @@ -1,6 +1,7 @@ #include "generatetargetdlg.h" #include "ui_generatetargetdlg.h" -#include +#include +#include #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" @@ -16,8 +17,9 @@ generateTargetDlg::generateTargetDlg(QWidget *parent) : ui(new Ui::generateTargetDlg), m_units(INCHES) { ui->setupUi(this); - m_dpix = qApp->desktop()->physicalDpiX(); - m_dpiy = qApp->desktop()->physicalDpiY(); + QScreen *screen = QGuiApplication::primaryScreen(); + m_dpix = screen->physicalDotsPerInchX(); + m_dpiy = screen->physicalDotsPerInchY(); ui->printerGroup->hide(); QSettings set; ui->rows->setValue(set.value("target rows", 10).toInt()); @@ -38,17 +40,9 @@ void generateTargetDlg::on_generate_clicked() int vsize; if (ui->fullScreen->isChecked()){ - // make sure sizes are even - hsize = qApp->desktop()->width(); - hsize/=2; - hsize *= 2; - - vsize = qApp->desktop()->height(); - vsize /=2; - vsize *= 2; - - - + QScreen *screen = QGuiApplication::primaryScreen(); + hsize = screen->geometry().width(); + vsize = screen->geometry().height(); } else { double mul = 1.; diff --git a/graphmodifier.cpp b/graphmodifier.cpp index 05772685..b829a5c7 100644 --- a/graphmodifier.cpp +++ b/graphmodifier.cpp @@ -39,9 +39,6 @@ #include #include -using namespace QtDataVisualization; - - //! [0] GraphModifier::GraphModifier(Q3DBars *bargraph) diff --git a/igramarea.cpp b/igramarea.cpp index aa546a93..69505052 100644 --- a/igramarea.cpp +++ b/igramarea.cpp @@ -256,7 +256,7 @@ void IgramArea::doGamma(double gammaV){ } -Mat IgramArea::qImageToMat(QImage &img){ +cv::Mat IgramArea::qImageToMat(QImage &img){ QImage::Format f = img.format(); int depth = img.depth(); int planesCnt = img.bitPlaneCount(); @@ -277,7 +277,7 @@ Mat IgramArea::qImageToMat(QImage &img){ return iMat; } -Mat IgramArea::igramToGray(cv::Mat roi){ +cv::Mat IgramArea::igramToGray(cv::Mat roi){ // split image into three color planes cv::Mat planes[4]; @@ -324,17 +324,17 @@ Mat IgramArea::igramToGray(cv::Mat roi){ cv::Mat toSobel(cv::Mat roi){ /// Generate grad_x and grad_y - Mat grad_x, grad_y, grad; - Mat abs_grad_x, abs_grad_y; + cv::Mat grad_x, grad_y, grad; + cv::Mat abs_grad_x, abs_grad_y; int scale = 1; /// Gradient X //Scharr( src_gray, grad_x, ddepth, 1, 0, scale, delta, BORDER_DEFAULT ); - cv::Sobel( roi, grad_x, -1, 1, 0, 3, scale, 0, BORDER_DEFAULT ); + cv::Sobel( roi, grad_x, -1, 1, 0, 3, scale, 0, cv::BORDER_DEFAULT ); cv::convertScaleAbs( grad_x, abs_grad_x ); /// Gradient Y //Scharr( src_gray, grad_y, ddepth, 0, 1, scale, delta, BORDER_DEFAULT ); - cv::Sobel( roi, grad_y, -1, 0, 1, 3, scale, 0, BORDER_DEFAULT ); + cv::Sobel( roi, grad_y, -1, 0, 1, 3, scale, 0, cv::BORDER_DEFAULT ); cv::convertScaleAbs( grad_y, abs_grad_y ); /// Total Gradient (approximate) @@ -384,11 +384,11 @@ cv::Point2d IgramArea::findBestCenterOutline(cv::Mat gray, int start, int end,in double resp; cv::Point2d center = cv::phaseCorrelate(cv::Mat_(gray),cv::Mat_(circlem), - noArray(), &resp); + cv::noArray(), &resp); int x = cx - center.x; int y = cy - center.y; - Point2d c(x,y); + cv::Point2d c(x,y); if (cnt == 1){ rmean = resp; } @@ -474,11 +474,11 @@ cv::Point2d IgramArea::findBestOutsideOutline(cv::Mat gray, int start, int end,i double resp; cv::Point2d center = cv::phaseCorrelate(cv::Mat_(gray),cv::Mat_(circlem), - noArray(), &resp); + cv::noArray(), &resp); resp = fabs(resp); // compute location from the shift - Point2d c(cx - center.x, cy - center.y); + cv::Point2d c(cx - center.x, cy - center.y); if (showDebug){ cv::Mat t = gray.clone(); cv::circle(t, c, rad0, cv::Scalar(255), 1); @@ -595,10 +595,10 @@ void IgramArea::findCenterHole(){ int start = 10; int end = m_outside.m_radius/2 * scale; cv::Rect bounds; - Point2d firstPassCenter; + cv::Point2d firstPassCenter; int radius; int x,y; - Point2d bestc; + cv::Point2d bestc; if (useExisting){ radius = m_center.m_radius; start = m_center.m_radius * scale -searchRange; @@ -609,7 +609,7 @@ void IgramArea::findCenterHole(){ bounds.height = 10; x = m_center.m_center.x(); y = m_center.m_center.y(); - firstPassCenter = Point2d(x,y); + firstPassCenter = cv::Point2d(x,y); bestc = firstPassCenter; } else { @@ -621,7 +621,7 @@ void IgramArea::findCenterHole(){ radius/= scale; if (useExisting) radius = m_center.m_radius; - firstPassCenter = Point2d(x,y); + firstPassCenter = cv::Point2d(x,y); } // phase 2 search for full size hole @@ -681,12 +681,12 @@ void IgramArea::findCenterHole(){ double resp; cv::Point2d center = cv::phaseCorrelate(cv::Mat_(roi),cv::Mat_(key), - noArray(), &resp); + cv::noArray(), &resp); int x = cx - center.x; int y = cy - center.y; - Point2d c(x,y); - Point2d secondPassCenter(x + left, y); + cv::Point2d c(x,y); + cv::Point2d secondPassCenter(x + left, y); // if center is more than 1/2 diameter away from outside center then reject int delx = abs(secondPassCenter.x - firstPassCenter.x); int dely = abs(secondPassCenter.y - firstPassCenter.y); @@ -807,7 +807,7 @@ void IgramArea::findOutline(){ emit statusBarUpdate(QString("margin %1 %2").arg(searchMargin).arg(radius),3); } else { - bestc = Point2d(m_outside.m_center.x(), m_outside.m_center.y()); + bestc = cv::Point2d(m_outside.m_center.x(), m_outside.m_center.y()); radius = m_outside.m_radius; searchMargin = set.value("outlineScanRange", 40).toInt(); @@ -837,7 +837,7 @@ void IgramArea::findOutline(){ 2 * searchMargin, 2 * searchMargin); cv::Mat showRect = roi.clone(); - cv::rectangle(showRect, centerBound, Scalar(255,255,255), 3); + cv::rectangle(showRect, centerBound, cv::Scalar(255,255,255), 3); bestc = findBestOutsideOutline(roi, radius + searchMargin, radius -searchMargin, -1, &radius, 2); m_searching_outside = false; @@ -996,10 +996,10 @@ bool IgramArea::openImage(const QString &fileName, bool showBoundary) loadedImage = loadedImage.convertToFormat(QImage::Format_RGB888); if (Settings2::getInstance()->m_igram->m_removeDistortion){ - cv::Mat raw = imread(fileName.toStdString().c_str()); + cv::Mat raw = cv::imread(fileName.toStdString().c_str()); QStringList parms = Settings2::getInstance()->m_igram->m_lenseParms; - Mat camera = Mat::zeros(3,3,CV_64FC1); - Mat distortion =Mat::zeros(1,5, CV_64FC1); + cv::Mat camera = cv::Mat::zeros(3,3,CV_64FC1); + cv::Mat distortion =cv::Mat::zeros(1,5, CV_64FC1); camera.at(0,0) = parms[6].toDouble(); camera.at(1,1) = camera.at(0,0); @@ -1014,13 +1014,13 @@ bool IgramArea::openImage(const QString &fileName, bool showBoundary) std::stringstream ss; ss << "camera "<< camera << std::endl <<"distortion " << distortion; qDebug() << ss.str().c_str(); - Mat corrected; + cv::Mat corrected; - Mat view, rview, map1, map2; + cv::Mat view, rview, map1, map2; undistort(raw, corrected, camera, distortion); - cvtColor(corrected,corrected, COLOR_BGR2RGB); + cv::cvtColor(corrected, corrected, cv::COLOR_BGR2RGB); loadedImage = QImage((uchar*)corrected.data, corrected.cols, corrected.rows, @@ -1859,7 +1859,7 @@ void IgramArea::resizeImage() double scalew = (double)parentWidget()->width()/(double)igramGray.width(); newSize = gscrollArea->size(); gscrollArea->setWidgetResizable(true); - scale = min(scaleh,scalew); + scale = cv::min(scaleh,scalew); } try { QImage newImage(newSize, QImage::Format_RGB888); diff --git a/igramintensity.cpp b/igramintensity.cpp index 815154bb..a6d4c659 100644 --- a/igramintensity.cpp +++ b/igramintensity.cpp @@ -22,6 +22,8 @@ #include #include #include +#include + igramIntensity::igramIntensity(QWidget *parent) : QDialog(parent), ui(new Ui::igramIntensity) diff --git a/main.cpp b/main.cpp index 64364207..3cead08c 100644 --- a/main.cpp +++ b/main.cpp @@ -15,16 +15,16 @@ ** along with DFTFringe. If not, see . ****************************************************************************/ +#include "spdlog/spdlog.h" +#include "spdlog/sinks/rotating_file_sink.h" +#include "spdlog/sinks/stdout_color_sinks.h" +#include "boost/stacktrace.hpp" #include "mainwindow.h" #include #include "singleapplication.h" #include "messagereceiver.h" #include "utils.h" #include -#include "spdlog/spdlog.h" -#include "spdlog/sinks/rotating_file_sink.h" -#include "spdlog/sinks/stdout_color_sinks.h" -#include "boost/stacktrace.hpp" static void my_terminate_handler() { diff --git a/mainwindow.cpp b/mainwindow.cpp index 4059437c..8f3dc2f1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -17,6 +17,7 @@ ****************************************************************************/ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "spdlog/spdlog.h" #include #include #include @@ -47,7 +48,6 @@ #include "utils.h" #include "colorchannel.h" #include "opencv2/opencv.hpp" -#include "spdlog/spdlog.h" #include using namespace QtConcurrent; @@ -209,7 +209,7 @@ MainWindow::MainWindow(QWidget *parent) : QShortcut *shortcutl = new QShortcut(QKeySequence(Qt::Key_L), this); QObject::connect(shortcutl, SIGNAL(activated()), this, SLOT(on_actionLoad_Interferogram_triggered())); - QShortcut *shortcut1 = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_O), this); + QShortcut *shortcut1 = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_O), this); QObject::connect(shortcut1, SIGNAL(activated()), this, SLOT(on_actionLoad_Interferogram_triggered())); connect(m_dftTools,SIGNAL(doDFT()),m_dftArea,SLOT(doDFT())); @@ -1265,7 +1265,7 @@ void MainWindow::batchProcess(QStringList fileList){ if (batchIgramWizard::deletePreviousWave->isChecked()){ QVector zerns; zerns << wf->name; - foreach(double v , wf->InputZerns){ + for(const double &v : wf->InputZerns){ zerns << QString::number(v); } diff --git a/nullvariationdlg.cpp b/nullvariationdlg.cpp index 775c9d69..a6af78ea 100644 --- a/nullvariationdlg.cpp +++ b/nullvariationdlg.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "QLayout" #include "plotcolor.h" diff --git a/oglview.cpp b/oglview.cpp index a894978f..3393e06b 100644 --- a/oglview.cpp +++ b/oglview.cpp @@ -37,7 +37,6 @@ #include #include "surfacemanager.h" -using namespace QtDataVisualization; OGLView::OGLView(QWidget *parent, ContourTools *m_tool) : QWidget(parent), m_spinRate(5) { @@ -167,7 +166,6 @@ void OGLView::saveImage(){ } #include #include "wavefront.h" -#include void OGLView::showSelected() // show all selected wavefronts as 3D plots { QApplication::setOverrideCursor(Qt::WaitCursor); diff --git a/outlinedialog.cpp b/outlinedialog.cpp index ba29f37b..625e941b 100644 --- a/outlinedialog.cpp +++ b/outlinedialog.cpp @@ -2,7 +2,6 @@ #include "ui_outlinedialog.h" #include #include -#include #include #include #include diff --git a/outlinestatsdlg.cpp b/outlinestatsdlg.cpp index d4a2e1e5..d94e76da 100644 --- a/outlinestatsdlg.cpp +++ b/outlinestatsdlg.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -18,7 +19,7 @@ class outlineZoomer: public QwtPlotZoomer outlineZoomer(outlineStatsDlg *dlg, QWidget *canvas, QwtPlot * plot ): QwtPlotZoomer( canvas ), mPlot(plot), m_outlines(*dlg) { - setRubberBandPen( QColor( Qt::lightGray ) ); + setRubberBandPen( QPen( Qt::lightGray ) ); setTrackerMode( QwtPlotPicker::AlwaysOn ); } diff --git a/percentcorrectiondlg.h b/percentcorrectiondlg.h index 0ee20e46..70412afe 100644 --- a/percentcorrectiondlg.h +++ b/percentcorrectiondlg.h @@ -13,7 +13,6 @@ #include #include "graphmodifier.h" #include "percentCorrectionSurface.h" -using namespace QtDataVisualization; namespace Ui { class percentCorrectionDlg; diff --git a/pixelstats.cpp b/pixelstats.cpp index f0c1ad60..e6a4102f 100644 --- a/pixelstats.cpp +++ b/pixelstats.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/psfplot.cpp b/psfplot.cpp index 9f5420e8..8fea6e57 100644 --- a/psfplot.cpp +++ b/psfplot.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include psfPlot::psfPlot(QWidget *parent) : QwtPlot(parent), diff --git a/psi_dlg.cpp b/psi_dlg.cpp index 8bbf4c78..4b61bf51 100644 --- a/psi_dlg.cpp +++ b/psi_dlg.cpp @@ -173,13 +173,13 @@ double PSI_dlg::tolerance(){ return ui->tolerance->value(); } -void PSI_dlg::on_PSIPhaseValue_valueChanged(const QString &arg1) +void PSI_dlg::on_PSIPhaseValue_valueChanged(double arg1) { QSettings set; ui->PhaseList->clear(); m_phases.clear(); - double angle = arg1.toDouble(); + double angle = arg1; set.setValue("PSIPhaseValue", angle); for (int i = 0; i < ui->igramList->count(); ++i){ double ang2 = angle * i; diff --git a/psi_dlg.h b/psi_dlg.h index 4a093487..0d82fd3c 100644 --- a/psi_dlg.h +++ b/psi_dlg.h @@ -41,7 +41,7 @@ private slots: void on_PhaseApproximate_clicked(bool checked); - void on_PSIPhaseValue_valueChanged(const QString &arg1); + void on_PSIPhaseValue_valueChanged(double arg1); void on_computePhase_clicked(); diff --git a/settingsdebug.cpp b/settingsdebug.cpp index b102ed98..c2542f8f 100644 --- a/settingsdebug.cpp +++ b/settingsdebug.cpp @@ -19,7 +19,6 @@ #include "ui_settingsdebug.h" #include "spdlog/spdlog.h" #include -#include "spdlog/spdlog.h" settingsDebug::settingsDebug(QWidget *parent) : QDialog(parent), diff --git a/settingsgeneral2.cpp b/settingsgeneral2.cpp index a6c8e7f7..481567a1 100644 --- a/settingsgeneral2.cpp +++ b/settingsgeneral2.cpp @@ -1,9 +1,9 @@ #include "settingsGeneral2.h" #include "ui_settingsgeneral2.h" +#include "spdlog/spdlog.h" #include #include "contourrulerparams.h" #include -#include "spdlog/spdlog.h" extern double outputLambda; diff --git a/settingsigram.cpp b/settingsigram.cpp index 7f3d2925..f6b54ee9 100644 --- a/settingsigram.cpp +++ b/settingsigram.cpp @@ -17,12 +17,12 @@ ****************************************************************************/ #include "settingsigram.h" #include "ui_settingsigram.h" +#include "spdlog/spdlog.h" #include #include #include #include #include -#include "spdlog/spdlog.h" #include "settingsigramimportconfig.h" static inline QString colorButtonStyleSheet(const QColor &bgColor) { diff --git a/settingsprofile.cpp b/settingsprofile.cpp index 0bd474bd..2a2c1758 100644 --- a/settingsprofile.cpp +++ b/settingsprofile.cpp @@ -17,10 +17,10 @@ ****************************************************************************/ #include "settingsprofile.h" #include "ui_settingsprofile.h" +#include "spdlog/spdlog.h" #include #include #include -#include "spdlog/spdlog.h" static inline QString colorButtonStyleSheet(const QColor &bgColor) { @@ -50,13 +50,13 @@ settingsProfile::settingsProfile(QWidget *parent) : QColor settingsProfile::getColor(int num){ QString name = QString("pushButton_%1").arg(1 + num%7); QPushButton *btn = findChild(name); - return btn->palette().color(QPalette::Background); + return btn->palette().color(QPalette::Window); } void settingsProfile::setColor(int num){ QString name = QString("pushButton_%1").arg(num); QPushButton *btn = findChild(name); - QColor color = QColorDialog::getColor( btn->palette().color(QPalette::Background)); + QColor color = QColorDialog::getColor( btn->palette().color(QPalette::Window)); btn->setStyleSheet(colorButtonStyleSheet(color)); QSettings set; set.setValue("profile color "+name, color.name()); diff --git a/showallcontoursdlg.cpp b/showallcontoursdlg.cpp index d1de842d..c7d8a768 100644 --- a/showallcontoursdlg.cpp +++ b/showallcontoursdlg.cpp @@ -1,7 +1,6 @@ #include "showallcontoursdlg.h" #include "ui_showallcontoursdlg.h" #include -#include #include showAllContoursDlg::showAllContoursDlg( QWidget *parent) : diff --git a/simulationsview.cpp b/simulationsview.cpp index 6aae6223..c489c5ef 100644 --- a/simulationsview.cpp +++ b/simulationsview.cpp @@ -317,8 +317,8 @@ cv::Mat SimulationsView:: computeStarTest(cv::Mat surface, int pupil_size, doubl int nx = surface.size().width;//pupil_size; int ny = surface.size().height; - cv::Mat tmp[] = {cv::Mat::zeros(Size(nx,ny),CV_64FC1) - ,cv::Mat::zeros(Size(nx,ny),CV_64FC1)}; + cv::Mat tmp[] = {cv::Mat::zeros(cv::Size(nx,ny),CV_64FC1) + ,cv::Mat::zeros(cv::Size(nx,ny),CV_64FC1)}; for (int y = 0; y < ny; ++y){ for (int x = 0; x < nx; ++x){ @@ -347,8 +347,8 @@ cv::Mat SimulationsView:: computeStarTest(cv::Mat surface, int pupil_size, doubl cv::resize(tmp[1],tmp[1],cv::Size(padSize,padSize),cv::INTER_AREA); - cv::Mat in[] = {cv::Mat::zeros(Size(pupil_size,pupil_size),CV_64FC1) - ,cv::Mat::zeros(Size(pupil_size,pupil_size),CV_64FC1)}; + cv::Mat in[] = {cv::Mat::zeros(cv::Size(pupil_size,pupil_size),CV_64FC1) + ,cv::Mat::zeros(cv::Size(pupil_size,pupil_size),CV_64FC1)}; tmp[0].copyTo(in[0](cv::Rect(0,0,tmp[0].cols,tmp[0].cols))); tmp[1].copyTo(in[1](cv::Rect(0,0,tmp[0].cols,tmp[0].cols))); @@ -359,7 +359,7 @@ cv::Mat SimulationsView:: computeStarTest(cv::Mat surface, int pupil_size, doubl dft(complexIn,out); shiftDFT(out); //cv::flip(out,out,0); // needs work. - Mat planes[2]; + cv::Mat planes[2]; split(out, planes); magnitude(planes[0], planes[1], planes[0]); @@ -443,8 +443,8 @@ void etoxplusy(cv::Mat data) { if (((j + i) & 0x01) == 1) { - data.at(i,j)[0] *= -1.; - data.at(i,j)[1]= -1.; + data.at(i,j)[0] *= -1.; + data.at(i,j)[1]= -1.; } } @@ -456,7 +456,7 @@ void SimulationsView::mtf(cv::Mat star, QString txt, QColor color){ split(star,planes); cv::magnitude(planes[0],planes[1], planes[0]); cv::pow(planes[0],2,planes[0]); - planes[1] = Scalar(0.); + planes[1] = cv::Scalar(0.); cv::Mat in; merge(planes,2,in); shiftDFT(in); diff --git a/standastigwizard.cpp b/standastigwizard.cpp index 34932879..c99d8ca0 100644 --- a/standastigwizard.cpp +++ b/standastigwizard.cpp @@ -17,12 +17,13 @@ ****************************************************************************/ #include "standastigwizard.h" #include "ui_standastigwizard.h" +#include "spdlog/spdlog.h" #include #include #include #include +#include #include "surfacemanager.h" -#include "spdlog/spdlog.h" QString AstigReportTitle = ""; QString AstigReportPdfName = "stand.pdf"; diff --git a/surfacegraph.cpp b/surfacegraph.cpp index a66821d4..432e7e41 100644 --- a/surfacegraph.cpp +++ b/surfacegraph.cpp @@ -36,7 +36,6 @@ #include #include #include -using namespace QtDataVisualization; int sampleCountX = 50; int sampleCountZ = 50; diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 2f7080b6..5b3dcec8 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -16,6 +16,7 @@ ****************************************************************************/ #include "surfacemanager.h" +#include "spdlog/spdlog.h" #include #include #include @@ -71,7 +72,6 @@ #include "transformwavefrontdlg.h" #include "oglrendered.h" #include "ui_oglrendered.h" -#include "spdlog/spdlog.h" #include "astigpolargraph.h" cv::Mat theMask; @@ -358,7 +358,7 @@ void SurfaceManager::generateSurfacefromWavefront(wavefront * wf){ ++gaussianRad; cv::GaussianBlur( wf->nulledData.clone(), wf->workData, - cv::Size( gaussianRad, gaussianRad ),0,0,BORDER_REFLECT); + cv::Size( gaussianRad, gaussianRad ),0,0,cv::BORDER_REFLECT); } else { wf->workData = wf->data.clone(); @@ -419,7 +419,7 @@ void SurfaceManager::generateSurfacefromWavefront(wavefront * wf){ gaussianRad &= 0xfffffffe; ++gaussianRad; cv::GaussianBlur( wf->nulledData.clone(), wf->workData, - cv::Size( gaussianRad, gaussianRad ),0,0,BORDER_REFLECT); + cv::Size( gaussianRad, gaussianRad ),0,0,cv::BORDER_REFLECT); } wf->nulledData.release(); @@ -573,10 +573,10 @@ void DrawPoly(cv::Mat &data, QVector > poly){ cv::line(data, points[0][j], points[0][j+1], cv::Scalar(0)); } - const Point* ppt[1] = { points[0]}; + const cv::Point* ppt[1] = { points[0]}; int npt[] = {(int) (poly[n].size()) }; - fillPoly( data, ppt, npt, 1, Scalar(0), 8 ); + fillPoly( data, ppt, npt, 1, cv::Scalar(0), 8 ); } } @@ -679,7 +679,7 @@ void SurfaceManager::makeMask(wavefront *wf, bool useInsideCircle){ if (r > 0){ cv::Mat m = wf->workMask; - circle(m,Point((m.cols-1)/2,(m.cols-1)/2),r, Scalar(0),-1); + circle(m,cv::Point((m.cols-1)/2,(m.cols-1)/2),r, cv::Scalar(0),-1); } if (Settings2::showMask()) @@ -1030,14 +1030,14 @@ void SurfaceManager::SaveWavefronts(bool saveNulled){ } void SurfaceManager::createSurfaceFromPhaseMap(cv::Mat phase, CircleOutline outside, CircleOutline center, - QString name, QVector > polyArea){ + QString name, QVector > polyArea){ wavefront *wf; int newrows = Settings2::getInstance()->m_general->wavefrontSize(); if (Settings2::getInstance()->m_general->shouldDownsize() && ( phase.rows > newrows)){ double scaleFactor = (double)newrows/double(phase.rows); - cv::resize(phase,phase, cv::Size(newrows,newrows), 0, 0,INTER_AREA); + cv::resize(phase,phase, cv::Size(newrows,newrows), 0, 0,cv::INTER_AREA); outside.scale(scaleFactor); center.scale(scaleFactor); @@ -1114,7 +1114,7 @@ wavefront * SurfaceManager::readWaveFront(QString fileName){ mirrorDlg *md = mirrorDlg::get_Instance(); double xm = (width-1)/2.,ym = (height-1)/2., - radm = min(xm,ym)-2 , + radm = cv::min(xm,ym)-2 , roc = md->roc, lambda = md->lambda, diam = md->diameter; @@ -1266,7 +1266,7 @@ void SurfaceManager::downSizeWf(wavefront *wf){ double xscale; xscale = (double)newcols/wf->data.cols; cv::Mat resized = wf->data.clone(); - cv::resize(wf->data, wf->data, Size(newrows, newcols)); + cv::resize(wf->data, wf->data, cv::Size(newrows, newcols)); // change outside and inside boundaries wf->m_outside.scale(xscale); @@ -1351,7 +1351,7 @@ void SurfaceManager::processSmoothing(){ gaussianRad &= 0xfffffffe; ++gaussianRad; cv::GaussianBlur( wf->nulledData.clone(), wf->workData, - cv::Size( gaussianRad, gaussianRad ),0,0,BORDER_REFLECT); + cv::Size( gaussianRad, gaussianRad ),0,0,cv::BORDER_REFLECT); } } else if (wf->wasSmoothed == true) { @@ -1568,7 +1568,7 @@ void SurfaceManager::average(QList wfList){ cv::Mat mask = wfList[sizes[maxkey][0]]->workMask.clone(); if (mask.cols != rcols || mask.rows != rrows){ - cv::resize(mask,mask,Size(rrows,rcols)); + cv::resize(mask,mask,cv::Size(rrows,rcols)); } cv::Mat sum = cv::Mat::zeros(rrows,rcols, m_wavefronts[m_currentNdx]->data.type()); @@ -1579,8 +1579,8 @@ void SurfaceManager::average(QList wfList){ cv::Mat resizedMask = wfList[j]->workMask.clone(); resizedImage = wfList[j]->data; if (resizedMask.cols != rcols || resizedMask.rows != rrows){ - cv::resize(wfList[j]->workMask,resizedMask,Size(rrows,rcols)); - cv::resize(wfList[j]->data, resizedImage, Size(rrows,rcols)); + cv::resize(wfList[j]->workMask,resizedMask, cv::Size(rrows,rcols)); + cv::resize(wfList[j]->data, resizedImage, cv::Size(rrows,rcols)); } cv::bitwise_and(mask, resizedMask, mask); @@ -1994,7 +1994,7 @@ textres SurfaceManager::Phase2(QList list, QList inp while(!m_surface_finished){qApp->processEvents();} cv::Mat resized = m_wavefronts[ndx]->workData.clone(); if (standavg.cols != m_wavefronts[ndx]->workData.cols || standavg.rows != m_wavefronts[ndx]->workData.rows){ - cv::resize(m_wavefronts[ndx]->workData, resized, Size(standavg.cols, standavg.rows)); + cv::resize(m_wavefronts[ndx]->workData, resized, cv::Size(standavg.cols, standavg.rows)); } standavg += resized; //create contour of astig @@ -2715,7 +2715,7 @@ void SurfaceManager::showAllContours(){ QList list = saTools->SelectedWaveFronts(); int rows = ceil((double)list.size()/cols); - int columns = min(list.size(),int(ceil((double)list.size()/rows))); + int columns = std::min((int)list.size(),int(ceil((double)list.size()/rows))); const QSizeF size(columns * (width + 10), rows * (height + 10)); const QRect imageRect = QRect(0,0,size.width(),size.height()); qDebug() << "save all" << imageRect; diff --git a/unwraperrorsview.cpp b/unwraperrorsview.cpp index 1a8d5ca6..2eea6f8b 100644 --- a/unwraperrorsview.cpp +++ b/unwraperrorsview.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include using namespace cv; unwrapErrorsView::unwrapErrorsView(const wavefront &wf, QWidget *parent) : diff --git a/zernikeprocess.cpp b/zernikeprocess.cpp index 1ad0bfff..2e885cf6 100644 --- a/zernikeprocess.cpp +++ b/zernikeprocess.cpp @@ -709,12 +709,12 @@ void zernikeProcess::unwrap_to_zernikes(wavefront &wf, int zterms){ } } - cv::solve(A,B,X,(useSvd)? DECOMP_SVD : DECOMP_LU); + cv::solve(A,B,X,(useSvd)? cv::DECOMP_SVD : cv::DECOMP_LU); if (settings.m_general->showConditionNumbers()){ cv::Mat Ai; - double conditionNumber = 1./cv::invert(A,Ai,DECOMP_SVD); - double c2 = cv::norm(A,NORM_L2) * cv::norm(Ai,NORM_L2); + double conditionNumber = 1./cv::invert(A,Ai,cv::DECOMP_SVD); + double c2 = cv::norm(A,cv::NORM_L2) * cv::norm(Ai,cv::NORM_L2); emit statusBarUpdate(QString(" Zernike LSF matrix Condition Numbers %1 %2").arg(conditionNumber, 6, 'f', 3).arg(c2, 6, 'f', 3),1); } wf.InputZerns = std::vector(zterms,0); @@ -1113,7 +1113,7 @@ cv::Mat zernikeProcess::makeSurfaceFromZerns(int border, bool doColor){ double r,g,b; spectral_color(r,g,b, md->lambda); if (doColor) { - result = Vec4f(0.,125. * .5 * g, 125 * r, 125. * b); + result = cv::Vec4f(0.,125. * .5 * g, 125 * r, 125. * b); } @@ -1163,9 +1163,9 @@ cv::Mat zernikeProcess::makeSurfaceFromZerns(int border, bool doColor){ if (rho < obs) continue; int iv = cos(spacing *2 * M_PI * S1) * 100 + 120; - result.at(y,x)[0] = iv * b; - result.at(y,x)[1] = iv * g; - result.at(y,x)[2] = iv * r; + result.at(y,x)[0] = iv * b; + result.at(y,x)[1] = iv * g; + result.at(y,x)[2] = iv * r; } else { if (S1 == 0.0) S1 += .0000001; @@ -1490,7 +1490,7 @@ std::vector zernikeProcess::ZernFitWavefront(wavefront &wf){ } - cv::solve(A,B,X, DECOMP_QR); + cv::solve(A,B,X, cv::DECOMP_QR); wf.InputZerns = std::vector(ztermCnt,0); for (std::size_t z = 0; z < static_cast(X.rows); ++z){ diff --git a/zernikeprocess.h b/zernikeprocess.h index 5dadb91e..5b679965 100644 --- a/zernikeprocess.h +++ b/zernikeprocess.h @@ -30,7 +30,7 @@ extern int Zw[]; extern double BestSC; double zernike(int n, double x, double y); void gauss_jordan(int n, double* Am, double* Bm); -void ZernikeSmooth(Mat wf, Mat mask); +void ZernikeSmooth(cv::Mat wf, cv::Mat mask); typedef struct { std::vector enables; @@ -49,43 +49,6 @@ typedef struct { bool valid; } zernikeData; -class zernProcess : public QObject -{ - Q_OBJECT -private: - static zernProcess *m_Instance; - bool m_needsInit; - -public: - zernikeData m_zData; - - explicit zernProcess(QObject *parent = 0); - static zernProcess *get_Instance(); - void unwrap_to_zernikes(wavefront &wf, int zterms = Z_TERMS); - cv::Mat null_unwrapped(wavefront&wf, std::vector zerns, std::vector enables,int start_term =0, int last_term = Z_TERMS); - void ZernFitWavefront( wavefront &wf); - void initGrid(wavefront &wf, int maxOrder); - void initGrid(int width, double radius, double cx, double cy, int maxOrder, double inside = 0); - void unwrap_to_zernikes(zern_generator *zg, cv::Mat wf, cv::Mat mask); - cv::Mat makeSurfaceFromZerns(int border, bool doColor); - //arma::mat rhotheta( int width, double radius, double cx, double cy, - //double insideRad, const wavefront *wf = 0); - //arma::mat zpmC(arma::rowvec rho, arma::rowvec theta, int maxorder); - //arma::mat zapmC(const arma::rowvec& rho, const arma::rowvec& theta, const int& maxorder=12); - void fillVoid(wavefront &wf); - void setMaxOrder(int n); - int getNumberOfTerms(); - int m_abc; - mirrorDlg *md; - MainWindow *mw; - //arma::mat m_zerns; - QVector m_norms; -signals: -void statusBarUpdate(QString, int); -public slots: - -}; - class zernikeProcess : public QObject { From 2d8a19291a951694b635dce81986eff9b23c8338 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Sat, 26 Jul 2025 22:14:08 +0200 Subject: [PATCH 2/3] more retrocompatible changes --- camwizardpage1.cpp | 8 ++++---- dftarea.cpp | 1 + dftarea.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/camwizardpage1.cpp b/camwizardpage1.cpp index 88612770..09191a0d 100644 --- a/camwizardpage1.cpp +++ b/camwizardpage1.cpp @@ -240,11 +240,11 @@ void CamWizardPage1::on_compute_clicked() if (found) break; if ( i == 1){ - cv::SimpleBlobDetector detector; + static Ptr detector = cv::SimpleBlobDetector::create(); // Detect blobs. std::vector keypoints; - detector.detect( dial, keypoints); + detector->detect( dial, keypoints); /*int horz = 1; int vert = 1; @@ -329,13 +329,13 @@ void CamWizardPage1::on_compute_clicked() msg << "Grid of " << ui->columns->value() << " X " << ui->rows->value() << " not found. Press any key."; ui->Results->append("Pattern not found. Calibration failed."); // Set up the detector with default parameters. - cv::SimpleBlobDetector detector; + static Ptr detector = cv::SimpleBlobDetector::create(); cv::threshold(raw,view, 200, 255, cv::THRESH_BINARY); // Detect blobs. std::vector keypoints; - detector.detect( view, keypoints); + detector->detect( view, keypoints); // Draw detected blobs as red circles. // DrawMatchesFlags::DRAW_RICH_KEYPOINTS flag ensures the size of the circle corresponds to the size of blob diff --git a/dftarea.cpp b/dftarea.cpp index e741faf3..f8895b45 100644 --- a/dftarea.cpp +++ b/dftarea.cpp @@ -30,6 +30,7 @@ #include #include #include +using namespace cv; cv::Mat makeMask(CircleOutline outside, CircleOutline center, cv::Mat data, diff --git a/dftarea.h b/dftarea.h index f35d42f3..4d439a9b 100644 --- a/dftarea.h +++ b/dftarea.h @@ -28,7 +28,7 @@ #include #include "psi_dlg.h" #include "psiphasedisplay.h" -using namespace cv; + extern void showData(const std::string& txt, cv::Mat mat, bool useLog = false); extern QImage showMag(cv::Mat complexI, bool show = false, const char *title = "FFT", bool doLog = true, double gamma = 0); extern void shiftDFT(cv::Mat &magI); From 01818dadd348862c53809e6cb4adf717187681e5 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Mon, 28 Jul 2025 12:47:22 +0200 Subject: [PATCH 3/3] Update generatetargetdlg.cpp --- generatetargetdlg.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generatetargetdlg.cpp b/generatetargetdlg.cpp index dc098db9..e0c6c727 100644 --- a/generatetargetdlg.cpp +++ b/generatetargetdlg.cpp @@ -40,9 +40,14 @@ void generateTargetDlg::on_generate_clicked() int vsize; if (ui->fullScreen->isChecked()){ + // make sure sizes are even QScreen *screen = QGuiApplication::primaryScreen(); hsize = screen->geometry().width(); + hsize /= 2; + hsize *= 2; vsize = screen->geometry().height(); + vsize /= 2; + vsize *= 2; } else { double mul = 1.;