00001 /*! @file Qt/ImageCanvas.h widget for deling with images */ 00002 00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Qt/ImageCanvas.h $ 00004 // $Id: ImageCanvas.h 12962 2010-03-06 02:13:53Z irock $ 00005 00006 00007 #ifndef IMAGECANVAS 00008 #define IMAGECANVAS 00009 00010 #include <qwidget.h> 00011 #include <qmainwindow.h> 00012 #include <qpen.h> 00013 #include <qpoint.h> 00014 #include <qpixmap.h> 00015 #include <qstring.h> 00016 #include <qpointarray.h> 00017 #include <qlabel.h> 00018 #include <qlayout.h> 00019 #include "Image/Image.H" 00020 #include "Image/Pixels.H" 00021 #include "QtUtil/ImageConvert.H" 00022 #include <qpopupmenu.h> 00023 00024 class QMouseEvent; 00025 00026 class ImageCanvas : public QWidget 00027 { 00028 Q_OBJECT 00029 public: 00030 ImageCanvas(QWidget *parent = 0, const char *name = 0 ); 00031 ~ImageCanvas(); 00032 //int getWidth(); 00033 //int getHeight(); 00034 std::vector<Point2D<int> > itsPointsClicked; 00035 signals: 00036 void mousePressed(int x, int y, int button); 00037 00038 public slots: 00039 void paintEvent(QPaintEvent*); 00040 //! Convert the image to QPixmap and display 00041 void setImage(Image<PixRGB<byte> > &img); 00042 //! Convert the image to QPixmap and display 00043 void setImage(Image<float> &img); 00044 void saveImg(); 00045 00046 Image<PixRGB<byte> > getImage(); 00047 00048 00049 protected: 00050 //! Respond to mouse events 00051 void mousePressEvent( QMouseEvent *e ); 00052 00053 private: 00054 // QLabel *itsQLabel; 00055 Image<PixRGB<byte> > itsImgByte; 00056 Image<float> itsImgFloat; 00057 00058 00059 // Used to store the objects placed on ImageCanvas 00060 //vector<Image<PixRGB<byte> > > itsObjects; 00061 00062 }; 00063 00064 #endif