-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathview_image.h
139 lines (115 loc) · 3.53 KB
/
view_image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef VIEW_IMAGE_H
#define VIEW_IMAGE_H
#include <QMainWindow>
#include <QGraphicsScene>
#include "zlib.h"
#include "cmd/img.hpp"
namespace Ui {
class view_image;
}
class QTableWidget;
class TableKeyEventWatcher : public QObject {
Q_OBJECT
using QObject::QObject;
private:
QTableWidget* table;
bool eventFilter(QObject * receiver, QEvent * event) override;
public:
TableKeyEventWatcher(QTableWidget* table);
Q_SIGNAL void DeleteRowPressed(int row);
};
class CustomSliceModel;
class view_image : public QMainWindow
{
Q_OBJECT
std::shared_ptr<TableKeyEventWatcher> table_event;
public:
QString file_name,original_file_name;
QStringList file_names;
tipl::io::gz_nifti nifti;
explicit view_image(QWidget *parent = nullptr);
~view_image();
bool open(QStringList file_name);
bool eventFilter(QObject *obj, QEvent *event) override;
public:
std::vector<std::string> command_list;
std::vector<std::string> param_list;
bool command(std::string cmd,std::string param1 = std::string());
void init_image(void);
private:
void update_other_images(void);
bool has_flip_x(void);
bool has_flip_y(void);
private slots:
void DeleteRowPressed(int row);
void show_info(QString info);
void show_image(bool update_others);
void update_overlay_menu(void);
void set_overlay(void);
void on_action_Save_as_triggered();
void change_contrast();
void on_min_slider_sliderMoved(int position);
void on_min_valueChanged(double arg1);
void on_max_slider_sliderMoved(int position);
void on_max_valueChanged(double arg1);
void on_AxiView_clicked();
void on_CorView_clicked();
void on_SagView_clicked();
void on_slice_pos_valueChanged(int value);
void on_actionSave_triggered();
void on_dwi_volume_valueChanged(int value);
void run_action();
void run_action2();
void on_type_currentIndexChanged(int index);
void on_zoom_valueChanged(double arg1);
void on_info_cellDoubleClicked(int row, int column);
void on_mat_images_currentIndexChanged(int index);
void on_actionLoad_Image_to_4D_triggered();
void on_actionUndo_triggered();
void on_actionRedo_triggered();
private:
Ui::view_image *ui;
public:
std::shared_ptr<variant_image> cur_image;
public:
std::shared_ptr<CustomSliceModel> slice;
bool regtool_subject = true;
private:
std::vector<std::shared_ptr<variant_image> > undo_list;
std::vector<std::shared_ptr<variant_image> > redo_list;
std::vector<std::string> redo_command_list;
std::vector<std::string> redo_param_list;
private:
private:
tipl::io::gz_mat_read mat;
std::vector<size_t> mat_si2vi;
void read_mat_info(void);
bool read_mat(void);
private: //overlay
std::vector<size_t> overlay_images;
std::vector<bool> overlay_images_visible;
size_t this_index = 0;
private:
std::vector<std::vector<unsigned char> > buf4d;
size_t cur_4d_index = 0;
void read_4d_at(size_t index);
void get_4d_buf(std::vector<unsigned char>& buf);
private:// batch processing
/*
std::vector<tipl::image<3> > other_data;
std::vector<std::string> other_file_name;
std::vector<tipl::vector<3,float> > other_vs;
std::vector<tipl::matrix<4,4> > other_T;
std::vector<bool> other_is_mni;
*/
private: // visualization
bool no_update = true;
tipl::value_to_color<float> v2c;
unsigned char cur_dim = 2;
int slice_pos[3] = {0,0,0};
QGraphicsScene source;
QImage source_image;
public:
std::string error_msg;
};
#endif // VIEW_IMAGE_H