00001 /*************************************************************************** 00002 File : LineProfileTool.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006,2007 by Ion Vasilief, 00006 Tilman Hoener zu Siederdissen, Knut Franke 00007 Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net, 00008 knut.franke*gmx.de 00009 Description : Plot tool for calculating intensity profiles of 00010 image markers. 00011 00012 ***************************************************************************/ 00013 00014 /*************************************************************************** 00015 * * 00016 * This program is free software; you can redistribute it and/or modify * 00017 * it under the terms of the GNU General Public License as published by * 00018 * the Free Software Foundation; either version 2 of the License, or * 00019 * (at your option) any later version. * 00020 * * 00021 * This program is distributed in the hope that it will be useful, * 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00024 * GNU General Public License for more details. * 00025 * * 00026 * You should have received a copy of the GNU General Public License * 00027 * along with this program; if not, write to the Free Software * 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00029 * Boston, MA 02110-1301 USA * 00030 * * 00031 ***************************************************************************/ 00032 #ifndef LINE_PROFILE_TOOL_H 00033 #define LINE_PROFILE_TOOL_H 00034 00035 #include "PlotToolInterface.h" 00036 00037 #include <QWidget> 00038 00039 class QPoint; 00040 class QImage; 00041 class ImageMarker; 00042 00062 class LineProfileTool : public QWidget, public PlotToolInterface 00063 { 00064 Q_OBJECT 00065 00066 public: 00068 LineProfileTool(Graph *graph, int average_pixels); 00069 void calculateLineProfile(const QPoint &start, const QPoint &end); 00070 00071 signals: 00076 void statusText(const QString&); 00077 void createTablePlot(const QString& caption, int r, int c, const QString& content); 00078 00079 protected: 00080 int averageImagePixel(const QImage &image, int px, int py, bool moreHorizontal); 00081 void addLineMarker(const QPoint &start, const QPoint &end); 00084 virtual void paintEvent(QPaintEvent *e); 00089 virtual void mousePressEvent(QMouseEvent *e); 00092 virtual void mouseMoveEvent(QMouseEvent *e); 00095 virtual void mouseReleaseEvent(QMouseEvent *e); 00096 00097 private: 00099 int d_average_pixels; 00101 ImageMarker *d_target; 00104 QPoint d_op_start; 00106 QPoint d_op_dp; 00107 }; 00108 00109 #endif // ifndef LINE_PROFILE_TOOL_H 00110