-
Notifications
You must be signed in to change notification settings - Fork 2
/
global.h
204 lines (172 loc) · 6.81 KB
/
global.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QGraphicsView>
#include <QMainWindow>
#include <QFileDialog>
#include <QMessageBox>
#include <QStringList>
#include <QMouseEvent>
#include <QLocale>
#include <QImage>
#include <QIcon>
#include <QDateTime>
#include <QFontMetrics>
#include <QColorDialog>
#include <QRadialGradient>
#include <QTableWidgetItem>
#include <QGraphicsLineItem>
#include <QGraphicsPixmapItem>
#include <QElapsedTimer>
#include <QTextStream>
#include <QFile>
extern "C" {
#include "ift.h"
}
// For Volumetric image
#define AXIAL 1
#define CORONAL 2
#define SAGITTAL 3
// For Rendering
#define FAST_MODE 5
#define QUALITY_MODE 1
// For QImage Structure
#define QIMAGE_FORMAT QImage::Format_RGB888
// For Annotation
#define MAX_BRUSH 20
#define FREE_FORM_ANNOTATION 1
#define BOX_ANNOTATION 2
#define ERASING_ANNOTATION 3
#define HALT_ANNOTATION 4
const QString DEFAULT_FLIM_MODEL_DIR_KEY = "default_flim_model_dir";
const QString DEFAULT_FLIM_MODEL_LIST_KEY = "default_flim_model_list";
const QString DEFAULT_IMAGE_DIR_KEY = "default_image_dir";
const QString DEFAULT_LABEL_DIR_KEY = "default_label_dir";
const QString DEFAULT_MARKERS_DIR_KEY = "default_markers_dir";
const QString DEFAULT_EXPORT_DIR_KEY = "default_export_dir";
const QString DEFAULT_FLIMBUILDER_LOC_KEY = "default_flimbuilder_location";
const QString DEFAULT_MIMG_LOC_KEY = "default_mimg_location";
const QString DEFAULT_SALIENCY_LOC_KEY = "default_saliency_location";
/**
* @brief Returns a QImage generated from a iftImage
*
* @author Azael de Melo e Sousa
*
* Transforms an iftImage into a QImage
*
* @param <img> Pointer to an image stored in a iftImage data structure
* @return Same image stored in a QImage data structure
*/
QImage *iftImageToQImage(iftImage *img);
QImage *iftImageToQImage(iftImage *img, iftImage *label, iftColorTable *t, bool *obj_visibility, iftImage *markers, iftColorTable *tm);
iftImage *iftCreateSliceViewImage(iftImage *img, iftImage *label, iftImage *border, iftColorTable *t, bool *obj_visibility, iftImage *markers, iftImage *toggle_markers, iftColorTable *tm, iftIntArray *markers_visibility);
QImage *iftImageToQImage(iftImage *img, iftImage *label, iftImage *border, iftColorTable *t, bool *obj_visibility, iftImage *markers, iftImage *toggle_markers, iftColorTable *tm, iftIntArray *markers_visibility);
/**
* @brief Returns a colored QImage generated from a iftImage with its respective label map
*
* @author Azael de Melo e Sousa
*
* Transforms an iftImage and its label map into a colored QImage
*
* @param <img> Pointer to an image stored in a iftImage data structure
* @param <label> Pointer to a label map stored in a iftImage data structure
* @param <t> Pointer to color table stores in a iftColorTable data structure
* @param <obj_visibility> Pointer to a bool vector indicating if the object is visible or not
* @return Same image stored in a QImage data structure
*/
QImage *iftLabeledImageToColoredQImage(iftImage *img, iftImage *label, iftColorTable *t, bool *obj_visibility);
/**
* @brief Returns a colored QImage generated from a iftImage with its respective label map
*
* @author Azael de Melo e Sousa
*
* Transforms an iftImage and its label map into a colored QImage
*
* @param <img> Pointer to an image stored in a iftImage data structure
* @param <label> Pointer to a label map stored in a iftImage data structure
* @param <t> Pointer to color table stores in a iftColorTable data structure
* @return Same image stored in a QImage data structure
*/
QImage *iftLabeledImageToColoredQImage(iftImage *img, iftImage *label, iftColorTable *t);
/**
* @brief Returns a colored QImage generated from a iftImage with its Cb and Cr channels
*
* @author Azael de Melo e Sousa
*
* Transforms an iftImage and its label map into a colored QImage
*
* @param <img> Pointer to an image stored in a iftImage data structure
* @param <label> Pointer to a label map stored in a iftImage data structure
* @param <t> Pointer to color table stores in a iftColorTable data structure
* @return Same image stored in a QImage data structure
*/
QImage *iftColoredImageToColoredQImage(iftImage *img);
/**
* @brief Returns a iftImage generated from a QImage
*
* @author Azael de Melo e Sousa
*
* Transforms a QImage into a iftImage
*
* @param <img> Image stored in a QImage data structure
* @return Pointer to a copy of the QImage in a iftImage
*/
iftImage *iftQImageToImage(QImage *img);
/**
* @brief Returns a QColor generated from an iftImage
*
* @author Azael de Melo e Sousa
*
* Transforms anm iftColor into a QImage
*
* @param <img> iftColor data structure
* @return QColor data structure
*/
QColor iftColorToQColor(iftColor YCbCr);
/**
* @brief Writes message on log
*
* @author Azael de Melo e Sousa
*
* Writes specif message on log.
*
* @param <opeartion_detail> QString, the operation performed
* @param <elapsed> qint64, elapsed time
* @return void
*/
void iftWriteOnLog(QString operation_detail, qint64 elapsed);
#define UNMARKED -1
void iftInitMarkersImage(iftImage *markers);
bool iftAreImagesEqual(const iftImage *img1, const iftImage *img2);
void iftSetObjectNormalParallelized(iftGraphicalContext *gc, char normal_type);
/**
@brief Computes the watershed transform in a forest structure.
Complexity: O(|A| * |V|).
@param fst iftImageForest. Forest structure created with a gradient image.
@param seed iftLabeledSet. List of spels with image index and seed label.
@param removal_markers iftSet. List of spels marked for removal. NULL if empty
@return void. All forest maps are updated by reference.
*/
void iftFastDiffWatershed(iftImageForest *fst, iftLabeledSet *seed, iftSet * removal_markers);
iftMImage *iftMGetZXSlice(const iftMImage *mimg, int ycoord);
iftMImage *iftMGetXYSlice(const iftMImage *mimg, int zcoord);
iftMImage *iftMGetYZSlice(const iftMImage *mimg, int xcoord);
iftImage *MImageGradient(const iftMImage *img, iftAdjRel *A);
#define CMAX 65535
typedef struct iftDynTrees_ {
iftMImage *img; /* original image in some color space */
iftAdjRel *A; /* adjacency relation */
iftImage *label; /* label map */
iftImage *root; /* root map */
iftMImage *cumfeat; /* cumulative feature vector map */
int *treesize; /* tree size map */
iftImage *cost; /* path cost map */
iftImage *pred; /* predecessor map */
iftGQueue *Q; /* priority queue with integer costs */
float maxfeatdist; /* maximum feature distance */
} iftDynTrees;
iftDynTrees *iftCreateDynTrees(iftMImage *img, iftAdjRel *A);
void iftDestroyDynTrees(iftDynTrees **dt);
void iftExecDiffDynTrees(iftDynTrees *dt, iftLabeledSet **S, iftSet **M);
iftSet *iftDiffDynTreeRemoval(iftDynTrees *dt, iftSet **M);
void iftDiffDynSubtreeUpdate(iftDynTrees *dt, int q);
#endif // GLOBAL_H