Skip to content

Commit 6dd01f3

Browse files
committed
added crude pix analyser function
1 parent 192ef6c commit 6dd01f3

19 files changed

+400
-80
lines changed

FITSExplorer.pro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ INCLUDEPATH += include/
1414
VPATH += src/
1515

1616
SOURCES += \
17+
src/pixanalyser.cpp \
1718
src/roitablewidget.cpp \
1819
src/file.cpp \
1920
src/image_statistics_overview.cpp \
@@ -43,20 +44,23 @@ HEADERS += \
4344
include/mygraphicsview.h \
4445
include/overview.h \
4546
include/colormap.h \
47+
include/pixanalyser.h \
4648
include/qcustomplot.h \
4749
include/toml.hpp \
4850
include/mystatusbar.h \
4951
include/listmarkers.h \
5052
include/marker.h \
5153
include/preferences.h \
5254
include/roirect.h \
53-
include/roitablewidget.h
55+
include/roitablewidget.h \
56+
include/pixanalyzer.h
5457

5558
FORMS += \
5659
FITSExplorer.ui \
5760
aboutdialog.ui \
5861
image_statistics_overview.ui \
5962
imagewidget.ui \
63+
pixanalyser.ui \
6064
lightcurve.ui \
6165
listmarkers.ui \
6266
mystatusbar.ui \

FITSExplorer.ui

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
<string>Image</string>
186186
</property>
187187
<addaction name="actionSelect"/>
188+
<addaction name="actionPixel_Analysis"/>
188189
</widget>
189190
<widget class="QMenu" name="menuStatistics">
190191
<property name="enabled">
@@ -659,6 +660,14 @@
659660
<string>1700</string>
660661
</property>
661662
</action>
663+
<action name="actionPixel_Analysis">
664+
<property name="checkable">
665+
<bool>true</bool>
666+
</property>
667+
<property name="text">
668+
<string>Pixel Analysis</string>
669+
</property>
670+
</action>
662671
</widget>
663672
<customwidgets>
664673
<customwidget>

include/FITSExplorer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public slots:
7878
void update_HDU_Table(int);
7979
void newROIRect(QUuid, QRectF);
8080
void removeUUIDFromTable(QUuid);
81-
8281
private slots:
8382
void OpenFile(QString filename = nullptr);
8483
void OpenRecent();
@@ -130,6 +129,8 @@ private slots:
130129
void on_reset_brightness_btn_clicked();
131130
void on_actionSelect_triggered();
132131

132+
void on_actionPixel_Analysis_triggered();
133+
133134
private:
134135

135136
void modeChangeUpdateStatusbar(Mode mode);
@@ -138,27 +139,26 @@ private slots:
138139
File *m_cur_file_ptr = nullptr;
139140
int m_file_index = -1;
140141
Ui::FITSExplorer *ui;
141-
ImageWidget *img_widget = new ImageWidget();
142+
// ImageWidget *img_widget = new ImageWidget();
142143
fitsfile *fptr;
143144
int status = 0;
144145
float *image_data;
145146
int width, height;
146147
QCPItemStraightLine *m_line;
147148
int m_nhdu;
148149
int m_nkeys;
149-
MyGraphicsView *gv = img_widget->GetGraphicsView();
150+
// MyGraphicsView *gv = img_widget->GetGraphicsView();
150151
Overview *overview = new Overview();
151-
LightCurve *lc = new LightCurve(img_widget);
152+
// LightCurve *lc = new LightCurve(img_widget);
152153
toml::value TOMLCFG;
153154
Colormap m_cur_colormap = Colormap::None;
154155
QCustomPlot *lightCurvePlot;
155156
QFile m_recentFile;
156157
void AddRecentFile(QString);
157158
QImage m_orig_img;
158159

159-
ImageWidget *m_img_widget = new ImageWidget();
160+
// ImageWidget *m_img_widget = new ImageWidget();
160161
bool m_should_copy_before_applying_colormap = true;
161162

162-
friend class File;
163163
};
164164
#endif // DFITS_H

include/file.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class File : public QObject
5454
Colormap getColormap();
5555
int getNKEYS();
5656
float* getImgData();
57+
float getImgDataAt(QPoint );
5758
int getStatus();
5859
int getImgDim();
5960
int getImgSize(long *naxes);
@@ -72,8 +73,11 @@ class File : public QObject
7273
int getCurrentHDU();
7374
void fitToWidth(int);
7475
void setSelectMode(bool);
76+
void setPixelAnalysisMode(bool);
7577
void setMode(Mode mode);
7678
Mode getMode();
79+
void pix(QPoint);
80+
7781

7882
signals:
7983
void modeChanged(Mode);
@@ -99,7 +103,6 @@ class File : public QObject
99103
QImage m_orig_img;
100104
ImageWidget *m_img_widget = new ImageWidget();
101105
bool m_should_copy_before_applying_colormap = true;
102-
bool m_select_mode = false;
103106
Mode m_mode = Mode::NORMAL_MODE;
104107
};
105108

include/imagewidget.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ class ImageWidget : public QStackedWidget
4444
QImage scaledImage;
4545
QImage originalImage;
4646

47-
float *image_data;
48-
4947
double scaleFactor = 1;
5048

5149
};

include/mode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum Mode
55
{
66
NORMAL_MODE,
77
SELECT_MODE,
8-
PIXEL_ANALYSE_MODE
8+
PIXEL_ANALYSIS_MODE
99
};
1010

1111
#endif // MODE_H

include/mygraphicsview.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "roirect.h"
2121
#include <QUuid>
2222
#include <QMap>
23+
#include "pixanalyser.h"
24+
#include <QGraphicsProxyWidget>
2325

2426
class MyGraphicsView : public QGraphicsView
2527
{
@@ -42,14 +44,19 @@ class MyGraphicsView : public QGraphicsView
4244
void ZoomOut();
4345
void ShowAllMarkers();
4446
void setSelectMode(bool);
47+
void setPixelAnalysisMode(bool);
4548
void ZoomIntoROI(QUuid uid);
4649
void ZoomIntoLastROI();
4750
void AddROIRect(ROIRect*);
4851
void DeleteROIRect(QUuid uid);
4952
void DeleteROIRect__for_table(QUuid uid);
5053
void HideROIRect(QUuid uid);
54+
void HideROIRect__for_table(QUuid uid);
5155
int GetROIIndex();
5256
ROIRect* GetROIRect(QUuid uid);
57+
PixAnalyser* getPixAnalyser();
58+
void movePixAnalyser(QPoint);
59+
void setPixValue(float);
5360

5461
signals:
5562
void mouseMoved(QPointF);
@@ -61,6 +68,7 @@ class MyGraphicsView : public QGraphicsView
6168
void markersHidden(bool);
6269
void newROIRect(QUuid, QRectF);
6370
void signalROITable(QUuid);
71+
void pixelAnalysisRequested(QPoint);
6472

6573
private slots:
6674
void __changeMarkerLineColor(int, QColor);
@@ -81,22 +89,20 @@ private slots:
8189

8290
QShortcut *kb_zoom_in, *kb_zoom_out, *kb_roi_zoom;
8391
void initShortcuts();
84-
8592
int m_roi_index = -1;
86-
8793
QPixmap m_pix;
8894
QGraphicsScene *m_scene = new QGraphicsScene();
8995
QGraphicsPixmapItem *m_img;
9096
bool m_markerMode = false;
97+
bool m_select_mode = false;
98+
bool m_pix_analysis_mode = false;
9199
ListMarkers* lm = new ListMarkers();
92100
QVector<Marker*> m_markerList;
93-
94101
QRubberBand *m_rubberband = nullptr;
95-
96102
QPoint m_roi_start_pos, m_roi_end_pos;
97-
bool m_select_mode = false;
98-
99103
QMap<QUuid , ROIRect*> m_roi_map;
104+
105+
PixAnalyser *m_pix_analyser = nullptr;
100106
};
101107

102108
#endif

include/pixanalyser.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef PIXANALYSER_H
2+
#define PIXANALYSER_H
3+
4+
#include <QWidget>
5+
6+
namespace Ui {
7+
class PixAnalyser;
8+
}
9+
10+
class PixAnalyser : public QWidget
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit PixAnalyser(QWidget *parent = nullptr);
16+
~PixAnalyser();
17+
18+
void setPixValue(float);
19+
float getPixValue();
20+
void setImg(QImage img);
21+
QImage getImg();
22+
23+
private:
24+
Ui::PixAnalyser *ui;
25+
};
26+
27+
#endif // PIXANALYSER_H

include/roitablewidget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@ class ROITableWidget : public QWidget
2424

2525
signals:
2626
void deleteROI(QUuid uid);
27+
void hideROI(QUuid uid);
28+
void showROI(QUuid uid);
2729

2830
private:
2931
Ui::ROITableWidget *ui;
3032
void showContextMenu(const QPoint &pos);
3133

3234
void handleHide();
35+
void handleShow();
3336
void handleClose();
3437
void handleZoom();
3538
void handleDelete();
3639

3740
QAction *m_delete_action = new QAction("Delete");
41+
QAction * m_show_action = new QAction("Show");
3842
QAction * m_hide_action = new QAction("Hide");
3943
QAction *m_close_action = new QAction("Close");
4044
QAction* m_zoom_action = new QAction("Zoom");

pixanalyser.ui

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>PixAnalyser</class>
4+
<widget class="QWidget" name="PixAnalyser">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<property name="styleSheet">
17+
<string notr="true">background-color: black;</string>
18+
</property>
19+
<layout class="QVBoxLayout" name="verticalLayout">
20+
<item>
21+
<widget class="QLabel" name="preview_label">
22+
<property name="sizePolicy">
23+
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
24+
<horstretch>0</horstretch>
25+
<verstretch>0</verstretch>
26+
</sizepolicy>
27+
</property>
28+
<property name="text">
29+
<string>IMG PREVIEW</string>
30+
</property>
31+
<property name="alignment">
32+
<set>Qt::AlignmentFlag::AlignCenter</set>
33+
</property>
34+
</widget>
35+
</item>
36+
<item>
37+
<widget class="QLabel" name="pixvalue_label">
38+
<property name="sizePolicy">
39+
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
40+
<horstretch>0</horstretch>
41+
<verstretch>0</verstretch>
42+
</sizepolicy>
43+
</property>
44+
<property name="text">
45+
<string>PIX VALUE</string>
46+
</property>
47+
<property name="alignment">
48+
<set>Qt::AlignmentFlag::AlignCenter</set>
49+
</property>
50+
</widget>
51+
</item>
52+
</layout>
53+
</widget>
54+
<resources/>
55+
<connections/>
56+
</ui>

0 commit comments

Comments
 (0)