00001 00014 #ifndef CLASSIFICATION_WINDOW_GZ6WWOJ1 00015 #define CLASSIFICATION_WINDOW_GZ6WWOJ1 00016 00017 #include <QtGui/QMainWindow> 00018 #include <sensor_msgs/Image.h> 00019 00020 #include <color_table/common.h> 00021 #include "ui_classification_window.h" 00022 00023 namespace color_table { 00024 00025 typedef Rgb RgbImage[IMAGE_HEIGHT][IMAGE_WIDTH]; 00026 typedef uint8_t SegImage[IMAGE_HEIGHT][IMAGE_WIDTH]; 00027 00028 enum Image { 00029 RGB, 00030 SEG 00031 }; 00032 00033 enum ClickMode { 00034 ADD, 00035 DELETE 00036 }; 00037 00043 class ClassificationWindow : public QMainWindow { 00044 Q_OBJECT 00045 00046 public: 00047 00048 ClassificationWindow(QWidget *parent = 0); 00049 00053 void changeImage(sensor_msgs::ImageConstPtr image); 00054 00058 void drawRgbImage(ImageWidget *widget); 00059 00063 void drawSegImage(ImageWidget *widget); 00064 00069 void segmentImage(bool useTempColorTable); 00070 00074 void redrawImages(bool useTempColorTable = false); 00075 00079 void setColor(int color); 00080 00084 void updateStatus(); 00085 00090 bool openColorTable(); 00091 00095 void openDefaultColorTable(); 00096 00101 void loadDataDirectory(std::string basePath); 00102 00107 void closeEvent(QCloseEvent *event); 00108 00109 public slots: 00110 void on_bigImage_clicked(int x, int y, int button); 00111 void on_bigImage_mouseXY(int x, int y); 00112 void on_rawImage_clicked(int x, int y, int button); 00113 void on_segImage_clicked(int x, int y, int button); 00114 00115 void on_addRadio_clicked(); 00116 void on_deleteRadio_clicked(); 00117 00118 void on_orangeButton_clicked(); 00119 void on_pinkButton_clicked(); 00120 void on_blueButton_clicked(); 00121 void on_greenButton_clicked(); 00122 void on_whiteButton_clicked(); 00123 void on_yellowButton_clicked(); 00124 00125 void on_colorCombo_currentIndexChanged(int index); 00126 00127 void on_actionNew_triggered(); 00128 void on_actionOpen_triggered(); 00129 void on_actionSave_triggered(); 00130 void on_actionSave_As_triggered(); 00131 00132 private: 00133 Ui::ClassificationWindow ui; 00134 std::string colorTableFilename; 00135 std::string dataDirectory; 00136 00137 RgbImage rgbImage; 00138 SegImage segImage; 00139 ColorTable colorTable; 00140 ColorTable tempColorTable; 00141 00142 QRgb segColors[NUM_COLORS]; 00143 std::string segColorNames[NUM_COLORS]; 00144 00145 Image imageSelected; 00146 ClickMode clickMode; 00147 Color currentColor; 00148 00149 }; 00150 00151 } 00152 00153 #endif /* end of include guard: CLASSIFICATION_WINDOW_GZ6WWOJ1 */