CycloBranch
cImageWindow.h
Go to the documentation of this file.
1
7#ifndef _CIMAGEWINDOW_H
8#define _CIMAGEWINDOW_H
9
10#include <QMainWindow>
11#include <QDesktopServices>
12#include <QToolBar>
13#include <QAction>
14#include <QGridLayout>
15#include <QCheckBox>
16#include <QSlider>
17#include <QSplitter>
18#include <QRadioButton>
19#include <QSpinBox>
20#include <QDoubleSpinBox>
21#include <QInputDialog>
22#include <QMessageBox>
23#include <QScrollArea>
24#include <QProgressDialog>
25#include "core/utilities.h"
30
31
32// forward declaration
33class QHBoxLayout;
34class QVBoxLayout;
35class QPushButton;
36class QImage;
37class QLabel;
38class QAction;
39class QToolBar;
40class QMenuBar;
41class QMenu;
42
43
51 int type;
52
53
58
59
63 QString sourcename;
64
65
69 QString imagename;
70
71
75 bool flipx;
76
77
81 bool flipy;
82
83
87 double x;
88
89
93 double y;
94
95
99 double width;
100
101
105 double height;
106
107
111 double angle;
112
113
118
119
124
125
129 double stagex;
130
131
135 double stagey;
136
137
141 QImage* image;
142
143
148
149
154
155
160
161
166 image = new QImage();
167 clear();
168 }
169
170
175 type = layer.type;
177 sourcename = layer.sourcename;
178 imagename = layer.imagename;
179 flipx = layer.flipx;
180 flipy = layer.flipy;
181 x = layer.x;
182 y = layer.y;
183 width = layer.width;
184 height = layer.height;
185 angle = layer.angle;
188 stagex = layer.stagex;
189 stagey = layer.stagey;
190 image = new QImage();
191 *image = *layer.image;
192 reduced = layer.reduced;
195 }
196
197
202 delete image;
203 }
204
205
209 void clear() {
210 type = -1;
211 navigationlayer = 3;
212 sourcename.clear();
213 imagename.clear();
214 flipx = false;
215 flipy = false;
216 x = 0;
217 y = 0;
218 width = 0;
219 height = 0;
220 angle = 0;
221 defaultwidth = 0;
222 defaultheight = 0;
223 stagex = 0;
224 stagey = 0;
225
226 delete image;
227 image = new QImage();
228
229 reduced = false;
230 thresholdmin = 0;
231 thresholdmax = 255;
232 }
233};
234
235
239class cImageWindow : public QMainWindow
240{
241 Q_OBJECT
242
243public:
244
245
251 cImageWindow(cGlobalPreferences* globalpreferences, QWidget* parent = (QWidget *)0);
252
253
258
259
264 void closeEvent(QCloseEvent *event);
265
266
276 void setDefaultValues(string imzmlfilename, int defaultmaxx, int defaultmaxy, int defaultpixelsizex, int defaultpixelsizey, eVendorType vendor);
277
278
283 void addLayer(QString name);
284
285
290 void applyGlobalPreferences(cGlobalPreferences* globalpreferences);
291
292
293private:
294
295 QString editorname;
296
297 cImageWindowImportDialog importdialog;
298
299 cGlobalPreferences* globalpreferences;
300 QWidget* parent;
301
302 QMenuBar* menuBar;
303 QMenu* menuFile;
304 QMenu* menuView;
305 QMenu* menuHelp;
306
307 QToolBar* toolbarFile;
308 QAction* actionLoadLayers;
309 QAction* actionSaveLayers;
310 QAction* actionSaveLayersAs;
311 QAction* actionOpenImage;
312 QAction* actionImportDialog;
313 QAction* actionExportImage;
314 QAction* actionClearAll;
315 QAction* actionCloseWindow;
316
317 QToolBar* toolbarView;
318 QAction* actionShowSelection;
319 QAction* actionColorScale;
320 QAction* actionAbsoluteIntensity;
321 QAction* actionZoomIn;
322 QAction* actionZoomOut;
323 QAction* actionZoomReset;
324 QAction* actionFlipHistologyHorizontal;
325 QAction* actionFlipHistologyVertical;
326 QAction* actionFlipMicroscopyHorizontal;
327 QAction* actionFlipMicroscopyVertical;
328
329 QLabel* rulerLabel;
330 QDoubleSpinBox* rulerValue;
331
332 QToolBar* toolbarRegion;
333 QWidget* regionwidget;
334 QHBoxLayout* regionhbox;
335 QLabel* xfromlabel;
336 QSpinBox* xfrom;
337 QLabel* xtolabel;
338 QSpinBox* xto;
339 QLabel* yfromlabel;
340 QSpinBox* yfrom;
341 QLabel* ytolabel;
342 QSpinBox* yto;
343 QPushButton* setregionbutton;
344 QPushButton* resetregionbutton;
345
346 QToolBar* toolbarMaxCoordinates;
347 QWidget* maxcoordinateswidget;
348 QHBoxLayout* maxcoordinateshbox;
349 QLabel* leftshiftlabel;
350 QSpinBox* leftshift;
351 QLabel* topshiftlabel;
352 QSpinBox* topshift;
353 QLabel* maxxlabel;
354 QSpinBox* maxx;
355 QLabel* maxylabel;
356 QSpinBox* maxy;
357 QLabel* pixelsizexlabel;
358 QSpinBox* pixelsizexspinbox;
359 QLabel* pixelsizeylabel;
360 QSpinBox* pixelsizeyspinbox;
361 QPushButton* setmaxbutton;
362 QPushButton* setdefaultbutton;
363
364 QToolBar* toolbarHistology;
365 QWidget* histologywidget;
366 QHBoxLayout* histologyhbox;
367 QLabel* histologyxlabel;
368 QSpinBox* histologyx;
369 QLabel* histologyylabel;
370 QSpinBox* histologyy;
371 QLabel* histologywidthlabel;
372 QSpinBox* histologywidth;
373 QLabel* histologyheightlabel;
374 QSpinBox* histologyheight;
375 QLabel* histologyanglelabel;
376 QDoubleSpinBox* histologyangle;
377
378 QToolBar* toolbarMicroscopy;
379 QWidget* microscopywidget;
380 QHBoxLayout* microscopyhbox;
381 QLabel* microscopyxlabel;
382 QDoubleSpinBox* microscopyx;
383 QLabel* microscopyylabel;
384 QDoubleSpinBox* microscopyy;
385 QLabel* microscopywidthlabel;
386 QDoubleSpinBox* microscopywidth;
387 QLabel* microscopyheightlabel;
388 QDoubleSpinBox* microscopyheight;
389 QLabel* microscopyanglelabel;
390 QDoubleSpinBox* microscopyangle;
391 QLabel* microscopynavigationlabel;
392 QComboBox* microscopynavigationcombobox;
393 QPushButton* microscopydefaultbutton;
394 QPushButton* microscopygobutton;
395 QPushButton* microscopyprevbutton;
396 QPushButton* microscopynextbutton;
397
398 QToolBar* toolbarHelp;
399 QAction* actionHTMLDocumentation;
400
401 QImage* image;
402 QImage* histologyimage;
403
404 // layer == 0 - compounds
405 // layer == 1 - optical image
406 // layer == 2 - histology image
407 // layer == 3 - microscopy navigation image
408 // layer >= 4 - microscopy images
409 vector<microscopyLayerInfo> microscopylayers;
410
411 cImageWindowWidget* imagewindowwidget;
412 QGridLayout* layerslayout;
413 QWidget* layerswidget;
414 QScrollArea* layersscrollarea;
415 QSplitter* mainwidget;
416
417 int layerscount;
418 int activelayer;
419
420 QString lastdiropticalimage;
421 QString lastdirhistologyimage;
422 QString lastdirmicroscopyimage;
423 QString lastdirexportimage;
424 QString lastdirlayersfile;
425
426 bool layersfileloaded;
427 bool saveascalled;
428
429 string imzmlfilename;
430
431 int defaultmaxx;
432 int defaultmaxy;
433
434 int defaultpixelsizex;
435 int defaultpixelsizey;
436
437 eVendorType vendor;
438
439 bool redrawenabled;
440
441 void colorSpinBoxes(int layerid);
442
443 void openOpticalImage();
444
445 void reopenOpticalImage(QString filename);
446
447 void openHistologyImage();
448
449 void reopenHistologyImage(QString filename);
450
451 bool parseMicroscopyImage(QString& filename, double& pixelwidth, double& pixelheight, int& resolutionx, int& resolutiony, double& realwidth, double& stagex, double& stagey);
452
453 void openMicroscopyImage(int layer, const QString &layername);
454
455 void reopenMicroscopyImage(int layer, QString filename, bool reopen);
456
457 void clearLayers();
458
459 void updateMicroscopyNavigationCombobox(int numberofitems);
460
461 bool checkLoadedImage(QImage* image);
462
463 void readLifImageOptical(string filename, cLifMetadata& metadata, QImage& image, bool enableprogress);
464
465 void readLifImageFluorescence(string filename, cLifMetadata& metadata, QImage& image, int minthreshold, int maxthreshold, bool enableprogress);
466
467 void openLifImage(string liffilename, int layer, cLifMetadata& metadata, bool enableprogress);
468
469 void setNavigationLayer(int layer, int navigation);
470
471
472protected:
473
474
479 void keyPressEvent(QKeyEvent *event);
480
481
486 void keyReleaseEvent(QKeyEvent *event);
487
488
489private slots:
490
491
492 void closeWindow();
493
494
495 void selectImageType();
496
497
498 void imageTypeSelected(const QString &s);
499
500
501 void openImportDialog();
502
503
504 void exportImage();
505
506
507 void setFilterOptionsSlot(vector<cCoordinateInfo> coordinates, bool operatortype, string columnname1, string comparatorname1, string filterstring1, string columnname2, string comparatorname2, string filterstring2, bool casesensitive, bool wholeword);
508
509
510 void setMaxButtonReleased();
511
512
513 void setDefaultButtonReleased();
514
515
516 void setRegionButtonReleased();
517
518
519 void histologyChanged();
520
521
522 void histologyPositionChanged(int value);
523
524
525 void histologyAngleChanged(double value);
526
527
528 void microscopyChanged();
529
530
531 void microscopyDefaultButtonReleased();
532
533
534 void microscopyGoButtonReleased();
535
536
537 void microscopyPrevButtonReleased();
538
539
540 void microscopyNextButtonReleased();
541
542
543 void microscopyPositionChanged(double value);
544
545
546 void microscopyAngleChanged(double value);
547
548
549 void microscopyFlipStateChanged(bool state);
550
551
552 void showHTMLDocumentation();
553
554
555 void updateSelection(int xmin, int xmax, int ymin, int ymax);
556
557
558 void clearSelection();
559
560
561 void resetSelection();
562
563
564 void updatePointsArea(int xmin, int xmax, int ymin, int ymax);
565
566
567 void layerSpinBoxChangedSlot(int alpha);
568
569
570 void layerZValueChangedSlot(int zvalue);
571
572
573 void layerCheckBoxChangedSlot(int state);
574
575
576 void activeLayerChangedSlot(bool checked);
577
578
579 void updateHistologySlot(int x, int y, int width, int height, double angle);
580
581
582 void updateMicroscopySlot(bool flipx, bool flipy, double x, double y, double width, double height, double angle);
583
584
585 void updateRulerSlot(double value);
586
587
588 void imageDoubleClickedSlot(int spectrumid);
589
590
591 void loadLayers();
592
593
594 void saveLayers();
595
596
597 void saveLayersAs();
598
599
600 void clearAllLayersSlot();
601
602
603 void microscopyNavigationChanged(int index);
604
605
606 void clearLayer();
607
608
609signals:
610
611
619 void updateSummaryPeaksTableFilter(int xmin, int xmax, int ymin, int ymax);
620
621
630 void layerChanged(int layerid, bool checked, int alpha, int zvalue, bool redraw);
631
632
637 void activeLayerChanged(int layerid);
638
639
644 void doubleClickedSpectrumIDSignal(int spectrumid);
645
646
647};
648
649#endif
The representation of a set of peptide sequence candidates.
The implementation of import dialog in image window.
The implementation of a tab used to import images from light microscopy.
Image window widget.
The class storing global preferences.
Definition: cGlobalPreferences.h:104
Image window.
Definition: cImageWindow.h:240
void activeLayerChanged(int layerid)
The signal is emitted when a layer is selected.
void keyReleaseEvent(QKeyEvent *event)
Handle a key release event.
Definition: cImageWindow.cpp:954
void keyPressEvent(QKeyEvent *event)
Handle a key press event.
Definition: cImageWindow.cpp:933
void updateSummaryPeaksTableFilter(int xmin, int xmax, int ymin, int ymax)
The signal is emitted when the region selection was changed.
void doubleClickedSpectrumIDSignal(int spectrumid)
The signal is emitted the image is double clicked.
void applyGlobalPreferences(cGlobalPreferences *globalpreferences)
Apply new global preferences.
Definition: cImageWindow.cpp:826
void addLayer(QString name)
Add a layer.
Definition: cImageWindow.cpp:747
void closeEvent(QCloseEvent *event)
Handle the window close event.
Definition: cImageWindow.cpp:715
~cImageWindow()
The destructor.
Definition: cImageWindow.cpp:614
cImageWindow(cGlobalPreferences *globalpreferences, QWidget *parent=(QWidget *) 0)
The constructor.
Definition: cImageWindow.cpp:16
void setDefaultValues(string imzmlfilename, int defaultmaxx, int defaultmaxy, int defaultpixelsizex, int defaultpixelsizey, eVendorType vendor)
Set the filename and some default values parsed from the imzML file.
Definition: cImageWindow.cpp:721
void layerChanged(int layerid, bool checked, int alpha, int zvalue, bool redraw)
The signal is emitted when a layer was changed.
Import dialog in image window.
Definition: cImageWindowImportDialog.h:28
Image window widget.
Definition: cImageWindowWidget.h:205
A structure to keep parsed lif metadata.
Definition: cImageWindowTabOptical.h:96
Paramaters of a microscopy layer.
Definition: cImageWindow.h:47
microscopyLayerInfo()
The constructor.
Definition: cImageWindow.h:165
double y
Y position.
Definition: cImageWindow.h:93
int thresholdmin
Noise threshold.
Definition: cImageWindow.h:153
double height
Height.
Definition: cImageWindow.h:105
int navigationlayer
Index of navigation layer.
Definition: cImageWindow.h:57
int thresholdmax
Signal threshold.
Definition: cImageWindow.h:159
double stagex
Stage X.
Definition: cImageWindow.h:129
double angle
Rotation angle [degrees].
Definition: cImageWindow.h:111
QString sourcename
Source file name.
Definition: cImageWindow.h:63
bool flipy
Flip vertically.
Definition: cImageWindow.h:81
double width
Width.
Definition: cImageWindow.h:99
QImage * image
QImage.
Definition: cImageWindow.h:141
bool flipx
Flip horizontally.
Definition: cImageWindow.h:75
~microscopyLayerInfo()
The destructor.
Definition: cImageWindow.h:201
microscopyLayerInfo(const microscopyLayerInfo &layer)
The copy constructor.
Definition: cImageWindow.h:174
void clear()
Clear the structure.
Definition: cImageWindow.h:209
bool reduced
True if the image size has been reduced.
Definition: cImageWindow.h:147
double defaultheight
Default height.
Definition: cImageWindow.h:123
double x
X position.
Definition: cImageWindow.h:87
QString imagename
Image name.
Definition: cImageWindow.h:69
double stagey
Stage Y.
Definition: cImageWindow.h:135
int type
Type (0 = FEI SEM, 1 = LEICA LIF).
Definition: cImageWindow.h:51
double defaultwidth
Default width.
Definition: cImageWindow.h:117
Auxiliary funtions and structures.
eVendorType
Vendor types.
Definition: utilities.h:82