libidxgui
ebl::idxgui Class Reference

List of all members.

Signals

EXPORT void gui_drawImage (idx< ubyte > *img, uint h0, uint w0)
EXPORT void gui_draw_mask (idx< ubyte > *img, uint h0, uint w0, ubyte r, ubyte g, ubyte b, ubyte a)
EXPORT void appquit ()
EXPORT void gui_clear ()
EXPORT void gui_clear_resize ()
EXPORT void gui_save_window (const string *filename, int wid)
EXPORT void gui_new_window (const char *wname, uint h, uint w)
EXPORT void gui_new_window3d (const char *wname, uint h, uint w)
EXPORT void gui_select_window (int wid)
EXPORT void gui_add_text (const string *s)
EXPORT void gui_add_arrow (int h1, int w1, int h2, int w2)
EXPORT void gui_add_flow (idx< float > *flow, int h, int w)
EXPORT void gui_add_box (float h0, float w0, float h, float w, ubyte r, ubyte g, ubyte b, ubyte a, string *s)
EXPORT void gui_add_cross (float h0, float w0, float length, ubyte r, ubyte g, ubyte b, ubyte a, string *s)
EXPORT void gui_add_ellipse (float h0, float w0, float h, float w, ubyte r, ubyte g, ubyte b, ubyte a, string *s)
EXPORT void gui_set_text_origin (uint h0, uint w0)
EXPORT void gui_set_text_colors (unsigned char fg_r, unsigned char fg_g, unsigned char fg_b, unsigned char fg_a, unsigned char bg_r, unsigned char bg_g, unsigned char bg_b, unsigned char bg_a)
EXPORT void gui_set_bg_colors (unsigned char r, unsigned char g, unsigned char b)
EXPORT void gui_set_font_size (int)
EXPORT void gui_set_silent (const std::string *filename)
EXPORT void gui_set_wupdate (bool update)
EXPORT void gui_freeze_style (bool freeze)
EXPORT void gui_freeze_window_size (uint h, uint w)
EXPORT void gui_add_scroll_box (scroll_box0 *sb)
EXPORT void gui_set_title (const string *s)
EXPORT void gui_add_sphere (float, float, float, float, string *s, int, int, int, int)
EXPORT void gui_add_cylinder (float x, float y, float z, float length, float top_radius, float base_radius, float a1, float a2, string *s, int r, int g, int b, int a, bool tops)
EXPORT void gui_draw_text_3d (float x, float y, float z, string *s, int r, int g, int b, int a)
EXPORT void gui_draw_line_3d (float x, float y, float z, float x1, float y1, float z1, string *s, int r, int g, int b, int a)

Public Member Functions

EXPORT void init (int argc_, char **argv_, const uint *nwindows, gui_thread *gt_)
EXPORT int new_window (const char *wname=NULL, uint h=0, uint w=0)
 creates a new window.
EXPORT int new_window3d (const char *wname=NULL, uint h=0, uint w=0)
 creates a new window with 3D display.
EXPORT void select_window (int wid)
 selects window wid.
EXPORT void draw_arrow (int h1, int w1, int h2, int w2)
 draws an arrow from (h1, w1) to (h2, w2).
EXPORT void draw_flow (idx< float > &flow, int h, int w)
 draws a 'flow' at (h,w), where flow is 2xHxW flow field.
EXPORT void draw_box (float h0, float w0, float h, float w, ubyte r=255, ubyte g=255, ubyte b=255, ubyte a=255, string *s=NULL)
EXPORT void draw_cross (float h0, float w0, float length, ubyte r=255, ubyte g=255, ubyte b=255, ubyte a=255, string *s=NULL)
EXPORT void draw_ellipse (float h0, float w0, float h, float w, ubyte r=255, ubyte g=255, ubyte b=255, ubyte a=255, string *s=NULL)
EXPORT void set_silent ()
 do not show windows, instead save them in png files in current dir.
EXPORT void set_silent (const std::string *filename)
 do not show windows, instead save them in png files in current dir.
EXPORT void set_silent (const char *filename)
 do not show windows, instead save them in png files in current dir.
EXPORT void disable_updates ()
EXPORT void enable_updates ()
EXPORT void quit ()
 closes all windows.
EXPORT void clear ()
 Clears the window but does not resizes it to 1x1.
EXPORT void clear_resize ()
 Clears the window and resizes it to 1x1.
EXPORT void save_window (const char *filename, int wid=-1)
template<class T >
void draw_matrix (idx< T > &im, uint h0, uint w0, double zoomh, double zoomw, T minv=0, T maxv=0)
template<class T >
void draw_matrix (idx< T > &im, uint h0=0, uint w0=0)
EXPORT void draw_matrix_unsafe (idx< ubyte > &im, uint h0=0, uint w0=0)
template<class T >
void draw_matrix_frame (idx< T > &im, ubyte r, ubyte g, ubyte b, uint h0=0, uint w0=0, double zoomh=1.0, double zoomw=1.0, T minv=0, T maxv=0)
 same as draw_matrix but draws a frame of color (r,g,b) around it.
template<class T >
void draw_matrix (idx< T > &im, const char *str, uint h0=0, uint w0=0, double zoomh=1.0, double zoomw=1.0, T minv=0, T maxv=0)
 same a draw_matrix but overlays the string <str> in the top left corner.
template<class T >
void draw_mask (idx< T > &im, uint h0=0, uint w0=0, double zoomh=1.0, double zoomw=1.0, ubyte r=255, ubyte g=0, ubyte b=0, ubyte a=127, T threshold=0.0)
 Draws a mask from image.
EXPORT void draw_text (std::string *s)
EXPORT void draw_text (std::string *s, uint h0, uint w0)
EXPORT void set_text_origin (uint h0, uint w0)
EXPORT void set_text_colors (unsigned char fg_r, unsigned char fg_g, unsigned char fg_b, unsigned char fg_a, unsigned char bg_r, unsigned char bg_g, unsigned char bg_b, unsigned char bg_a)
EXPORT void set_text_colors (int fg_r, int fg_g, int fg_b, int fg_a, int bg_r, int bg_g, int bg_b, int bg_a)
 see unsigned char version.
EXPORT void set_bg_colors (unsigned char r, unsigned char g, unsigned char b)
 Set color of background.
EXPORT void set_font_size (int sz)
 Set size of font.
EXPORT void set_cout_and_gui ()
EXPORT void set_gui_only ()
EXPORT void add_scroll_box (scroll_box0 *sb)
EXPORT void set_window_title (const char *s)
 Set the title of the currently selected window.
EXPORT void freeze_style (bool freeze)
EXPORT void freeze_window_size (uint h, uint w)
 Force window size to hxw and forbid any resizing.
EXPORT int pop_key_pressed ()
EXPORT bool busy_drawing ()
 Return true if the gui is busy drawing, false otherwise.
EXPORT void draw_sphere (float x, float y, float z, float radius, const char *s=NULL, int r=255, int g=255, int b=255, int a=255)
 Add a sphere at position (x,y,z) with 'radius' and color (r,g,b,a).
EXPORT void draw_cylinder (float x, float y, float z, float length, float top_radius, float base_radius, float a1, float a2, const char *s=NULL, int r=255, int g=255, int b=255, int a=255, bool tops=false)
EXPORT void draw_text_3d (float x, float y, float z, const char *s, int r=255, int g=255, int b=255, int a=255)
 Draw 3d text 's' at (x,y,z) with color (r,g,b,a).
EXPORT void draw_line_3d (float x, float y, float z, float x1, float y1, float z1, const char *s=NULL, int r=255, int g=255, int b=255, int a=255)
template<class T >
void draw_matrix (idx< T > &im, unsigned int h0, unsigned int w0, double zoomh, double zoomw, T minv, T maxv)
template<class T >
void draw_matrix (idx< T > &im, unsigned int h0, unsigned int w0)
template<class T >
void draw_matrix (idx< T > &im, const char *str, unsigned int h0, unsigned int w0, double zoomh, double zoomw, T minv, T maxv)
template<class T >
void draw_matrix_frame (idx< T > &im, ubyte r, ubyte g, ubyte b, unsigned int h0, unsigned int w0, double zoomh, double zoomw, T minv, T maxv)

Public Attributes

bool thread_init
bool cout_output
int(* run_main )(int, char **)
bool main_done

Protected Member Functions

virtual void run ()

Friends

template<class T >
idxguioperator<< (idxgui &r, const T val)
 operator<< for text drawing on the gui.

Member Function Documentation

void ebl::idxgui::disable_updates ( )

do not update display until enable_updates is called again. this should make the display faster.

void ebl::idxgui::draw_box ( float  h0,
float  w0,
float  h,
float  w,
ubyte  r = 255,
ubyte  g = 255,
ubyte  b = 255,
ubyte  a = 255,
string *  s = NULL 
)

draws a bounding box with top left corner (h0, w0) and size (h, w). the (r,g,b) color of the box can optionally be specified as well as a caption string.

void ebl::idxgui::draw_cross ( float  h0,
float  w0,
float  length,
ubyte  r = 255,
ubyte  g = 255,
ubyte  b = 255,
ubyte  a = 255,
string *  s = NULL 
)

draws a cross at location (h0, w0) with length 'length'. the (r,g,b) color of the box can optionally be specified as well as a caption string.

void ebl::idxgui::draw_cylinder ( float  x,
float  y,
float  z,
float  length,
float  top_radius,
float  base_radius,
float  a1,
float  a2,
const char *  s = NULL,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255,
bool  tops = false 
)

Add a cylinder which base is centered at (x,y,z), with length 'length', with radiuses 'top_radius' and 'base_radius', with degree angles 'a1', 'a2' and color (r,g,b,a).

Parameters:
topsIf true, draw closing caps on each end of cylinder.
void ebl::idxgui::draw_ellipse ( float  h0,
float  w0,
float  h,
float  w,
ubyte  r = 255,
ubyte  g = 255,
ubyte  b = 255,
ubyte  a = 255,
string *  s = NULL 
)

draws an ellipse with center (h0,w0) and radii (h,w). the (r,g,b) color of the box can optionally be specified as well as a caption string.

void ebl::idxgui::draw_line_3d ( float  x,
float  y,
float  z,
float  x1,
float  y1,
float  z1,
const char *  s = NULL,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255 
)

Draw 3d line from (x,y,z) to (x1,y1,z1) with color (r,g,b,a) and with text 's' at (x1,y1,z1).

template<class T >
void ebl::idxgui::draw_matrix ( idx< T > &  im,
uint  h0,
uint  w0,
double  zoomh,
double  zoomw,
minv = 0,
maxv = 0 
)

draw_matrix displays your idx2 or the first layer of your idx3 in grayscale on the whiteboard. This function does a copy of your idx and won't change in in any way !

Parameters:
idxand
typeare, like before, used to templatize the function
xand
yare the coordinates of the top-left corner of your picture on the whiteboard
minvand
maxvare the min and max values to set colors. If left to zero, the min of your idx will be set to 0 and the max will be 255
zoomwand
zoomhare the zoom factors in width and height
template<class T >
void ebl::idxgui::draw_matrix ( idx< T > &  im,
uint  h0 = 0,
uint  w0 = 0 
)

Like draw_matrix template but without zooming and range options (faster).

void ebl::idxgui::draw_matrix_unsafe ( idx< ubyte > &  im,
uint  h0 = 0,
uint  w0 = 0 
)

ubyte specialised draw_matrix (faster, does not involve type conversion) without zooming and range options (also faster). Warning: use with caution. This is not thread safe (but faster), i.e. there might be a race condition on the deletion of the idx data. To avoid race condition, only manipulate/delete the idx when the gui's data mutex is unlocked (see (un)lock_data_mutex()).

void ebl::idxgui::draw_text ( std::string *  s)

draws text on the current window. you can also use the << operator instead of this function to add text to the gui. for example: gui << "text" << endl;

EXPORT void ebl::idxgui::draw_text ( std::string *  s,
uint  h0,
uint  w0 
)

draws text on the current window at origin (h0, w0). you can also use the << operator instead of this function to add text to the gui. for example: gui << at(h0, w0) << "text" << endl;

void ebl::idxgui::enable_updates ( )

allow display updates and display if it was previously off after a call to disable_updates().

void ebl::idxgui::freeze_style ( bool  freeze)

Freeze or unfreeze style, no modification of colors are allowed when frozen.

int ebl::idxgui::pop_key_pressed ( )

Return the first key pressed in the queue of key events and remove it from the queue.

void ebl::idxgui::save_window ( const char *  filename,
int  wid = -1 
)

save current window into filename image. wid is optional, if given save window with id wid.

void ebl::idxgui::set_cout_and_gui ( )

set the << operator to output text on both std::cout and the current window. you can also use the cout_and_gui() function. for example: gui << cout_and_gui() << "text";

void ebl::idxgui::set_gui_only ( )

set the << operator to output text only to the current window. you can also use the gui_only() function and not to std::cout. for example: gui << gui_only() << "text";

void ebl::idxgui::set_text_colors ( unsigned char  fg_r,
unsigned char  fg_g,
unsigned char  fg_b,
unsigned char  fg_a,
unsigned char  bg_r,
unsigned char  bg_g,
unsigned char  bg_b,
unsigned char  bg_a 
)

sets the text color for further calls to draw_text or gui << "text". you can also use the set_colors() function to set text and background colors and transparency. for example: gui << set_colors(255, 255, 255, 255, 0, 0, 0, 127); this sets the text color to fully opaque white on a semi-transparent black background.

EXPORT void ebl::idxgui::set_text_origin ( uint  h0,
uint  w0 
)

sets the origin of further calls to draw_text or gui << "text". you can also use the at() function instead of this one. for example: gui << at(42, 0) << "text";


The documentation for this class was generated from the following files: