diff --git a/Circleoutline.h b/Circleoutline.h index 1ba3f219..dfbf9a85 100644 --- a/Circleoutline.h +++ b/Circleoutline.h @@ -18,82 +18,34 @@ #ifndef CIRCLEOUTLINE_H #define CIRCLEOUTLINE_H - -#include "boundary.h" -#include "gplus.h" -#include +#include +#include #include +#include #include -#include -void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color); -class CircleOutline: public boundary -{ - public: - CircleOutline(); - CircleOutline(QPointF center, double rad); - CircleOutline(QPointF p1, QPointF p2); - CircleOutline(const QJsonObject &obj); - void toJson(QJsonObject &obj); - virtual ~CircleOutline(); - void draw(QPainter& painter, double scale, double scale2 = -1.); - bool isInside(QPointF& p , int offset = 0); - bool isInside(double x, double y, int offset=0); - void enlarge(int del); - void translate(QPointF del); - void scale(double factor); - QVector makeCircleofPoints(int cnt); - bool isValid(); - QPointF m_center; - double m_radius; - gPlus m_p1; - gPlus m_p2; - protected: +void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color); - private: -}; +class CircleOutline { + public: + CircleOutline(); + CircleOutline(QPointF center, double rad); + CircleOutline(QPointF p1, QPointF p2); + CircleOutline(const QJsonObject &obj); + ~CircleOutline() = default; -class ellipseOutline: public boundary -{ -public: - ellipseOutline(); - ellipseOutline(QPointF center, double minorAxis, double majorAxis); - ellipseOutline(QPointF left, QPointF right, double ecc); - bool isInside(QPointF& p , int offset = 0); - void enlarge(int del); void translate(QPointF del); void scale(double factor); - - bool isValid(); - QPointF m_center; - double m_minor; - double m_major; - double m_left; - double m_right; - double e; - gPlus m_p1; - gPlus m_p2; -}; - -class rectangleOutline: public boundary -{ -public: - rectangleOutline(); - rectangleOutline(QPointF upperLeft, QPointF lowerRight); - bool isInside(QPointF& p , int offset = 0); + void draw(QPainter &painter, double scale, double scale2 = -1.); + QVector makeCircleofPoints(int cnt); void enlarge(int del); - void translate(QPointF del); - void scale(double factor); - bool isValid(); - QPointF m_upperLeft; - QPointF m_lowerRight; - gPlus m_p1; - gPlus m_p2; -}; -QDataStream & operator<<(QDataStream & stream, const ellipseOutline &outline); -QDataStream & operator<<(QDataStream & stream, const CircleOutline &outline); -QDataStream & operator<<(QDataStream & stream, const rectangleOutline &outline); + void toJson(QJsonObject &obj); + QPointF m_center; + double m_radius; + QPointF m_p1; + QPointF m_p2; +}; #endif // CIRCLEOUTLINE_H diff --git a/DFTFringe.pro b/DFTFringe.pro index d3b3dc7c..85a98a0d 100644 --- a/DFTFringe.pro +++ b/DFTFringe.pro @@ -181,7 +181,6 @@ SOURCES += SingleApplication/singleapplication.cpp \ filteroutlinesdlg.cpp \ foucaultview.cpp \ generatetargetdlg.cpp \ - gplus.cpp \ graphicsutilities.cpp \ helpdlg.cpp \ hotkeysdlg.cpp \ @@ -282,7 +281,6 @@ HEADERS += bezier/bezier.h \ averagewavefrontfilesdlg.h \ batchigramwizard.h \ bathastigdlg.h \ - boundary.h \ camcalibrationreviewdlg.h \ cameracalibwizard.h \ camwizardpage1.h \ @@ -308,7 +306,6 @@ HEADERS += bezier/bezier.h \ filteroutlinesdlg.h \ foucaultview.h \ generatetargetdlg.h \ - gplus.h \ graphicsutilities.h \ helpdlg.h \ hotkeysdlg.h \ diff --git a/DFTFringe_Dale.pro b/DFTFringe_Dale.pro index de04bf23..fe80d4e9 100644 --- a/DFTFringe_Dale.pro +++ b/DFTFringe_Dale.pro @@ -38,7 +38,6 @@ SOURCES += main.cpp \ mainwindow.cpp \ igramarea.cpp \ circleoutline.cpp \ - gplus.cpp \ graphicsutilities.cpp \ dfttools.cpp \ dftarea.cpp \ @@ -160,7 +159,6 @@ HEADERS += mainwindow.h \ edgeplot.h \ IgramArea.h \ circleoutline.h \ - gplus.h \ graphicsutilities.h \ dfttools.h \ dftarea.h \ @@ -243,7 +241,6 @@ HEADERS += mainwindow.h \ unwraperrorsview.h \ lensdialog.h \ messagereceiver.h \ - boundary.h \ myutils.h \ pixelstats.h \ utils.h \ diff --git a/DFTFringe_QT5.pro b/DFTFringe_QT5.pro index 0271d3fc..e328a32e 100644 --- a/DFTFringe_QT5.pro +++ b/DFTFringe_QT5.pro @@ -180,7 +180,6 @@ SOURCES += SingleApplication/singleapplication.cpp \ filteroutlinesdlg.cpp \ foucaultview.cpp \ generatetargetdlg.cpp \ - gplus.cpp \ graphicsutilities.cpp \ helpdlg.cpp \ hotkeysdlg.cpp \ @@ -281,7 +280,6 @@ HEADERS += bezier/bezier.h \ averagewavefrontfilesdlg.h \ batchigramwizard.h \ bathastigdlg.h \ - boundary.h \ camcalibrationreviewdlg.h \ cameracalibwizard.h \ camwizardpage1.h \ @@ -307,7 +305,6 @@ HEADERS += bezier/bezier.h \ filteroutlinesdlg.h \ foucaultview.h \ generatetargetdlg.h \ - gplus.h \ graphicsutilities.h \ helpdlg.h \ hotkeysdlg.h \ diff --git a/boundary.h b/boundary.h deleted file mode 100644 index 2a897147..00000000 --- a/boundary.h +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** -** -** Copyright 2016 Dale Eason -** This file is part of DFTFringe -** is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation version 3 of the License - -** DFTFringe is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with DFTFringe. If not, see . - -****************************************************************************/ -#ifndef BOUNDARY_H -#define BOUNDARY_H -#include -class boundary -{ - public: - virtual ~boundary() {} - virtual void draw(QPainter& painter, double scale, double scale2 = -1.) = 0; - virtual void enlarge(int del) = 0; - virtual void translate(QPointF del) = 0; - virtual void scale(double factor) = 0; - virtual bool isValid() = 0; - virtual bool isInside(QPointF& p, int offset = 0) = 0; - protected: - private: -}; -QDataStream & operator<<(QDataStream & stream, const boundary &outline); -#endif // BOUNDARY_H - diff --git a/circleoutline.cpp b/circleoutline.cpp index a6bf29fc..ef8360e7 100644 --- a/circleoutline.cpp +++ b/circleoutline.cpp @@ -5,7 +5,7 @@ ** is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation version 3 of the License - +** ** DFTFringe is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -13,147 +13,182 @@ ** ** You should have received a copy of the GNU General Public License ** along with DFTFringe. If not, see . - +** ****************************************************************************/ #include "Circleoutline.h" -#include #include #include -CircleOutline::CircleOutline(QPointF center, double rad){ - center.rx() = round(2 * center.x())/2.; - center.ry() = round( 2 * center.y())/2.; - m_p1 = QPointF(center.x() - (rad), center.y()); - m_p2 = QPointF(center.x()+rad, center.y()); - m_center = center; - m_radius = round(2 *rad)/2.; - -} - - -CircleOutline::CircleOutline(QPointF p1, QPointF p2) -{ - p1.rx() = round( 2 * p1.x())/2.; - p1.ry() = round( 2 * p1.y())/2.; - p2.rx() = round(2 * p2.x())/2.; - p2.ry() = round(2 * p2.y())/2.; - m_p1 = gPlus(p1); - m_p2 = gPlus(p2); - - m_center.rx() = (double)(p1.x()+p2.x())/2.; - m_center.ry() = (double)(p1.y()+p2.y())/2.; - m_radius = fabs(p1.x() - p2.x())/2.; - -} -CircleOutline::CircleOutline() -{ m_center = QPointF(-1,-1); - m_radius = 0; -} - -CircleOutline::~CircleOutline(){} -bool CircleOutline::isInside(double x, double y, int offset) -{ - double x1,y1; - x1 = (x+.5) - m_center.x(); - y1 = (y+.5) - m_center.y(); - return (sqrt(x1 * x1 + y1 * y1) <= (m_radius-offset)); -} - -void fillCircle(cv::Mat &m, double cx, double cy, double rad, void* color){ - //Size size = m.size(); +/** + * @brief Fills a circle in a cv::Mat image using double coordinates and radius. + * Does same as cv::circle but uses double type coordinated and radius. + * @param m Reference to the image matrix. + * @param cx X coordinate of the center. + * @param cy Y coordinate of the center. + * @param rad Radius of the circle. + * @param color Pointer to the color value to use. + */ +void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color) { size_t step = m.step; int pix_size = (int)m.elemSize(); - uchar* ptr = m.ptr(); + uchar *ptr = m.ptr(); -#define ICV_PUT_POINT( ptr, x ) \ - memcpy( ptr + (x)*pix_size, color, pix_size ); +#define ICV_PUT_POINT(ptr, x) memcpy(ptr + (x) * pix_size, color, pix_size); - for (int y = 0; y < m.rows; ++y){ + for (int y = 0; y < m.rows; ++y) { uchar *tptr0 = ptr + y * step; - for (int x = 0; x < m.cols; ++x){ - double dx = (double)(x - cx)/(rad); - double dy = (double)(y - cy)/(rad); - if (sqrt(dx * dx + dy * dy) <= 1.){ + for (int x = 0; x < m.cols; ++x) { + double dx = (double)(x - cx) / (rad); + double dy = (double)(y - cy) / (rad); + if (sqrt(dx * dx + dy * dy) <= 1.) ICV_PUT_POINT(tptr0, x); - } - } } +#undef ICV_PUT_POINT +} +/** + * @brief Default constructor. Initializes an invalid circle. + */ +CircleOutline::CircleOutline() { + m_center = QPointF(-1, -1); + m_radius = 0; +} +/** + * @brief Constructs a circle from a center point and radius. + * @param center Center of the circle. + * @param rad Radius of the circle. + */ +CircleOutline::CircleOutline(QPointF center, double rad) { + center.rx() = round(2 * center.x()) / 2.; + center.ry() = round(2 * center.y()) / 2.; + m_p1 = QPointF(center.x() - rad, center.y()); + m_p2 = QPointF(center.x() + rad, center.y()); + m_center = center; + m_radius = round(2 * rad) / 2.; } -bool CircleOutline::isInside(QPointF& p, int offset) -{ - double x,y; - x = p.x() - m_center.x(); - y = p.y() - m_center.y(); - return (sqrt(x * x + y * y) <= (m_radius-offset)); +/** + * @brief Constructs a circle from two points on the diameter. + * @param p1 First point on the diameter. + * @param p2 Second point on the diameter. + */ +CircleOutline::CircleOutline(QPointF p1, QPointF p2) { + p1.rx() = round(2 * p1.x()) / 2.; + p1.ry() = round(2 * p1.y()) / 2.; + p2.rx() = round(2 * p2.x()) / 2.; + p2.ry() = round(2 * p2.y()) / 2.; + m_p1 = p1; + m_p2 = p2; + + m_center.rx() = (p1.x() + p2.x()) / 2.; + m_center.ry() = (p1.y() + p2.y()) / 2.; + m_radius = fabs(p1.x() - p2.x()) / 2.; } -void CircleOutline::translate(QPointF del){ + +/** + * @brief Constructs a circle from a QJsonObject. + * @param obj JSON object containing center and radius. + */ +CircleOutline::CircleOutline(const QJsonObject &obj) + : CircleOutline( + QPointF(obj["center_x"].toDouble(), obj["center_y"].toDouble()), + obj["radius_x"].toDouble()) {} + +/** + * @brief Translates the circle by a given offset. + * @param del Offset to translate by. + */ +void CircleOutline::translate(QPointF del) { m_center += del; - m_p1.m_p += del; - m_p2.m_p += del; + m_p1 += del; + m_p2 += del; } -void CircleOutline::scale(double factor){ + +/** + * @brief Scales the circle by a given factor. + * @param factor Scale factor. + */ +void CircleOutline::scale(double factor) { m_radius *= factor; - m_radius = round(m_radius * 2)/2.; - //m_radius = (int)m_radius; - m_p1.m_p *= factor; - m_p2.m_p *= factor; - m_center.rx() = round(2 * m_center.x() * factor)/2.; - m_center.ry() = round(2 * m_center.y() * factor)/2.; -} -bool CircleOutline::isValid(){ - return m_radius > 0; + m_radius = round(m_radius * 2) / 2.; + m_p1 *= factor; + m_p2 *= factor; + m_center.rx() = round(2 * m_center.x() * factor) / 2.; + m_center.ry() = round(2 * m_center.y() * factor) / 2.; } -void CircleOutline::draw(QPainter& dc, double scale, double scale2){ + +/** + * @brief Checks if the circle is valid (radius > 0). + * @return True if valid, false otherwise. + */ +bool CircleOutline::isValid() { return m_radius > 0; } + +/** + * @brief Draws the circle using a QPainter. + * @param dc QPainter to draw with. + * @param scale Scale factor for drawing. + * @param scale2 Optional second scale factor for y-axis. + */ +void CircleOutline::draw(QPainter &dc, double scale, double scale2) { if (m_radius == 0) return; - //m_p1.draw(dc, scale); - //m_p2.draw(dc, scale); if (scale2 < 0) scale2 = scale; - dc.drawEllipse(m_center * scale,m_radius * scale,m_radius* scale2); - dc.setPen(QPen(Qt::black, 3,Qt::DotLine)); - dc.drawEllipse(m_center * scale,m_radius * scale,m_radius* scale2); - dc.drawLine((m_center.x() -m_radius - 5)* scale, m_center.y()* scale, scale *( m_center.x() + m_radius + 5), scale * m_center.y()); - dc.drawLine(scale * m_center.x(), m_center.y() - m_radius * scale2 - 5, scale * m_center.x(), m_center.y() + m_radius * scale2 + 5); + dc.drawEllipse(m_center * scale, m_radius * scale, m_radius * scale2); + dc.setPen(QPen(Qt::black, 3, Qt::DotLine)); + dc.drawEllipse(m_center * scale, m_radius * scale, m_radius * scale2); + dc.drawLine((m_center.x() - m_radius - 5) * scale, m_center.y() * scale, + scale * (m_center.x() + m_radius + 5), scale * m_center.y()); + dc.drawLine(scale * m_center.x(), m_center.y() - m_radius * scale2 - 5, + scale * m_center.x(), m_center.y() + m_radius * scale2 + 5); } -QVector CircleOutline::makeCircleofPoints(int cnt){ +/** + * @brief Generates points along the circumference of the circle. + * @param cnt Number of points to generate. + * @return QVector of points on the circle. + */ +QVector CircleOutline::makeCircleofPoints(int cnt) { QVector points; - double step = (M_PI * 2.)/cnt; - for (int i = 0; i < cnt; ++i) - { + double step = (M_PI * 2.) / cnt; + + for (int i = 0; i < cnt; ++i) { double theta = i * step; - int x,y; + int x, y; x = m_radius * cos(theta) + m_center.x(); y = m_radius * sin(theta) + m_center.y(); - points << QPointF(x,y); + points << QPointF(x, y); } return points; } +/** + * @brief Enlarges the circle by a given delta. + * @param del Amount to enlarge the radius. + */ void CircleOutline::enlarge(int del) { - //qDebug() << "enlarge "< m_p2.m_p.rx()){ - gPlus tmp =m_p1; + if (m_p1.rx() > m_p2.rx()) { + QPointF tmp = m_p1; m_p1 = m_p2; m_p2 = tmp; } - m_p1.m_p.rx()-= del; - m_p2.m_p.rx()+= del; + m_p1.rx() -= del; + m_p2.rx() += del; } -CircleOutline::CircleOutline(const QJsonObject &obj) : - CircleOutline(QPointF(obj["center_x"].toDouble(), obj["center_y"].toDouble()), obj["radius_x"].toDouble()) {} - -void CircleOutline::toJson(QJsonObject &obj){ - obj["center_x"]=m_center.x(); - obj["center_y"]=m_center.y(); - obj["radius_x"]=m_radius; - obj["radius_y"]=m_radius; // in case some day in the future we allow elliptical outlines the data format is ready to go +/** + * @brief Serializes the circle to a QJsonObject. + * @param obj JSON object to write to. + */ +void CircleOutline::toJson(QJsonObject &obj) { + obj["center_x"] = m_center.x(); + obj["center_y"] = m_center.y(); + // in case some day in the future we allow elliptical + // outlines the data format is ready to go + obj["radius_x"] = m_radius; + obj["radius_y"] = m_radius; } diff --git a/gplus.cpp b/gplus.cpp deleted file mode 100644 index d956251b..00000000 --- a/gplus.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** -** -** Copyright 2016 Dale Eason -** This file is part of DFTFringe -** is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, version 3 of the License - -** DFTFringe is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with DFTFringe. If not, see . - -****************************************************************************/ -#include "gplus.h" - -gPlus::gPlus(QPointF p) -{ - m_p = p; -} -gPlus::gPlus() {} -gPlus::~gPlus() -{ - //dtor -} -void gPlus::draw(QPainter& dc,double scale, int size){ - QPointF p = m_p; - size *= 1./scale; - QPointF p1((p.x()-size) * scale, p.y() * scale); - QPointF p2((p.x()+size) * scale, p.y() * scale); - dc.drawLine(p1,p2); - dc.drawLine((p.x()) * scale, (p.y()-size)*scale, p.x()*scale, (p.y()+size)*scale); -} - diff --git a/gplus.h b/gplus.h deleted file mode 100644 index 25210d7a..00000000 --- a/gplus.h +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************** -** -** Copyright 2016 Dale Eason -** This file is part of DFTFringe -** is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation version 3 of the License - -** DFTFringe is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with DFTFringe. If not, see . - -****************************************************************************/ -#ifndef GPLUS_H -#define GPLUS_H -#include -#include -class gPlus -{ - public: - gPlus(QPointF p); - gPlus(); - virtual ~gPlus(); - void draw(QPainter& dc, double scale, int size = 10); - QPointF m_p; - protected: - private: -}; - -#endif // GPLUS_H diff --git a/graphicsutilities.cpp b/graphicsutilities.cpp index d61745ba..ea76db23 100644 --- a/graphicsutilities.cpp +++ b/graphicsutilities.cpp @@ -69,9 +69,9 @@ CircleOutline readCircle(std::ifstream &file, double x_offset, double y_offset){ c.m_center.rx() = x + x_offset; c.m_center.ry() = y + y_offset; c.m_radius = rx; - c.m_p1.m_p.rx() = c.m_center.x() + c.m_radius; - c.m_p2.m_p.rx() = c.m_center.x() - c.m_radius; - c.m_p1.m_p.ry() = c.m_center.y(); - c.m_p2.m_p.ry() = c.m_center.y(); + c.m_p1.rx() = c.m_center.x() + c.m_radius; + c.m_p2.rx() = c.m_center.x() - c.m_radius; + c.m_p1.ry() = c.m_center.y(); + c.m_p2.ry() = c.m_center.y(); return c; } diff --git a/igramarea.cpp b/igramarea.cpp index 69505052..fbf16668 100644 --- a/igramarea.cpp +++ b/igramarea.cpp @@ -215,8 +215,8 @@ void IgramArea::DrawSimIgram(void){ resizeImage(); m_outside = CircleOutline(QPointF(xcen, ycen),rad); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; outterPcount = 2; deleteRegions(); drawBoundary(); @@ -406,8 +406,8 @@ cv::Point2d IgramArea::findBestCenterOutline(cv::Mat gray, int start, int end,in bestc = c; QPointF qp(c.x,c.y); CircleOutline newoutline(QPointF(x/searchOutlineScale, y/searchOutlineScale), rad0/searchOutlineScale); - m_innerP1 = newoutline.m_p1.m_p; - m_innerP2 = newoutline.m_p2.m_p; + m_innerP1 = newoutline.m_p1; + m_innerP2 = newoutline.m_p2; innerPcount = 2; drawBoundary(); @@ -530,8 +530,8 @@ cv::Point2d IgramArea::findBestOutsideOutline(cv::Mat gray, int start, int end,i bestc = c; CircleOutline newoutline(QPointF(bestc.x/searchOutlineScale + leftMargin, bestc.y/searchOutlineScale), rad0/searchOutlineScale); - m_OutterP1 = newoutline.m_p1.m_p; - m_OutterP2 = newoutline.m_p2.m_p; + m_OutterP1 = newoutline.m_p1; + m_OutterP2 = newoutline.m_p2; outterPcount = 2; if (pass == 2)drawBoundary(); @@ -715,8 +715,8 @@ void IgramArea::findCenterHole(){ CircleOutline newoutline(QPointF(bestc.x+ left, bestc.y), rad); - m_innerP1 = newoutline.m_p1.m_p; - m_innerP2 = newoutline.m_p2.m_p; + m_innerP1 = newoutline.m_p1; + m_innerP2 = newoutline.m_p2; innerPcount = 2; drawBoundary(); qApp->processEvents(); @@ -884,8 +884,8 @@ void IgramArea::useAnnulusforCenterOutine(){ double cx = m_outside.m_center.x(); double cy = m_outside.m_center.y(); m_center = CircleOutline(QPointF(cx,cy),rad); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; innerPcount = 2; drawBoundary(); @@ -912,8 +912,8 @@ void IgramArea::useLastOutline(){ m_outside = CircleOutline(QPointF(0,0),0); else { m_outside = CircleOutline(QPointF(cx,cy),rad); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; outterPcount = 2; drawBoundary(); } @@ -926,8 +926,8 @@ void IgramArea::useLastOutline(){ double cx = set.value("lastInsideCx", 0).toDouble(); double cy = set.value("lastInsideCy",0).toDouble(); m_center = CircleOutline(QPointF(cx,cy),rad); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; innerPcount = 2; drawBoundary(); } @@ -949,8 +949,8 @@ void IgramArea::adjustCenterandRegions(){ double cx = set.value("lastInsideCx", 0).toDouble(); double cy = set.value("lastInsideCy",0).toDouble(); m_center = CircleOutline(QPointF(cx +xoffset,cy + yoffset),m_center.m_radius); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; innerPcount = 2; } @@ -1161,14 +1161,14 @@ void IgramArea::undo(){ outlinePair p = m_outsideHist.undo(); m_outside = p.m_outline; igramColor = p.m_image; - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; } if (m_current_boundry == CenterOutline) { outlinePair p = m_centerHist.undo(); m_center = p.m_outline; igramColor = p.m_image; - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; } resizeImage(); @@ -1179,16 +1179,16 @@ void IgramArea::redo(){ m_outside = p.m_outline; igramColor = p.m_image; - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; } else if (m_current_boundry == CenterOutline){ outlinePair p = m_centerHist.redo(); m_center = p.m_outline; igramColor = p.m_image; - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; } resizeImage(); @@ -1253,13 +1253,13 @@ void IgramArea::increase(int i) { if (m_current_boundry == OutSideOutline) { m_outside.enlarge(i); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; } else if (m_current_boundry == CenterOutline){ m_center.enlarge(i); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; } else if (m_current_boundry == PolyArea && m_polygons.size() > 0){ increaseRegion(polyndx,1.1); @@ -1270,13 +1270,13 @@ void IgramArea::decrease(){ if (m_current_boundry == OutSideOutline) { m_outside.enlarge(-1); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; } else if (m_current_boundry == CenterOutline) { m_center.enlarge(-1); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; } else if (m_current_boundry == PolyArea && m_polygons.size() > 0){ increaseRegion(polyndx, .9); @@ -1349,13 +1349,13 @@ void IgramArea::wheelEvent (QWheelEvent *e) setCursor(Qt::SizeAllCursor); if (m_current_boundry == OutSideOutline) { m_outside.enlarge(del); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; } else if (m_current_boundry == CenterOutline){ m_center.enlarge(del); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p1.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p1; } drawBoundary(); @@ -2065,10 +2065,10 @@ void IgramArea::crop() { set.setValue("lastInsideCy", m_center.m_center.y() + crop_dy); // need to rescale p1 and p2 because of the crop scale = (double)(this->height())/y; - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; resizeImage(); m_outsideHist.push(igramGray, m_outside); @@ -2137,8 +2137,8 @@ void IgramArea::loadOutlineFile(QString fileName){ CircleOutline out(outside); m_outside = out; m_outside.translate(QPointF(-cropTotalDx, -cropTotalDy)); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; outterPcount = 2; // center/inner @@ -2147,8 +2147,8 @@ void IgramArea::loadOutlineFile(QString fileName){ in.translate(QPointF(-cropTotalDx, -cropTotalDy)); m_center = in; if (m_center.m_radius > 0) { - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; innerPcount = 2; } @@ -2197,8 +2197,8 @@ void IgramArea::loadOutlineFileOldV6(QString fileName){ m_outside = readCircle(file, -cropTotalDx, -cropTotalDy); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; outterPcount = 2; CircleOutline sideLobe = readCircle(file); emit dftCenterFilter(sideLobe.m_radius); @@ -2208,8 +2208,8 @@ void IgramArea::loadOutlineFileOldV6(QString fileName){ if ((file.tellg() > 0) && (fsize > file.tellg())) { if ((b != 'P') && (b != 'E')){ m_center = readCircle(file, -cropTotalDx, -cropTotalDy); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; innerPcount = 2; } } @@ -2428,14 +2428,14 @@ void IgramArea::deleteRegions(){ void IgramArea::shiftoutline(QPointF p) { if (m_current_boundry == OutSideOutline){ m_outside.translate(p); - m_OutterP1 = m_outside.m_p1.m_p; - m_OutterP2 = m_outside.m_p2.m_p; + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; m_outsideHist.push(igramGray, m_outside); } else if (m_current_boundry == CenterOutline){ m_center.translate(p); - m_innerP1 = m_center.m_p1.m_p; - m_innerP2 = m_center.m_p2.m_p; + m_innerP1 = m_center.m_p1; + m_innerP2 = m_center.m_p2; m_centerHist.push(igramGray, m_center); } drawBoundary(); diff --git a/surfacemanager.cpp b/surfacemanager.cpp index bd01eeb2..fcb06521 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -672,7 +672,7 @@ void SurfaceManager::makeMask(wavefront *wf, bool useInsideCircle){ //line(wf->workMask, Point(0, 0), Point(s,s),cv::Scalar(0,0,0), 10); theMask = mask.clone(); - + // add central obstruction (not to be confused with a hole in the mirror - this comes from mirror configuration) double r = md.obs * (2. * radm)/md.diameter; r/= 2.; @@ -2466,7 +2466,7 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QListm_minimal = true; QList unrotatedNdxs; - + QString html = ("

Test Stand Astig Removal

" "

" + AstigReportTitle); html.append(" " + QDate::currentDate().toString() +