libeblearngui
/home/rex/ebltrunk/tools/libeblearngui/include/old_ebm_gui.h
00001 #ifndef EBM_GUI_H
00002 #define EBM_GUI_H
00003 
00004 #include <QtGui>
00005 #include <qpixmap.h>
00006 #include <QResizeEvent>
00007 #include <math.h>
00008 
00009 #include "libeblearn.h"
00010 
00011 #include "ui_ebbox.h"
00012 
00013 using namespace std;
00014 using namespace ebl;
00015 
00016 
00023 class ebbox : public QGroupBox
00024 {
00025         Q_OBJECT
00026 
00027 public:
00035         ebbox(QWidget *parent = 0, const char* title = NULL, QDialog *prop =  NULL, QWidget *vis = NULL, QMutex* argmutex = NULL);
00036         ~ebbox();
00037 
00038         /* *
00039          * add a widget in a container usually used for display
00040          * -> enables to make "multilayer" widget
00041          * */
00042         void add_box(ebbox *ajout);
00043 
00044         Ui::Ebbox ui;
00045         QDialog *properties;
00046         QWidget *visible;
00047 
00048         /* *
00049          * @param open is used to know if the display panel is open
00050          * this is due to a limitation in the slot/signal system of Qt
00051          *  */
00052         bool open;
00053 
00054 public slots:
00056         virtual void openProperties();
00058         void resize();
00060         virtual void print();
00062         virtual void refreshform(bool propup = false);
00063 
00064 public:
00067         QWidget* mainwidget;
00068 
00069 protected:
00071         vector<ebbox*> added_widgets;
00073         QMutex* mutex;
00074 };
00075 
00076 
00077 /******************************************************
00078 * ////////////////////////////////////////////////////////////////////////////////////////////
00079 * The next following classes handle the properties, the display
00080 * and the main widget of the idx gui
00081 * ////////////////////////////////////////////////////////////////////////////////////////////
00082 *****************************************************/
00083 
00084 /* *
00085  * these are the different types of idxs supported.
00086  * it has been created to "templatize" the display of the idxs,
00087  * because Qt does not allow templates of Q_OBJECTs
00088  * */
00089 enum idx_type { DOUBLE, FLOAT, INTG, UBYTE };
00090 
00092 struct idx_plotdata
00093 {
00094         double zoom, min, max;
00095         bool norm;
00096         double min_norm, max_norm;
00097         bool visible;
00099         bool idx1_as_array, idx3_as_RGB;
00100 };
00101 
00103 struct idx_printdata
00104 {
00105         bool pretty, elems, onfile;
00107         QString file;
00108 };
00109 
00110 void initialize_data(idx_plotdata*, idx_printdata*, void* , idx_type);
00111 
00112 /*********************************************
00113 * Idx gui  properties dialog window
00114 *********************************************/
00115 
00116 class idx_propgui : public QDialog
00117 {
00118         Q_OBJECT
00119 
00120 private:
00121         QDoubleSpinBox* zoombox;
00122 
00123         QRadioButton* arraybutton;
00124         QRadioButton* rgbbutton;
00125 
00126         QDoubleSpinBox* minbox;
00127         QDoubleSpinBox* maxbox;
00128         QLabel* max_normval;
00129         QLabel* min_normval;
00130         QCheckBox* visiblecheck;
00131         QCheckBox* normalcheck;
00132 
00133         QCheckBox* pretty;
00134         QCheckBox* elems;
00135         QCheckBox* print_onfile;
00136         QLineEdit* fileedit;
00137 
00138 public:
00139         QPushButton* okbutton;
00140         QPushButton* cancelbutton;
00141 
00142 public:
00143         idx_propgui(QWidget* parent, int order);
00144         ~idx_propgui(){};
00145 
00148         void set_data(idx_plotdata* plotdata, idx_printdata* printdata);
00149 
00150 public slots:
00152         void get_data( idx_plotdata* plotdata, idx_printdata* printdata);
00154         void choose_file();
00155 
00156 };
00157 
00158 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
00159  * Idx gui displaying widget related function
00160  * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00161 
00162 class idx_displayGui : public QWidget
00163 {
00164         Q_OBJECT
00165 
00166 public:
00167         /* *
00168         *  display contains the pointers to the QLabels in which the different layers of the idx will be displayed
00169         * */
00170         vector<QLabel*> display;
00171         QScrollArea* scroll;
00172         QWidget* displayer;
00173         QHBoxLayout* hlayout;
00174 
00175         idx_displayGui(QWidget* parent, int NofDisplay = 1, const char* title = "Idx");
00176         ~idx_displayGui(){};
00177 
00180         void displayAll(void* idx, idx_type type, idx_plotdata* plotdata);
00181 
00182 private:
00183         /* *
00184          * display into the @param container the @param indexofLayer -th layer of the Idx @param matrix idx of the @param type idx_type,
00185          * normalizing between @param vmin and @param vmax, and sizing it with @param zoom
00186          * @param idx1_as_array : if true, the Idx1 is displayed as an array (1pixel-high), if not it is displayed as a plot
00187          * @param id3_as_rgb: if true, the layers are grouped by 3 and displayed as RGB
00188          * */
00189         static void displaymatrixlayer(QLabel* container, void* matrix, idx_type type, int indexofLayer = 0, double vmin = -1, double vmax = 1, double zoom = 1, bool idx1_as_array = false, bool idx3_as_rgb = false);
00190 };
00191 
00192 /* * * * * * * * * * * * * * * * * * * * * * * * * * *
00193  *  idx gui related function
00194  * * * * * * * * * * * * * * * * * * * * * * * * * * */
00195 
00196 class Idx_Gui : public ebbox
00197 {
00198         Q_OBJECT
00199 
00200 private:
00201         idx_plotdata plotdata;
00202         idx_printdata printdata;
00203 
00204         /* *
00205          * an Idx is memorized as a void* pointer to the idx and an idx_type to know how to cast it properly when needed (display)
00206          * this is to templatize the idx_gui
00207          * */
00208         idx_type type;
00209         void* idx;
00210 
00211         /* *
00212          * @param fromproperties is used to know if we refresh the display from
00213          * the properties dialog (so we have to update the plotting datas) or from
00214          * the keyboard shortcuts (the plotting datas are already changed)
00215          * anyway as a user you don't have to use it
00216          * */
00217         bool fromproperties;
00218 
00220         void openProperties();
00221 
00222         QString checkproperties(QString s);
00223 
00224 public slots:
00225         /* *
00226          * checks various display settings, triggers a warning if it seems weird,
00227          *  and calls the displayAll() function of the display widget
00228          * */
00229         void refreshdisplay();
00230 
00232         void print();
00233 
00234         /* *
00235          * handles the keyboard event. So far:
00236          * = (equals) -> zoom in
00237          * - (minus) -> zoom out
00238          * p -> print
00239          * q -> close
00240          * */
00241         void keyPressEvent( QKeyEvent* event);
00242 
00243 public:
00244         Idx_Gui(void* idxarg, idx_type argtype, const char* title = "idx", QWidget *parent = 0, QMutex* mutex = NULL);
00245         ~Idx_Gui(){};
00246 
00248         void setvmin(double min);
00250         void setvmax(double max);
00252         void setvisible(bool visible);
00254         void setidx1_as_array(bool array);
00256         void setidx3_as_RGB(bool rgb);
00257 };
00258 
00259 /******************************************************
00260 * ////////////////////////////////////////////////////////////////////////////////////////////
00261 * The next following classes handle the properties, the display
00262 * and the main widget of the state_idx gui
00263 * ////////////////////////////////////////////////////////////////////////////////////////////
00264 *****************************************************/
00265 
00267 struct state_idx_data
00268 {
00269         idx_plotdata x_plotdata, dx_plotdata, ddx_plotdata;
00270         idx_printdata x_printdata, dx_printdata, ddx_printdata;
00271 };
00272 
00273 /*********************************************
00274 * state_Idx gui  properties dialog window
00275 *********************************************/
00276 
00277 class state_idx_propgui : public QDialog
00278 {
00279         Q_OBJECT
00280 
00281 private:
00282         QDoubleSpinBox* zoombox;
00283 
00284         QRadioButton* arraybutton;
00285         QRadioButton* rgbbutton;
00286 
00287         QDoubleSpinBox* X_minbox;
00288         QDoubleSpinBox* X_maxbox;
00289         QLabel* X_minnorm;
00290         QLabel* X_maxnorm;
00291         QDoubleSpinBox* DX_minbox;
00292         QDoubleSpinBox* DX_maxbox;
00293         QLabel* DX_minnorm;
00294         QLabel* DX_maxnorm;
00295         QDoubleSpinBox* DDX_minbox;
00296         QDoubleSpinBox* DDX_maxbox;
00297         QLabel* DDX_minnorm;
00298         QLabel* DDX_maxnorm;
00299 
00300         QCheckBox* X_visiblecheck;
00301         QCheckBox* X_normalcheck;
00302         QCheckBox* DX_visiblecheck;
00303         QCheckBox* DX_normalcheck;
00304         QCheckBox* DDX_visiblecheck;
00305         QCheckBox* DDX_normalcheck;
00306 
00307         QCheckBox* X_pretty;
00308         QCheckBox* X_elems;
00309         QCheckBox* DX_pretty;
00310         QCheckBox* DX_elems;
00311         QCheckBox* DDX_pretty;
00312         QCheckBox* DDX_elems;
00313         QCheckBox* print_onfile;
00314         QLineEdit* fileedit;
00315 
00316 public:
00317         QPushButton* okbutton;
00318         QPushButton* cancelbutton;
00319 
00320 public:
00321         state_idx_propgui(QWidget* parent, int order);
00322         ~state_idx_propgui(){};
00323 
00325         // ! to the values of those in arguments
00326         void set_data(state_idx_data* data);
00327 
00328 
00329 public slots:
00331         void get_data( state_idx_data* data);
00333         void choose_file();
00334 
00335 };
00336 
00337 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
00338  * state_Idx gui displaying widget related function
00339  * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00340 
00341 class state_idx_displayGui : public QWidget
00342 {
00343         Q_OBJECT
00344 
00345 public:
00346 
00347         idx_displayGui* x_displayer;
00348         idx_displayGui* dx_displayer;
00349         idx_displayGui* ddx_displayer;
00350 
00351         state_idx_displayGui(QWidget* parent, int x_NofDisplay = 1);
00352         ~state_idx_displayGui(){};
00353 
00356         void displayAll(state_idx* state, state_idx_data* data);
00357 
00358 };
00359 
00360 
00361 /* * * * * * * * * * * * * * * * * * * * * * * * * * *
00362  *  state_idx gui related function
00363  * * * * * * * * * * * * * * * * * * * * * * * * * * */
00364 
00365 class state_Idx_Gui : public ebbox
00366 {
00367         Q_OBJECT
00368 
00369 private:
00370         state_idx_data data;
00371         state_idx* state;
00372 
00373         /* *
00374          * @param fromproperties is used to know if we refresh the display from
00375          * the properties dialog (so we have to update the plotting datas) or from
00376          * the keyboard shortcuts (the plotting datas are already changed)
00377          * anyway as a user you don't have to use it
00378          * */
00379         bool fromproperties;
00380 
00382         void openProperties();
00383 
00384 public slots:
00385         /* *
00386          * checks various display settings, triggers a warning if it seems weird,
00387          *  and calls the displayAll() function of the display widget
00388          * */
00389         void refreshdisplay();
00390 
00392         void print();
00393 
00394         /* *
00395          * handles the keyboard event. So far:
00396          * = (equals) -> zoom in
00397          * - (minus) -> zoom out
00398          * p -> print
00399          * q -> close
00400          * */
00401         void keyPressEvent( QKeyEvent* event);
00402 
00403 public:
00404         state_Idx_Gui(state_idx* stateIdx, const char* title = "state_idx", QWidget *parent = 0, QMutex* mutex = NULL);
00405         ~state_Idx_Gui(){};
00406 
00408         void setvmin(double xmin, double dxmin, double ddxmin);
00410         void setvmax(double xmax, double dxmax, double ddxmax);
00412         void setvisible(bool xvisible, bool dxvisible, bool ddxvisible);
00414         void setidx1_as_array(bool xarray, bool dxarray, bool ddxarray);
00416         void setidx3_as_RGB(bool xrgb, bool dxrgb, bool ddxrgb);
00417 };
00418 
00419 
00420 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00421  * ////////////////////////////////////////////////////////////////////////////////////////////
00422  * From this point, the next classes are specialized gui
00423  * designed for the corresponding ebm modules
00424  * ////////////////////////////////////////////////////////////////////////////////////////////
00425  *
00426  * All the constructors are doubled
00427  * The first version creates automatically state_idx_GUIs for
00428  * the state_idxs provided, and then creates the other GUIs
00429  * that are special to the module
00430  * The second only creates the later
00431 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00432 
00433 /* *
00434  * General module_1_1 GUI: use it for every module_1_1 that doesn't have any particular feature to display
00435  * Keep in my mind that this GUI library only displays things, you won't be able to launch any operation (for now at least)
00436  * this module is to be used for :
00437  *              the stdsigmoid_module
00438  *              the tanh_module
00439  * for the rest of the specialized module_1_1, use the specialized GUIs
00440  * */
00441 class module_1_1_GUI : public ebbox
00442 {
00443         Q_OBJECT
00444 
00445 private:
00446         state_idx* in;
00447         state_idx* out;
00448 
00449 public:
00450         module_1_1_GUI(state_idx* in, state_idx* out, const char* title = "module_1_1", QWidget *parent = 0, QMutex* mutex = NULL);
00451         module_1_1_GUI(const char* title = "module_1_1", QWidget *parent = 0, QMutex* mutex = NULL);
00452         ~module_1_1_GUI(){};
00453 };
00454 
00455 /* * * * * * * * * * * * * * * * * * * * * * *
00456  * GUI for module_2_1 (2 ins and 1 out)
00457  * * * * * * * * * * * * * * * * * * * * * * */
00458 class module_2_1_GUI : public ebbox
00459 {
00460         Q_OBJECT
00461 
00462 private:
00463         state_idx* in1;
00464         state_idx* in2;
00465         state_idx* out;
00466 
00467 public:
00468         module_2_1_GUI(state_idx* in1, state_idx* in2, state_idx* out, const char* title = "module_2_1", QWidget *parent = 0, QMutex* mutex = NULL);
00469         module_2_1_GUI(const char* title = "module_2_1", QWidget *parent = 0, QMutex* mutex = NULL);
00470         ~module_2_1_GUI(){};
00471 };
00472 
00473 /* * * * * * * * * * * * * * * * * * * * * * *
00474  * GUI for layers_2 (general architecture with one hidden layer)
00475  * The GUI automatically provides :
00476  *              a state_idx_GUI for the hidden layer
00477  *              2 module_1_1_GUI for the 2 modules
00478  * * * * * * * * * * * * * * * * * * * * * * */
00479 class layers_2_GUI : public ebbox
00480 {
00481         Q_OBJECT
00482 
00483 private:
00484         layers_2<state_idx, state_idx, state_idx>* layer2;
00485         state_idx* in;
00486         state_idx* out;
00487 
00488 public:
00489         layers_2_GUI(layers_2<state_idx, state_idx, state_idx>* layer2, state_idx* in, state_idx* out, const char* title = "layers_2 <state_idx, state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00490         layers_2_GUI(layers_2<state_idx, state_idx, state_idx>* layer2, const char* title = "layers_2 <state_idx, state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00491         ~layers_2_GUI(){};
00492 };
00493 
00494 /* * * * * * * * * * * * * * * * * * * * * * *
00495  * GUI for fc_ebm1 (1 in EBM)
00496  * The GUI automatically provides :
00497  *              a state_idx_GUI for the out calculated by the function
00498  *              2 module_1_1_GUI for the 2 modules
00499  * * * * * * * * * * * * * * * * * * * * * * */
00500 class fc_ebm1_GUI : public ebbox
00501 {
00502         Q_OBJECT
00503 
00504 private:
00505         fc_ebm1<state_idx, state_idx>* ebm1;
00506         state_idx* in;
00507         state_idx* energy;
00508 
00509 public:
00510         fc_ebm1_GUI(fc_ebm1<state_idx, state_idx>* ebm1, state_idx* in, state_idx* energy, const char* title = "fc_ebm1<state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00511         fc_ebm1_GUI(fc_ebm1<state_idx, state_idx>* ebm1, const char* title = "fc_ebm1<state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00512         ~fc_ebm1_GUI(){};
00513 };
00514 
00515 /* * * * * * * * * * * * * * * * * * * * * * *
00516  * GUI for fc_ebm2 (2 ins EBM)
00517  * The GUI automatically provides :
00518  *              a state_idx_GUI for the out calculated by the function
00519  *              2 module_1_1_GUI for the 2 modules
00520  * * * * * * * * * * * * * * * * * * * * * * */
00521 class fc_ebm2_GUI : public ebbox
00522 {
00523         Q_OBJECT
00524 
00525 private:
00526         fc_ebm2<state_idx, state_idx, state_idx>* ebm2;
00527         state_idx* in1;
00528         state_idx* in2;
00529         state_idx* energy;
00530 
00531 public:
00532         fc_ebm2_GUI(fc_ebm2<state_idx, state_idx, state_idx>* ebm2, state_idx* in1, state_idx* in2, state_idx* energy, const char* title = "fc_ebm2<state_idx, state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00533         fc_ebm2_GUI(fc_ebm2<state_idx, state_idx, state_idx>* ebm2, const char* title = "fc_ebm2<state_idx, state_idx, state_idx>", QWidget *parent = 0, QMutex* mutex = NULL);
00534         ~fc_ebm2_GUI(){};
00535 };
00536 
00537 /* * * * * * * * * * * * * * * * * * * * * * *
00538  * GUI for linear modules
00539  * The GUI automatically provides a state_idx_GUI for the weights
00540  * * * * * * * * * * * * * * * * * * * * * * */
00541 class linear_module_GUI : public module_1_1_GUI
00542 {
00543         Q_OBJECT
00544 
00545 private:
00546         linear_module* module;
00547 
00548 public:
00549         linear_module_GUI(linear_module* module, state_idx *in, state_idx *out, const char* title = "linear module", QWidget *parent = 0, QMutex* mutex = NULL);
00550         linear_module_GUI(linear_module* module, const char* title = "linear module", QWidget *parent = 0, QMutex* mutex = NULL);
00551         ~linear_module_GUI(){};
00552 };
00553 
00554 /* * * * * * * * * * * * * * * * * * * * * * *
00555  * GUI for full_layer (fully-connected neural net layer: linear + tanh non-linearity)
00556  * The GUI automatically provides:
00557  *              a linear_module_GUI
00558  *              Two state_idx_GUI for the bias and the sum state_idxs
00559  *              a module_1_1_GUI for the tan_h module
00560  * * * * * * * * * * * * * * * * * * * * * * */
00561 class full_layer_GUI : public module_1_1_GUI
00562 {
00563         Q_OBJECT
00564 
00565 private:
00566         full_layer* layer;
00567 
00568 public:
00569         full_layer_GUI(full_layer* layer, state_idx *in, state_idx *out, const char* title = "full_layer", QWidget *parent = 0, QMutex* mutex = NULL);
00570         full_layer_GUI(full_layer* layer, const char* title = "full_layer", QWidget *parent = 0, QMutex* mutex = NULL);
00571         ~full_layer_GUI(){};
00572 };
00573 
00574 /* * * * * * * * * * * * * * * * * * * * * * *
00575  * GUI for f_layerl (full connection between replicable 3D layers)
00576  * The GUI automatically provides:
00577  *              Three state_idx_GUI for the weights, bias and sum state_idxs
00578  *              a module_1_1_GUI for the squash function
00579  * * * * * * * * * * * * * * * * * * * * * * */
00580 class f_layer_GUI : public module_1_1_GUI
00581 {
00582         Q_OBJECT
00583 
00584 private:
00585         f_layer* layer;
00586 
00587 public:
00588         f_layer_GUI(f_layer* layer, state_idx *in, state_idx *out, const char* title = "f_layer", const char* squash_title = "squash", QWidget *parent = 0, QMutex* mutex = NULL);
00589         f_layer_GUI(f_layer* layer, const char* title = "f_layer", const char* squash_title = "squash", QWidget *parent = 0, QMutex* mutex = NULL);
00590         ~f_layer_GUI(){};
00591 };
00592 
00593 /* * * * * * * * * * * * * * * * * * * * * * *
00594  * GUI for c_layer (convolutional layer module)
00595  * The GUI automatically provides:
00596  *              an Idx_GUI for the table
00597  *              Three state_idx_GUI for the kernel, bias and sum state_idxs
00598  *              a module_1_1_GUI for the squash function
00599  * * * * * * * * * * * * * * * * * * * * * * */
00600 class c_layer_GUI : public module_1_1_GUI
00601 {
00602         Q_OBJECT
00603 
00604 private:
00605         c_layer* layer;
00606 
00607 public:
00608         c_layer_GUI(c_layer* layer, state_idx *in, state_idx *out, const char* title = "c_layer", const char* squash_title = "squash function", QWidget *parent = 0, QMutex* mutex = NULL);
00609         c_layer_GUI(c_layer* layer, const char* title = "c_layer", const char* squash_title = "squash", QWidget *parent = 0, QMutex* mutex = NULL);
00610         ~c_layer_GUI(){};
00611 };
00612 
00613 /* * * * * * * * * * * * * * * * * * * * * * *
00614  * GUI for s_layer (subsampling layer class)
00615  * The GUI automatically provides:
00616  *              4 state_idx_GUI for the coeff, bias sub and sum state_idxs
00617  *              a module_1_1_GUI for the squash function
00618  * * * * * * * * * * * * * * * * * * * * * * */
00619 class s_layer_GUI : public module_1_1_GUI
00620 {
00621         Q_OBJECT
00622 
00623 private:
00624         s_layer* layer;
00625 
00626 public:
00627         s_layer_GUI(s_layer* layer, state_idx *in, state_idx *out, const char* title = "s_layer", const char* squash_title = "squash function", QWidget *parent = 0, QMutex* mutex = NULL);
00628         s_layer_GUI(s_layer* layer, const char* title = "s_layer", const char* squash_title = "squash", QWidget *parent = 0, QMutex* mutex = NULL);
00629         ~s_layer_GUI(){};
00630 };
00631 
00632 /* * * * * * * * * * * * * * * * * * * * * * *
00633  * GUI for logadd_layer (log-add over spatial dimensions of an idx3-state
00634  * The GUI automatically provides 2 Idx_GUIs for the expdist and sumexp Idxs
00635  * * * * * * * * * * * * * * * * * * * * * * */
00636 class logadd_layer_GUI : public module_1_1_GUI
00637 {
00638         Q_OBJECT
00639 
00640 private:
00641         logadd_layer* layer;
00642 
00643 public:
00644         logadd_layer_GUI(logadd_layer* layer, state_idx *in, state_idx *out, const char* title = "logadd_layer", QWidget *parent = 0, QMutex* mutex = NULL);
00645         logadd_layer_GUI(logadd_layer* layer, const char* title = "logadd_layer", QWidget *parent = 0, QMutex* mutex = NULL);
00646         ~logadd_layer_GUI(){};
00647 };
00648 
00649 /* * * * * * * * * * * * * * * * * * * * * * *
00650  * GUI for edist_cost (replicable Euclidean distance cost function.)
00651  * The GUI automatically provides :
00652  *              a logadd_layer_GUI
00653  *              two state_idx_GUI for the distance and loggaded distance
00654  *              1 Idx_GUI for the proto
00655  * * * * * * * * * * * * * * * * * * * * * * */
00656 class edist_cost_GUI : public module_1_1_GUI
00657 {
00658         Q_OBJECT
00659 
00660 private:
00661         edist_cost* edist;
00662 
00663 public:
00664         edist_cost_GUI(edist_cost* edist, state_idx *in, state_idx *energy, const char* title = "edist_cost", QWidget *parent = 0, QMutex* mutex = NULL);
00665         edist_cost_GUI(edist_cost* edist, const char* title = "edist_cost", QWidget *parent = 0, QMutex* mutex = NULL);
00666         ~edist_cost_GUI(){};
00667 };
00668 
00669 
00670 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00671  *  ebwindow is a simple "whiteboard" on which you can display
00672  * idxs with gray_draw_matrix and RGB_draw_matrix
00673  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00674 class ebwindow : public QWidget
00675 {
00676         Q_OBJECT
00677 
00678 private:
00679         QPixmap* mydisplay;
00680         QLabel* mylabel;
00681         QPainter* painter;
00682 
00683         void resizeEvent (QResizeEvent *event);
00684 
00685 
00686 public:
00687         /* *
00688          * Be careful to create a whiteboard big enough for your pictures, since you won't be able
00689          * to make it bigger after (ie resizing the window will scale the content, you won't have more space to draw on)
00690          * */
00691         ebwindow(int height = 500, int width = 500);
00692 
00693         /* *
00694          * gray_draw_matrix displays your idx2 or the first layer of your idx3 in grayscale on the whiteboard.
00695          * This function does a copy of your idx and won't change in in any way !
00696          * @param idx and @param type are, like before, used to templatize the function
00697          * @param x and @param y are the coordinates of the top-left corner of your picture on the whiteboard
00698          * @param minv and @param maxv are the min and max values to set colors. If left to zero, the min of
00699          *                      your idx will be set to 0 and the max will be 255
00700          * @param zoomx and @param zoomy are the zoom factors in width and height
00701          * @param mutex is used if you want to protect your idx (multi-thread)
00702          * */
00703         void gray_draw_matrix(void* idx, idx_type type, int x = 0, int y = 0, int minv = 0, int maxv = 0, int zoomx = 1, int zoomy = 1, QMutex* mutex = NULL);
00704 
00705         /* *
00706          * RGB_draw_matrix displays the 3 firsts layers of your idx3 as a RGB picture on the whiteboard.
00707          * Attention : it won't change the values in your idx, so if you want a good display, you have to make it
00708          *                      an idx3 with values between 0 and 255 !!
00709          * This function does a copy of your idx and won't change in in any way !
00710          * @param idx and @param type are, like before, used to templatize the function
00711          * @param x and @param y are the coordinates of the top-left corner of your picture on the whiteboard
00712          * @param zoomx and @param zoomy are the zoom factors in width and height
00713          * @param mutex is used if you want to protect your idx (multi-thread)
00714          * */
00715         void RGB_draw_matrix(void* idx, idx_type type, int x = 0, int y = 0, int zoomx = 1, int zoomy = 1, QMutex* mutex = NULL);
00716 };
00717 
00718 #endif // EBM_GUI_H
00719