-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExperimentalData.h
307 lines (243 loc) · 7.09 KB
/
ExperimentalData.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#ifndef EXPERIMENTALDATA_H
#define EXPERIMENTALDATA_H
#include <QString>
#include <QPoint>
#include <QRect>
#include <vector>
#include "Settings.h"
/*
struct target
{
// example test target
QString test_target_filename;
QRect test_target_rect;
QRect test_target_rect_absolute;
// image file
QString image_filename;
QString image_folder;
QPoint image_absolute_offset;
QString image_description; // what is this image scan 1,1 or which target or which sub-frame
// experimental log (do we save this in xml?)
SettingsValues settings; // image analysis settings that gave rise to the analysis
QString image_processing_steps; // lab book record/history of processing with name of image files (eg. image 1) created at
// each step with date for each start and end of program usage, with time taken for processing
// targets within image
QVector<QString> targets_filenames;
QVector<QPoint> targets_center; // belongs to image
QVector<QRect> targets_rect;
QVector<QPoint> fiducial_marks;
};
*/
/* image :
scanRegions : []
stageMovements : []
image -> targets : []
*/
// information about target
class Target{
public:
Target(){};
QVector3D position; /// position of target
QPoint imagePosition;
QRect region; /// roi of target region in image
QString image; /// link to image file of target roi
int ID; /// uid number of target
} ;
class ImageData;
// information about position of stage
class StageCoordinates {
public:
StageCoordinates() {};
StageCoordinates(const StageCoordinates& sc)
{
index = sc.index;
stagePosition3D = sc.stagePosition3D;
tileSize = sc.tileSize;
childImage = sc.childImage;
}
QPoint index; /// raster index position of image
QVector3D stagePosition3D; /// actual stage positions of image
QSize tileSize; /// actual size of region in image
// image scanned of this region
QSharedPointer<ImageData> childImage; /// scanned image
};
// description of region to be scanned for image
class ScanRegion {
public:
ScanRegion(){
stagePositionIndex = 0;
ID = "";
name = "";
regionDescription = "";
scanRegion = QRectF();
};
~ScanRegion(){ clear(); };
void clear(){ stagePositions.empty(); }
ScanRegion(const ScanRegion& sr)
{
regionShape = sr.regionShape;
ID = sr.ID;
name = sr.name;
regionDescription = sr.regionDescription;
scanRegion = sr.scanRegion;
scanRegionIndex = sr.scanRegionIndex;
stagePositions.empty();
foreach(StageCoordinates sc, sr.stagePositions)
stagePositions.append(sc);
stagePositionIndex = sr.stagePositionIndex;
}
StageCoordinates& getStagePosition(bool& bFound){
bFound = false;
if (stagePositionIndex < stagePositions.length()) {
bFound = true;
return stagePositions[stagePositionIndex];
}
}
StageCoordinates& incrementStagePosition(bool& bFound)
{
stagePositionIndex++;
StageCoordinates sc = getStagePosition(bFound);
if(!bFound)
stagePositionIndex--;
else
return sc;
}
// scan region shape information
drawingMode::drawingMode regionShape; /// region shape type
// annotation information for region (copied from drawing shape)
QString ID;
QString name;
QString regionDescription; /// annotated region descriptor
QRectF scanRegion; /// position of region in image
int scanRegionIndex; /// index of region
// scan information
QVector<StageCoordinates> stagePositions; /// list of stage coordinates for this region
int stagePositionIndex; /// index of stage position being processed
};
// information obtained from a single image
class ImageData
{
public:
ImageData(){
scanRegionIndex=0;
targetListIndex=0;
filename = "";
imageDescription = "";
shapeType = drawingMode::none;
FrameID = "";
patternRegion = QRect();
SubFrameID = "";
subRegionID = "";
};
~ImageData(){clear();}
void clear(){
scanRegion.clear();
scanRegion.empty();
targetList.empty();
}
ImageData(const ImageData& id)
{
filename = id.filename;
imageDescription = id.imageDescription;
shapeType = id.shapeType;
FrameID = id.FrameID;
patternRegion = id.patternRegion;
SubFrameID = id.SubFrameID;
subRegionID = id.subRegionID;
scanRegion.empty();
foreach(ScanRegion sl, id.scanRegion)
scanRegion.append(sl);
scanRegionIndex = id.scanRegionIndex;
targetList.empty();
foreach(Target tar, id.targetList)
targetList.append(tar);
}
Target& getTarget(bool& bFound) {
bFound = false;
if (targetListIndex < targetList.length()) {
bFound = true;
return targetList[targetListIndex];
}
};
ScanRegion& getScanRegion(bool& bFound) {
bFound = false;
if (scanRegionIndex < scanRegion.length()){
bFound = true;
return scanRegion[scanRegionIndex];
}
};
ScanRegion& incrementScanRegion(bool& bFound)
{
scanRegionIndex++;
ScanRegion sc = getScanRegion(bFound);
sc.stagePositionIndex = 0;
if (!bFound)
scanRegionIndex--;
else
return sc;
}
QString filename;
QString imageDescription;
// target region shape information in the case of single image
drawingMode::drawingMode shapeType;
// image information in the case of single image (ie. not scanned)
QString FrameID;
QRect patternRegion;
QString SubFrameID;
QString subRegionID;
// scan region information (if any)
QVector<ScanRegion> scanRegion; /// regions in image that will be scanned
int scanRegionIndex; /// index of region being processed
// list of targets
QVector<Target> targetList; /// list of targets
int targetListIndex;
};
//QVector<StageMovement> scannedAreas; /// scanned information if any
/*
// image and its corresponding stage position
typedef struct {
QVector3D stagePosition3D; /// position of stage for this image
ImageData imageData;
} scannedImage;
// a scan of a frame, with scan regions, frame id and image filename
typedef struct {
QVector<scanRegion> scanRegion; /// string can be region description or ID number
QString FrameID;
QString filename;
} TargetDetectionExperiments;
// information on scanned areas
typedef struct {
QVector<QSharedPointer<drawingObject>> m_overviewShape;
StagePosition<double> stagePositionsZ;
StagePosition<StageMovement> stagePositionsXY;
QVector<Target> m_Targets;
} ScanResult;
class ExperimentalData
{
public:
ExperimentalData() {
stagePositionsZ = QSharedPointer<StagePosition<double>>(new StagePosition<double>());
stagePositionsXY = QSharedPointer<StagePosition<StageMovement>>(new StagePosition<StageMovement>());
};
~ExperimentalData() {
scannedAreas.clear();
shapes.clear();
m_detected_targets.clear();
image_filenames.clear();
subimage_filename.clear();
processedImages.clear();
};
// list of all images in experiment with information about that image and children images
QVector<ImageData> processedImages;
// the below not necessary! contained in processed Images
QVector<QString> image_filenames;
QVector<QString> subimage_filename;
QSharedPointer<StagePosition<double>> stagePositionsZ;
QSharedPointer<StagePosition<StageMovement>> stagePositionsXY;
// shapes drawn on an image
QVector<drawingShape> shapes;
QVector<ScanResult> scannedAreas;
QVector<Target> m_detected_targets; /// list of detected target positions
};
*/
#endif