CycloBranch
cImageWindowTabOptical.h
Go to the documentation of this file.
1
7#ifndef _CIMAGEWINDOWTABOPTICAL_H
8#define _CIMAGEWINDOWTABOPTICAL_H
9
10#include <QWidget>
11#include <QGridLayout>
12#include <QHBoxLayout>
13#include <QVBoxLayout>
14#include <QLabel>
15#include <QLineEdit>
16#include <QPushButton>
17#include <QListWidget>
18#include <QComboBox>
19#include <QFileDialog>
20#include <xercesc/framework/MemBufInputSource.hpp>
21#include <xercesc/parsers/XercesDOMParser.hpp>
22
23#include "core/utilities.h"
24
25
26using namespace xercesc;
27
28
33 gray = 0,
34 red = 1,
35 green = 2,
36 blue = 3
37};
38
39
43struct cTileInfo {
44
48 int fieldx;
49
50
54 int fieldy;
55
56
60 double posx;
61
62
66 double posy;
67
68
73 fieldx = 0;
74 fieldy = 0;
75 posx = 0;
76 posy = 0;
77 }
78
79
83 void print() {
84 cout << "fieldx: " << fieldx << endl;
85 cout << "fieldy: " << fieldy << endl;
86 cout << "posx: " << posx << endl;
87 cout << "posy: " << posy << endl;
88 }
89
90};
91
92
97
101 string imagename;
102
103
108
109
114
115
120
121
126
127
131 int flipx;
132
133
137 int flipy;
138
139
143 int dimx;
144
145
149 int dimy;
150
151
155 int dimz;
156
157
161 int dim10;
162
163
167 double width;
168
169
173 double height;
174
175
179 double stageposx;
180
181
185 double stageposy;
186
187
191 long long unsigned memoryblocksize;
192
193
198
199
203 vector<long long unsigned> memoryblockoffsets;
204
205
209 vector<eChannelType> channels;
210
211
215 vector<string> luts;
216
217
222
223
228
229
233 vector<cTileInfo> tiles;
234
235
240 imagename.clear();
241 microscopytype = -1;
242 microscopemodel.clear();
244 magnification = 0;
245 flipx = 0;
246 flipy = 0;
247 dimx = 0;
248 dimy = 0;
249 dimz = 0;
250 dim10 = 0;
251 width = 0;
252 height = 0;
253 stageposx = 0;
254 stageposy = 0;
255 memoryblocksize = 0;
256 memoryblockid = "";
257 memoryblockoffsets.clear();
258 channels.clear();
259 luts.clear();
262 tiles.clear();
263 }
264
265
269 void print() {
270 cout << "imagename: " << imagename << endl;
271 cout << "microscopytype: " << microscopytype << endl;
272 cout << "microscopemodel: " << microscopemodel << endl;
273 cout << "inversemicroscopemodel: " << inversemicroscopemodel << endl;
274 cout << "magnification: " << magnification << endl;
275 cout << "flipx: " << flipx << endl;
276 cout << "flipy: " << flipy << endl;
277 cout << "dimx: " << dimx << endl;
278 cout << "dimy: " << dimy << endl;
279 cout << "dimz: " << dimz << endl;
280 cout << "dim10: " << dim10 << endl;
281 cout << "width: " << width << endl;
282 cout << "height: " << height << endl;
283 cout << "stageposx: " << stageposx << endl;
284 cout << "stageposy: " << stageposy << endl;
285 cout << "memoryblocksize: " << memoryblocksize << endl;
286 cout << "memoryblockid: " << memoryblockid << endl;
287
288 for (int i = 0; i < (int)memoryblockoffsets.size(); i++) {
289 cout << "memoryblockoffset " << i + 1 << ": " << memoryblockoffsets[i] << endl;
290 }
291
292 for (int i = 0; i < (int)channels.size(); i++) {
293 cout << "channel " << i + 1 << ": " << channels[i] << endl;
294 }
295
296 for (int i = 0; i < (int)luts.size(); i++) {
297 cout << "lut " << i + 1 << ": " << luts[i] << endl;
298 }
299
300 cout << "tilescaninfoflipx: " << tilescaninfoflipx << endl;
301 cout << "tilescaninfoflipy: " << tilescaninfoflipy << endl;
302
303 double avgposx = 0;
304 double avgposy = 0;
305
306 for (auto& it : tiles) {
307 it.print();
308
309 avgposx += it.posx;
310 avgposy += it.posy;
311 }
312
313 if (tiles.size() > 0) {
314 avgposx /= (double)tiles.size();
315 avgposy /= (double)tiles.size();
316
317 cout << "avgposx: " << avgposx << endl;
318 cout << "avgpoxy: " << avgposy << endl;
319 }
320
321 cout << endl;
322 }
323
324};
325
326
332void readLifMetadata(string filename, vector<cLifMetadata>& parsedmetadata);
333
334
340void parseLifMetadataSubTree(DOMElement* subtree, vector<cLifMetadata>& parsedmetadata);
341
342
348void parseLifMetadata(string& metadata, vector<cLifMetadata>& parsedmetadata);
349
350
354class cImageWindowTabOptical : public QWidget
355{
356 Q_OBJECT
357
358public:
359
360
365 explicit cImageWindowTabOptical(QWidget *parent = 0);
366
367
373 void setFormValues(QString& lastdirmicroscopyimage, int numberoflayers);
374
375
383 void getFormValues(int& startfromindex, QStringList& tiffilenames, int& navigationindex, QString& liffilename);
384
385
390
391
392private:
393
394 QString* lastdirmicroscopyimage;
395
396 QGridLayout* gridlayout;
397
398 QLabel* labelstartfrom;
399 QComboBox* comboboxstartfrom;
400
401 QLabel* labelusevaluesfrom;
402 QComboBox* comboboxusevaluesfrom;
403
404 QLabel* labellif;
405 QLineEdit* lineeditlif;
406 QPushButton* buttonlif;
407
408 QLabel* labelfilenames;
409 QListWidget* listwidgetfilenames;
410 QPushButton* buttonfilenames;
411 QStringList imagenames;
412
413
414private slots:
415
416 void browseButtonReleased();
417
418 void lifButtonReleased();
419
420
421};
422
423
424#endif
425
void parseLifMetadataSubTree(DOMElement *subtree, vector< cLifMetadata > &parsedmetadata)
Parse metadata from a subtree of a lif file.
Definition: cImageWindowTabOptical.cpp:355
void readLifMetadata(string filename, vector< cLifMetadata > &parsedmetadata)
Get metadata from a lif file.
Definition: cImageWindowTabOptical.cpp:5
eChannelType
Color channels.
Definition: cImageWindowTabOptical.h:32
void parseLifMetadata(string &metadata, vector< cLifMetadata > &parsedmetadata)
Parse metadata from a lif file.
Definition: cImageWindowTabOptical.cpp:677
const int numberoflayers
The number of layers.
Definition: cImageWindowWidget.h:21
The class representing a tab used to import images from light microscopy.
Definition: cImageWindowTabOptical.h:355
cImageWindowTabOptical(QWidget *parent=0)
The constructor.
Definition: cImageWindowTabOptical.cpp:740
~cImageWindowTabOptical()
The destructor.
Definition: cImageWindowTabOptical.cpp:819
void setFormValues(QString &lastdirmicroscopyimage, int numberoflayers)
Initialize values in the form.
Definition: cImageWindowTabOptical.cpp:788
void getFormValues(int &startfromindex, QStringList &tiffilenames, int &navigationindex, QString &liffilename)
Get the values from the form.
Definition: cImageWindowTabOptical.cpp:811
A structure to keep parsed lif metadata.
Definition: cImageWindowTabOptical.h:96
int dimy
Height [pixels].
Definition: cImageWindowTabOptical.h:149
long long unsigned memoryblocksize
Memory block size.
Definition: cImageWindowTabOptical.h:191
string microscopemodel
Microscope model.
Definition: cImageWindowTabOptical.h:113
double width
Width [m].
Definition: cImageWindowTabOptical.h:167
vector< eChannelType > channels
Color channels.
Definition: cImageWindowTabOptical.h:209
double height
Height [m].
Definition: cImageWindowTabOptical.h:173
int tilescaninfoflipx
Flip X from TileScanInfo.
Definition: cImageWindowTabOptical.h:221
string memoryblockid
Memory block ID.
Definition: cImageWindowTabOptical.h:197
int dimz
Depth [layers].
Definition: cImageWindowTabOptical.h:155
void print()
Print metadata.
Definition: cImageWindowTabOptical.h:269
int dim10
Number of tiles.
Definition: cImageWindowTabOptical.h:161
string imagename
Image name.
Definition: cImageWindowTabOptical.h:101
int flipy
Flip Y.
Definition: cImageWindowTabOptical.h:137
int inversemicroscopemodel
Inverse microscope model.
Definition: cImageWindowTabOptical.h:119
double stageposy
Stage position y [m].
Definition: cImageWindowTabOptical.h:185
vector< long long unsigned > memoryblockoffsets
Offsets of memory blocks.
Definition: cImageWindowTabOptical.h:203
int magnification
Magnification.
Definition: cImageWindowTabOptical.h:125
double stageposx
Stage position x [m].
Definition: cImageWindowTabOptical.h:179
vector< cTileInfo > tiles
Vector of tiles.
Definition: cImageWindowTabOptical.h:233
cLifMetadata()
The constructor.
Definition: cImageWindowTabOptical.h:239
int flipx
Flip X.
Definition: cImageWindowTabOptical.h:131
int tilescaninfoflipy
Flip Y from TileScanInfo.
Definition: cImageWindowTabOptical.h:227
vector< string > luts
LUTs.
Definition: cImageWindowTabOptical.h:215
int microscopytype
Type of microscopy technique (-1 = unknown, 0 = optical, 1 = fluorescence).
Definition: cImageWindowTabOptical.h:107
int dimx
Width [pixels].
Definition: cImageWindowTabOptical.h:143
Description of an image tile.
Definition: cImageWindowTabOptical.h:43
int fieldx
Tile logical x coordinate.
Definition: cImageWindowTabOptical.h:48
cTileInfo()
The constructor.
Definition: cImageWindowTabOptical.h:72
double posx
Tile position x [m].
Definition: cImageWindowTabOptical.h:60
void print()
Print the metadata.
Definition: cImageWindowTabOptical.h:83
int fieldy
Tile logical y coordinate.
Definition: cImageWindowTabOptical.h:54
double posy
Tile position y [m].
Definition: cImageWindowTabOptical.h:66
Auxiliary funtions and structures.