Kstars

starprofileviewer.h
1 /*
2  SPDX-FileCopyrightText: 2017 Robert Lancaster <[email protected]>
3 
4  Based on the QT Surface Example https://doc.qt.io/qt-5.9/qtdatavisualization-surface-example.html
5  and the QT Bars Example https://doc-snapshots.qt.io/qt5-5.9/qtdatavisualization-bars-example.html
6 
7  SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 #include "fitsdata.h"
13 
14 #include <QtDataVisualization/qbar3dseries.h>
15 #include <QtDataVisualization/qbardataproxy.h>
16 #include <QtDataVisualization/q3dbars.h>
17 #include <QtDataVisualization/QCustom3DLabel>
18 
19 #include <QCheckBox>
20 #include <QComboBox>
21 #include <QDial>
22 #include <QDialog>
23 #include <QGroupBox>
24 #include <QHBoxLayout>
25 #include <QImage>
26 #include <QLabel>
27 #include <QMessageBox>
28 #include <QPainter>
29 #include <QPushButton>
30 #include <QRadioButton>
31 #include <QScreen>
32 #include <QSlider>
33 #include <QVBoxLayout>
34 #include <QWidget>
35 
36 #include <QtDataVisualization/QValue3DAxis>
37 #include <QtDataVisualization/Q3DTheme>
38 #include <QtDataVisualization/qabstract3dseries.h>
39 #include <qmath.h>
40 
41 using namespace QtDataVisualization;
42 
43 class StarProfileViewer : public QDialog
44 {
45  Q_OBJECT
46 public:
47  explicit StarProfileViewer(QWidget *parent);
48  ~StarProfileViewer();
49 
50  void setBlackToYellowGradient();
51  void setGreenToRedGradient();
52 
53  void loadData(QSharedPointer<FITSData> imageData, QRect sub, QList<Edge *> starCenters);
54  template <typename T> void loadDataPrivate();
55  float getImageDataValue(int x, int y);
56  void toggleSlice();
57  void updateVerticalAxis();
58  void updateHFRandPeakSelection();
59  void updateDisplayData();
60  void updateScale();
61  void enableTrackingBox(bool enable);
62  void changeSelection();
63  void updateSelectorBars(QPoint position);
64  void toggleCutoffEnabled(bool enable);
65 
66 public slots:
67  void changeSelectionType(int type);
68  void zoomViewTo(int where);
69  void updateSampleSize(const QString &text);
70  void updateColor(int selection);
71  void updateBarSpacing(int value);
72 
73 signals:
74  void sampleSizeUpdated(int size);
75 private:
76  Q3DBars *m_graph { nullptr };
77  QValue3DAxis *m_pixelValueAxis { nullptr };
78  QCategory3DAxis *m_xPixelAxis { nullptr };
79  QCategory3DAxis *m_yPixelAxis { nullptr };
80  QBar3DSeries *m_3DPixelSeries { nullptr };
81 
82  QBarDataArray *dataSet { nullptr };
83 
84  template <typename T>
85  float getImageDataValue(int x, int y);
86  void getSubFrameMinMax(float *subFrameMin, float *subFrameMax, double *dataMin, double *dataMax);
87 
88  template <typename T>
89  void getSubFrameMinMax(float *subFrameMin, float *subFrameMax);
90 
91  QPushButton *HFRReport { nullptr };
92  QLabel *reportBox { nullptr };
93  QPushButton *showPeakValues { nullptr };
94  QPushButton *showCoordinates { nullptr };
95  QCheckBox *autoScale { nullptr };
96  QPushButton *showScaling { nullptr };
97  QComboBox *sampleSize { nullptr };
98  QComboBox *selectionType { nullptr };
99  QComboBox *zoomView { nullptr };
100  QComboBox *selectStar { nullptr };
101  QPushButton *exploreMode { nullptr };
102  QLabel *pixelReport { nullptr };
103  QLabel *maxValue { nullptr };
104  QLabel *minValue { nullptr };
105  QLabel *cutoffValue { nullptr };
106  QPushButton *sliceB { nullptr };
107  QSharedPointer<FITSData> imageData { nullptr };
108  QRect subFrame;
109 
110  QSlider *blackPointSlider { nullptr };
111  QSlider *whitePointSlider { nullptr };
112  QSlider *cutoffSlider { nullptr };
113  QSlider *verticalSelector { nullptr };
114  QSlider *horizontalSelector { nullptr };
115  QList<Edge *> starCenters;
116 
117  bool cutOffEnabled { false };
118 
119  int convertToSliderValue(float value);
120  float convertFromSliderValue(int value);
121  void updatePixelReport();
122 
123 };
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Aug 14 2022 04:14:02 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.