CycloBranch
cChromatogramWindowWidget.h
Go to the documentation of this file.
1
7#ifndef _CCHROMATOGRAMWINDOWWIDGET_H
8#define _CCHROMATOGRAMWINDOWWIDGET_H
9
10#include <QWidget>
11#include <QGraphicsView>
12#include <QGraphicsSimpleTextItem>
13#include <QScrollBar>
14#include <QMessageBox>
15#include <QPrinter>
16#include <QSvgGenerator>
17#include <QImage>
18#include <QMouseEvent>
19#include <QProgressDialog>
20#include "core/utilities.h"
22#include "gui/cEventFilter.h"
24
25
26using namespace std;
27
28
35double getGaussianArea(double sigma, double height);
36
37
44double getGaussianAreas(vector<double>& sigmas, vector<double>& heights);
45
46
57double getExponentiallyModifiedGaussianArea(double x, double h, double ny, double sigma, double tau, bool fronting);
58
59
70double getExponentiallyModifiedGaussianAreas(vector<double>& xvalues, vector<double>& heights, vector<double>& nys, vector<double>& sigmas, vector<double>& taus, bool fronting);
71
72
78double erfcx(double z);
79
80
86double erfcxinv(double z);
87
88
99double computeExponentiallyModifiedGaussFunction(double x, double h, double ny, double sigma, double tau, bool fronting);
100
101
110double computeExponentialFunction(double x, double base, double tau, bool fronting);
111
112
121void calculateCaruana(vector<double>& x, vector<double>& y, double& ny, double& sigma, double& height);
122
123
133void calculateGuo(vector<double>& x, vector<double>& y, int iterations, double& ny, double& sigma, double& height);
134
135
146void calculateBaseTau(vector<double>& x, vector<double>& y, int iterations, bool fronting, double ynorm, double& base, double& tau);
147
148
156void calculateTauUsingWeightedAverage(vector<double>& x, vector<double>& y, bool fronting, double& tau);
157
158
170void calculateGaussianParameters(cPeaksList& eicchromatogram, vector<double>& rtimes, int timeunit, bool absoluteintensity, bool usert, vector<double>& nys, vector<double>& sigmas, vector<double>& as);
171
172
185void calculateExponentialParameters(cPeaksList& eicchromatogram, vector<double>& rtimes, int timeunit, bool absoluteintensity, bool usert, bool fronting, double ynorm, vector<double>& bases, vector<double>& taus);
186
187
191class cChromatogramWindowWidget : public QGraphicsView
192{
193 Q_OBJECT
194
195public:
196
197
203 cChromatogramWindowWidget(cTheoreticalSpectrumList& listoftheoreticalspectra, QWidget* parent = 0);
204
205
210
211
217 void exportToPDF(QString filename, bool postscript);
218
219
224 void exportToSVG(QString filename);
225
226
231 void exportToPNG(QString filename);
232
233
238 void recalculateTICChromatogram(int activefileid);
239
240
245
246
247protected:
248
249
254 void wheelEvent(QWheelEvent *event);
255
256
261 void mouseMoveEvent(QMouseEvent *event);
262
263
268 void mouseReleaseEvent(QMouseEvent *event);
269
270
275 void mousePressEvent(QMouseEvent *event);
276
277
282 void mouseDoubleClickEvent(QMouseEvent *event);
283
284
289 void showEvent(QShowEvent *event);
290
291
296 void resizeEvent(QResizeEvent *event);
297
298
299private:
300
301 cTheoreticalSpectrumList* listoftheoreticalspectra;
302 cPeaksList ticchromatogram;
303 cPeaksList eicchromatogram;
304 vector<double> rtimes;
305
306 QWidget* parent;
307 QGraphicsScene* scene;
308 QMatrix originalmatrix;
309
310 QGraphicsItemGroup* zoomgroup;
311 QGraphicsRectItem* zoomrect;
312 QGraphicsSimpleTextItem* zoomsimpletextitem;
313
314 int origwidth;
315 int origheight;
316
317 qreal currentscale;
318 qreal factor;
319
320 int pressedx;
321 int pressedy;
322
323 int currentx;
324 int currenty;
325
326 double mintime;
327 double maxtime;
328
329 int minscan;
330 int maxscan;
331
332 int topmargin;
333 int bottommargin;
334 int leftmargin;
335 int rightmargin;
336
337 bool firstshow;
338 bool enablemouseselection;
339
340 bool retentiontime;
341 bool absoluteintensity;
342 bool rawdatastate;
343 int peakshape;
344 bool hidetic;
345 bool hideeic;
346 bool hidelabels;
347
348
349 int getScanIDFromXPosition(int x, int w);
350
351
352 int getXPositionFromScanID(int scanid, int w);
353
354
355 void redrawScene();
356
357
358 void updateZoomGroup();
359
360
361 void calculateMinMaxScan();
362
363
364signals:
365
371 void updateRetentionTimeInterval(double mintime, double maxtime);
372
373
379 void updateScanIDInterval(int minid, int maxid);
380
381
387
388
389private slots:
390
391
392 void zoomIn();
393
394
395 void zoomOut();
396
397
398 void normalSize();
399
400
401 void retentionTimeStateChanged(bool state);
402
403
404 void absoluteIntensityStateChanged(bool state);
405
406
407 void rawDataStateChanged(bool state);
408
409
410 void setRetentionTimeInterval(double mintime, double maxtime);
411
412
413 void resetRetentionTimeInterval();
414
415
416 void setScanIDInterval(int minid, int maxid);
417
418
419 void resetScanIDInterval();
420
421
422 void enableMouseSelectionTool(bool enable);
423
424
425 void hideTIC(bool state);
426
427
428 void hideEIC(bool state);
429
430
431 void hideLabels(bool state);
432
433
434 void peakShapeChanged(int shape);
435
436};
437
438#endif
double getGaussianArea(double sigma, double height)
Get area under Gaussian function.
Definition: cChromatogramWindowWidget.cpp:4
double computeExponentialFunction(double x, double base, double tau, bool fronting)
Compute value of exponential function.
Definition: cChromatogramWindowWidget.cpp:257
double erfcxinv(double z)
Calculate erfcxinv(z).
Definition: cChromatogramWindowWidget.cpp:177
double getExponentiallyModifiedGaussianAreas(vector< double > &xvalues, vector< double > &heights, vector< double > &nys, vector< double > &sigmas, vector< double > &taus, bool fronting)
Get area of EIC peaks (Exponentially Modified Gaussian function).
Definition: cChromatogramWindowWidget.cpp:82
void calculateExponentialParameters(cPeaksList &eicchromatogram, vector< double > &rtimes, int timeunit, bool absoluteintensity, bool usert, bool fronting, double ynorm, vector< double > &bases, vector< double > &taus)
Get parameters of Exponential functions (bases and taus).
Definition: cChromatogramWindowWidget.cpp:882
double computeExponentiallyModifiedGaussFunction(double x, double h, double ny, double sigma, double tau, bool fronting)
Compute value of exponentially modified Gaussian function.
Definition: cChromatogramWindowWidget.cpp:195
void calculateTauUsingWeightedAverage(vector< double > &x, vector< double > &y, bool fronting, double &tau)
Calculate tau for exponential distribution using weighted average.
Definition: cChromatogramWindowWidget.cpp:734
double getExponentiallyModifiedGaussianArea(double x, double h, double ny, double sigma, double tau, bool fronting)
Get area under Exponentially Modified Gaussian function.
Definition: cChromatogramWindowWidget.cpp:24
double erfcx(double z)
Calculate erfcx(z).
Definition: cChromatogramWindowWidget.cpp:111
double getGaussianAreas(vector< double > &sigmas, vector< double > &heights)
Get area of EIC peaks (Gaussian function).
Definition: cChromatogramWindowWidget.cpp:9
void calculateGuo(vector< double > &x, vector< double > &y, int iterations, double &ny, double &sigma, double &height)
Calculate ny, sigma, and height using Guo's algorithm.
Definition: cChromatogramWindowWidget.cpp:338
void calculateGaussianParameters(cPeaksList &eicchromatogram, vector< double > &rtimes, int timeunit, bool absoluteintensity, bool usert, vector< double > &nys, vector< double > &sigmas, vector< double > &as)
Get parameters of Gaussians functions (nys, sigmas, and heights).
Definition: cChromatogramWindowWidget.cpp:792
void calculateCaruana(vector< double > &x, vector< double > &y, double &ny, double &sigma, double &height)
Calculate ny, sigma, and height using Caruana's algorithm.
Definition: cChromatogramWindowWidget.cpp:265
void calculateBaseTau(vector< double > &x, vector< double > &y, int iterations, bool fronting, double ynorm, double &base, double &tau)
Calculate base and tau for exponential distribution.
Definition: cChromatogramWindowWidget.cpp:498
An event filter.
The implementation of an isotopic pattern simulator (graphics).
The representation of lists of theoretical spectra.
Chromatogram window widget.
Definition: cChromatogramWindowWidget.h:192
void setEICChromatogram(cPeaksList eic)
Set EIC chromatogram.
Definition: cChromatogramWindowWidget.cpp:1153
void mouseDoubleClickEvent(QMouseEvent *event)
Handle the mouse double click event.
Definition: cChromatogramWindowWidget.cpp:1318
void wheelEvent(QWheelEvent *event)
Handle the mouse wheel event.
Definition: cChromatogramWindowWidget.cpp:1183
void mousePressEvent(QMouseEvent *event)
Handle the mouse press event.
Definition: cChromatogramWindowWidget.cpp:1280
void updateScanIDInterval(int minid, int maxid)
The signal is emitted when the range of scan numbers has been changed.
void mouseMoveEvent(QMouseEvent *event)
Handle the mouse move event.
Definition: cChromatogramWindowWidget.cpp:1216
void showEvent(QShowEvent *event)
Handle the widget show event.
Definition: cChromatogramWindowWidget.cpp:1344
void exportToPDF(QString filename, bool postscript)
Export spectrum scene into a PDF or a PS file.
Definition: cChromatogramWindowWidget.cpp:1032
void resizeEvent(QResizeEvent *event)
Handle the widget resize event.
Definition: cChromatogramWindowWidget.cpp:1354
void chromatogramWidgetDoubleClicked(int scanid)
A chromatographic peak was double clicked.
void updateRetentionTimeInterval(double mintime, double maxtime)
The signal is emitted when the range of retention time has been changed.
void exportToSVG(QString filename)
Export spectrum scene into a SVG file.
Definition: cChromatogramWindowWidget.cpp:1063
void recalculateTICChromatogram(int activefileid)
Recalculate TIC chromatogram.
Definition: cChromatogramWindowWidget.cpp:1103
~cChromatogramWindowWidget()
The destructor.
Definition: cChromatogramWindowWidget.cpp:1027
void exportToPNG(QString filename)
Export spectrum scene into a PNG file.
Definition: cChromatogramWindowWidget.cpp:1084
cChromatogramWindowWidget(cTheoreticalSpectrumList &listoftheoreticalspectra, QWidget *parent=0)
The constructor.
Definition: cChromatogramWindowWidget.cpp:969
void mouseReleaseEvent(QMouseEvent *event)
Handle the mouse release event.
Definition: cChromatogramWindowWidget.cpp:1249
The class representing a peak list.
Definition: cPeaksList.h:68
The class representing lists of theoretical spectra.
Definition: cTheoreticalSpectrumList.h:25
Auxiliary funtions and structures.