File indexing completed on 2024-04-14 03:42:30
0001 /* 0002 SPDX-FileCopyrightText: 2017 Robert Lancaster <rlancaste@gmail.com> 0003 0004 Based on the QT Surface Example https://doc.qt.io/qt-5.9/qtdatavisualization-surface-example.html 0005 and the QT Bars Example https://doc-snapshots.qt.io/qt5-5.9/qtdatavisualization-bars-example.html 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "fitsdata.h" 0013 0014 #include <QtDataVisualization/qbar3dseries.h> 0015 #include <QtDataVisualization/qbardataproxy.h> 0016 #include <QtDataVisualization/q3dbars.h> 0017 #include <QtDataVisualization/QCustom3DLabel> 0018 0019 #include <QCheckBox> 0020 #include <QComboBox> 0021 #include <QDial> 0022 #include <QDialog> 0023 #include <QGroupBox> 0024 #include <QHBoxLayout> 0025 #include <QImage> 0026 #include <QLabel> 0027 #include <QMessageBox> 0028 #include <QPainter> 0029 #include <QPushButton> 0030 #include <QRadioButton> 0031 #include <QScreen> 0032 #include <QSlider> 0033 #include <QVBoxLayout> 0034 #include <QWidget> 0035 0036 #include <QtDataVisualization/QValue3DAxis> 0037 #include <QtDataVisualization/Q3DTheme> 0038 #include <QtDataVisualization/qabstract3dseries.h> 0039 #include <qmath.h> 0040 0041 using namespace QtDataVisualization; 0042 0043 class StarProfileViewer : public QDialog 0044 { 0045 Q_OBJECT 0046 public: 0047 explicit StarProfileViewer(QWidget *parent); 0048 ~StarProfileViewer(); 0049 0050 void setBlackToYellowGradient(); 0051 void setGreenToRedGradient(); 0052 0053 void loadData(QSharedPointer<FITSData> imageData, QRect sub, QList<Edge *> starCenters); 0054 template <typename T> void loadDataPrivate(); 0055 float getImageDataValue(int x, int y); 0056 void toggleSlice(); 0057 void updateVerticalAxis(); 0058 void updateHFRandPeakSelection(); 0059 void updateDisplayData(); 0060 void updateScale(); 0061 void enableTrackingBox(bool enable); 0062 void changeSelection(); 0063 void updateSelectorBars(QPoint position); 0064 void toggleCutoffEnabled(bool enable); 0065 0066 public slots: 0067 void changeSelectionType(int type); 0068 void zoomViewTo(int where); 0069 void updateSampleSize(const QString &text); 0070 void updateColor(int selection); 0071 void updateBarSpacing(int value); 0072 0073 signals: 0074 void sampleSizeUpdated(int size); 0075 private: 0076 Q3DBars *m_graph { nullptr }; 0077 QValue3DAxis *m_pixelValueAxis { nullptr }; 0078 QCategory3DAxis *m_xPixelAxis { nullptr }; 0079 QCategory3DAxis *m_yPixelAxis { nullptr }; 0080 QBar3DSeries *m_3DPixelSeries { nullptr }; 0081 0082 QBarDataArray *dataSet { nullptr }; 0083 0084 template <typename T> 0085 float getImageDataValue(int x, int y); 0086 void getSubFrameMinMax(float *subFrameMin, float *subFrameMax, double *dataMin, double *dataMax); 0087 0088 template <typename T> 0089 void getSubFrameMinMax(float *subFrameMin, float *subFrameMax); 0090 0091 QPushButton *HFRReport { nullptr }; 0092 QLabel *reportBox { nullptr }; 0093 QPushButton *showPeakValues { nullptr }; 0094 QPushButton *showCoordinates { nullptr }; 0095 QCheckBox *autoScale { nullptr }; 0096 QPushButton *showScaling { nullptr }; 0097 QComboBox *sampleSize { nullptr }; 0098 QComboBox *selectionType { nullptr }; 0099 QComboBox *zoomView { nullptr }; 0100 QComboBox *selectStar { nullptr }; 0101 QPushButton *exploreMode { nullptr }; 0102 QLabel *pixelReport { nullptr }; 0103 QLabel *maxValue { nullptr }; 0104 QLabel *minValue { nullptr }; 0105 QLabel *cutoffValue { nullptr }; 0106 QPushButton *sliceB { nullptr }; 0107 QSharedPointer<FITSData> imageData { nullptr }; 0108 QRect subFrame; 0109 0110 QSlider *blackPointSlider { nullptr }; 0111 QSlider *whitePointSlider { nullptr }; 0112 QSlider *cutoffSlider { nullptr }; 0113 QSlider *verticalSelector { nullptr }; 0114 QSlider *horizontalSelector { nullptr }; 0115 QList<Edge *> starCenters; 0116 0117 bool cutOffEnabled { false }; 0118 0119 int convertToSliderValue(float value); 0120 float convertFromSliderValue(int value); 0121 void updatePixelReport(); 0122 0123 };