QtiPlot  0.9.8.2
LineProfileTool.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : LineProfileTool.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke
6  Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
7  Description : Plot tool for calculating intensity profiles of
8  image markers.
9 
10  ***************************************************************************/
11 
12 /***************************************************************************
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation; either version 2 of the License, or *
17  * (at your option) any later version. *
18  * *
19  * This program is distributed in the hope that it will be useful, *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22  * GNU General Public License for more details. *
23  * *
24  * You should have received a copy of the GNU General Public License *
25  * along with this program; if not, write to the Free Software *
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
27  * Boston, MA 02110-1301 USA *
28  * *
29  ***************************************************************************/
30 #ifndef LINE_PROFILE_TOOL_H
31 #define LINE_PROFILE_TOOL_H
32 
33 #include "PlotToolInterface.h"
34 
35 #include <QWidget>
36 
37 class QPoint;
38 class QImage;
39 class ImageWidget;
40 class ApplicationWindow;
41 
61 class LineProfileTool : public QWidget, public PlotToolInterface
62 {
63  Q_OBJECT
64 
65  public:
67  LineProfileTool(Graph *graph, ApplicationWindow *app, int average_pixels);
68  void calculateLineProfile(const QPoint &start, const QPoint &end);
69 
70  virtual int rtti() const {return PlotToolInterface::Rtti_LineProfileTool;};
71 
72  signals:
77  void statusText(const QString&);
78 
79  protected:
80  double averageImagePixel(const QImage &image, int px, int py, bool moreHorizontal);
83  virtual void paintEvent(QPaintEvent *e);
88  virtual void mousePressEvent(QMouseEvent *e);
91  virtual void mouseMoveEvent(QMouseEvent *e);
94  virtual void mouseReleaseEvent(QMouseEvent *e);
95 
96  private:
104  QPoint d_op_start;
106  QPoint d_op_dp;
107 };
108 
109 #endif // ifndef LINE_PROFILE_TOOL_H
110 
virtual void mouseMoveEvent(QMouseEvent *e)
Mouse movements need to be monitored for updating the line during operation.
Definition: LineProfileTool.cpp:191
ImageWidget * d_target
The image to operate on.
Definition: LineProfileTool.h:101
LineProfileTool(Graph *graph, ApplicationWindow *app, int average_pixels)
Standard constructor.
Definition: LineProfileTool.cpp:42
A 2D-plotting widget.
Definition: Graph.h:123
virtual void paintEvent(QPaintEvent *e)
Draw line during operation.
Definition: LineProfileTool.cpp:176
double averageImagePixel(const QImage &image, int px, int py, bool moreHorizontal)
Definition: LineProfileTool.cpp:155
ApplicationWindow * d_app
Definition: LineProfileTool.h:97
void statusText(const QString &)
int d_average_pixels
Number of image pixels over which to average.
Definition: LineProfileTool.h:99
Definition: ImageWidget.h:37
QtiPlot's main window.
Definition: ApplicationWindow.h:133
Plot tool for calculating intensity profiles of image markers along a line.
Definition: LineProfileTool.h:61
void calculateLineProfile(const QPoint &start, const QPoint &end)
Definition: LineProfileTool.cpp:65
virtual void mouseReleaseEvent(QMouseEvent *e)
Mouse releases end line selection and cause the profile to be displayed.
Definition: LineProfileTool.cpp:205
Definition: PlotToolInterface.h:60
Definition: PlotToolInterface.h:72
QPoint d_op_dp
Difference between current and start position during operation.
Definition: LineProfileTool.h:106
QPoint d_op_start
Mouse position where an operation started.
Definition: LineProfileTool.h:104
virtual int rtti() const
Definition: LineProfileTool.h:70
virtual void mousePressEvent(QMouseEvent *e)
Pressing the left mouse button starts line selection.
Definition: LineProfileTool.cpp:183