⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ebm_gui.h

📁 Gaussian Mixture Algorithm
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef EBM_GUI_H#define EBM_GUI_H#include <QtGui>#include <qpixmap.h>#include <QResizeEvent>#include <math.h>#include "libeblearn.h"#include "ui_ebbox.h"using namespace std;using namespace ebl;/*** ebbox is a general container. It can be used either as a* base class for the specialized 1-layer modules, or as a* container for multilayer modules**/class ebbox : public QGroupBox{	Q_OBJECTpublic:	/**	 * The main constructor	 * @param parent is not needed, leave it to 0	 * @param prop is a pointer to the parameters dialog associated with the module	 * @param vis is a pointer to the display widget	 * @param argmutex is the mutex used to protect the idxs and other structures (derived classes) in multi-thread applications	 * */	ebbox(QWidget *parent = 0, const char* title = NULL, QDialog *prop =  NULL, QWidget *vis = NULL, QMutex* argmutex = NULL);	~ebbox();	/* *	 * add a widget in a container usually used for display	 * -> enables to make "multilayer" widget	 * */	void add_box(ebbox *ajout);	Ui::Ebbox ui;	QDialog *properties;	QWidget *visible;	/* *	 * @param open is used to know if the display panel is open	 * this is due to a limitation in the slot/signal system of Qt	 *  */	bool open;public slots:	//! open the properties widget "properties"	virtual void openProperties();	//! open and close the display widget "visible" by making it (in)visible and resizing the widget	void resize();	//! prints	virtual void print();	//! refresh the display and tells all the widgets added to do the same	virtual void refreshform(bool propup = false);public:	//! not used actually but may be used in the future	//! it is a pointer to the main widget wich could be used to send a resize() signal	QWidget* mainwidget;protected:	//! this vector is used to transmit the refreshdisplay() signal to the widgets added	vector<ebbox*> added_widgets;	//! see constructor	QMutex* mutex;};/******************************************************* ////////////////////////////////////////////////////////////////////////////////////////////* The next following classes handle the properties, the display* and the main widget of the idx gui* ////////////////////////////////////////////////////////////////////////////////////////////*****************************************************//* * * these are the different types of idxs supported. * it has been created to "templatize" the display of the idxs, * because Qt does not allow templates of Q_OBJECTs * */enum idx_type { DOUBLE, FLOAT, INTG, UBYTE };//! structure for the display optionsstruct idx_plotdata{	double zoom, min, max;	bool norm;	double min_norm, max_norm;	bool visible;	//! special options	bool idx1_as_array, idx3_as_RGB;};//! structure for the printing settingsstruct idx_printdata{	bool pretty, elems, onfile;	//! file is the path to the file to print on	QString file;};void initialize_data(idx_plotdata*, idx_printdata*, void* , idx_type);/********************************************** Idx gui  properties dialog window*********************************************/class idx_propgui : public QDialog{	Q_OBJECTprivate:	QDoubleSpinBox* zoombox;	QRadioButton* arraybutton;	QRadioButton* rgbbutton;	QDoubleSpinBox* minbox;	QDoubleSpinBox* maxbox;	QLabel* max_normval;	QLabel* min_normval;	QCheckBox* visiblecheck;	QCheckBox* normalcheck;	QCheckBox* pretty;	QCheckBox* elems;	QCheckBox* print_onfile;	QLineEdit* fileedit;public:	QPushButton* okbutton;	QPushButton* cancelbutton;public:	idx_propgui(QWidget* parent, int order);	~idx_propgui(){};	//! puts the values of the different boxes of the dialog	//! to the values of those in arguments	void set_data(idx_plotdata* plotdata, idx_printdata* printdata);public slots:	//! puts the value of the arguments to those of the different boxes of the dialog	void get_data( idx_plotdata* plotdata, idx_printdata* printdata);	//! opens a dialog to choose wich file you want to print on	void choose_file();};/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * Idx gui displaying widget related function * * * * * * * * * * * * * * * * * * * * * * * * * * * */class idx_displayGui : public QWidget{	Q_OBJECTpublic:	/* *	*  display contains the pointers to the QLabels in which the different layers of the idx will be displayed	* */	vector<QLabel*> display;	QScrollArea* scroll;	QWidget* displayer;	QHBoxLayout* hlayout;	idx_displayGui(QWidget* parent, int NofDisplay = 1, const char* title = "Idx");	~idx_displayGui(){};	//! handles the display of all the layers into the different QLabels	//! according to the display options and settings	void displayAll(void* idx, idx_type type, idx_plotdata* plotdata);private:	/* *	 * display into the @param container the @param indexofLayer -th layer of the Idx @param matrix idx of the @param type idx_type,	 * normalizing between @param vmin and @param vmax, and sizing it with @param zoom	 * @param idx1_as_array : if true, the Idx1 is displayed as an array (1pixel-high), if not it is displayed as a plot	 * @param id3_as_rgb: if true, the layers are grouped by 3 and displayed as RGB	 * */	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);};/* * * * * * * * * * * * * * * * * * * * * * * * * * * *  idx gui related function * * * * * * * * * * * * * * * * * * * * * * * * * * */class Idx_Gui : public ebbox{	Q_OBJECTprivate:	idx_plotdata plotdata;	idx_printdata printdata;	/* *	 * 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)	 * this is to templatize the idx_gui	 * */	idx_type type;	void* idx;	/* *	 * @param fromproperties is used to know if we refresh the display from	 * the properties dialog (so we have to update the plotting datas) or from	 * the keyboard shortcuts (the plotting datas are already changed)	 * anyway as a user you don't have to use it	 * */	bool fromproperties;	//! opens the properties dialog	void openProperties();	QString checkproperties(QString s);public slots:	/* *	 * checks various display settings, triggers a warning if it seems weird,	 *  and calls the displayAll() function of the display widget	 * */	void refreshdisplay();	//! prints accordingly to the print settings	void print();	/* *	 * handles the keyboard event. So far:	 * = (equals) -> zoom in	 * - (minus) -> zoom out	 * p -> print	 * q -> close	 * */	void keyPressEvent( QKeyEvent* event);public:	Idx_Gui(void* idxarg, idx_type argtype, const char* title = "idx", QWidget *parent = 0, QMutex* mutex = NULL);	~Idx_Gui(){};	//! sets the min value for custom normalisation	void setvmin(double min);	//! sets the max value for custoom normalisation	void setvmax(double max);	//! enable (or not) the visualization	void setvisible(bool visible);	//! set visualization as array if idx1	void setidx1_as_array(bool array);	//! set visualization as RGB if idx3	void setidx3_as_RGB(bool rgb);};/******************************************************* ////////////////////////////////////////////////////////////////////////////////////////////* The next following classes handle the properties, the display* and the main widget of the state_idx gui* ////////////////////////////////////////////////////////////////////////////////////////////*****************************************************///! structure for the display optionsstruct state_idx_data{	idx_plotdata x_plotdata, dx_plotdata, ddx_plotdata;	idx_printdata x_printdata, dx_printdata, ddx_printdata;};/********************************************** state_Idx gui  properties dialog window*********************************************/class state_idx_propgui : public QDialog{	Q_OBJECTprivate:	QDoubleSpinBox* zoombox;	QRadioButton* arraybutton;	QRadioButton* rgbbutton;	QDoubleSpinBox* X_minbox;	QDoubleSpinBox* X_maxbox;	QLabel* X_minnorm;	QLabel* X_maxnorm;	QDoubleSpinBox* DX_minbox;	QDoubleSpinBox* DX_maxbox;	QLabel* DX_minnorm;	QLabel* DX_maxnorm;	QDoubleSpinBox* DDX_minbox;	QDoubleSpinBox* DDX_maxbox;	QLabel* DDX_minnorm;	QLabel* DDX_maxnorm;	QCheckBox* X_visiblecheck;	QCheckBox* X_normalcheck;	QCheckBox* DX_visiblecheck;	QCheckBox* DX_normalcheck;	QCheckBox* DDX_visiblecheck;	QCheckBox* DDX_normalcheck;	QCheckBox* X_pretty;	QCheckBox* X_elems;	QCheckBox* DX_pretty;	QCheckBox* DX_elems;	QCheckBox* DDX_pretty;	QCheckBox* DDX_elems;	QCheckBox* print_onfile;	QLineEdit* fileedit;public:	QPushButton* okbutton;	QPushButton* cancelbutton;public:	state_idx_propgui(QWidget* parent, int order);	~state_idx_propgui(){};	//! puts the values of the different boxes of the dialog	// ! to the values of those in arguments	void set_data(state_idx_data* data);public slots:	//! puts the value of the arguments to those of the different boxes of the dialog	void get_data( state_idx_data* data);	//! opens a dialog to choose wich file you want to print on	void choose_file();};/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * state_Idx gui displaying widget related function * * * * * * * * * * * * * * * * * * * * * * * * * * * */class state_idx_displayGui : public QWidget{	Q_OBJECTpublic:	idx_displayGui* x_displayer;	idx_displayGui* dx_displayer;	idx_displayGui* ddx_displayer;	state_idx_displayGui(QWidget* parent, int x_NofDisplay = 1);	~state_idx_displayGui(){};	//! handles the display of all the layers into the different QLabels	//! according to the display options and settings	void displayAll(state_idx* state, state_idx_data* data);};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -