Kstars

fitshistogram.h
1/*
2 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "fitscommon.h"
10#include "fitsdata.h"
11#include "ui_fitshistogramui.h"
12
13#include <QDialog>
14#include <QUndoCommand>
15
16class QMouseEvent;
17
18class FITSTab;
19
20class histogramUI : public QDialog, public Ui::FITSHistogramUI
21{
23
24 public:
25 explicit histogramUI(QDialog * parent = nullptr);
26};
27
28class FITSHistogram : public QDialog
29{
31
32 friend class histDrawArea;
33
34 public:
35 explicit FITSHistogram(QWidget * parent);
36
37 enum { RED_CHANNEL, GREEN_CHANNEL, BLUE_CHANNEL };
38
39 void constructHistogram();
40 void syncGUI();
41 void reset()
42 {
43 m_Constructed = false;
44 }
45
46 void applyFilter(FITSScale ftype);
47
48 double getBinWidth(int channel = 0)
49 {
50 return binWidth[channel];
51 }
52
53 QVector<uint32_t> getCumulativeFrequency(int channel = 0) const;
54
55 double getJMIndex() const;
56
57 bool isConstructed()
58 {
59 return m_Constructed;
60 }
61
62
63 protected:
64 void showEvent(QShowEvent * event) override;
65 void driftMouseOverLine(QMouseEvent * event);
66
67 public slots:
68 void applyScale();
69 void resizePlot();
70
71 private:
72 template <typename T>
73 void constructHistogram();
74 double cutMin;
75 double cutMax;
76
77 histogramUI * ui { nullptr };
78 FITSTab * tab { nullptr };
79
80 QVector<QVector<uint32_t>> cumulativeFrequency;
81 QVector<QVector<double>> intensity;
82 QVector<QVector<double>> frequency;
85 QVector<QDoubleSpinBox *> minBoxes, maxBoxes;
86
87 QVector<double> FITSMin;
88 QVector<double> FITSMax;
89 QVector<double> sliderScale, sliderTick;
90 QVector<int> numDecimals;
91
93 QVector<double> binWidth;
94 uint16_t binCount { 0 };
95 double JMIndex { 0 };
96
97 int maxFrequency {0};
98 FITSScale type { FITS_AUTO };
99 bool isGUISynced { false};
100 bool m_Constructed { false };
101 QCustomPlot * customPlot { nullptr };
102};
103
104class FITSHistogramCommand : public QUndoCommand
105{
106 public:
107 FITSHistogramCommand(QWidget * parent, FITSHistogram * inHisto, FITSScale newType, const QVector<double> &lmin, const QVector<double> &lmax);
108 virtual ~FITSHistogramCommand();
109
110 virtual void redo() override;
111 virtual void undo() override;
112 virtual QString text() const;
113
114 private:
115 bool calculateDelta(const uint8_t * buffer);
116 bool reverseDelta();
117
118 FITSImage::Statistic stats;
119 FITSHistogram * histogram { nullptr };
120 FITSScale type;
121 QVector<double> min, max;
122
123 unsigned char * delta { nullptr };
124 unsigned long compressedBytes { 0 };
125 FITSTab * tab { nullptr };
126};
The FITSTab class holds information on the current view (drawing area) in addition to the undo/redo s...
Definition fitstab.h:46
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Q_OBJECTQ_OBJECT
QObject * parent() const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:49:22 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.