Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::GuiWX Class Reference

simple wxWindow to display an image. More...

#include <Gui/GuiWX.hh>

+ Inheritance diagram for BIAS::GuiWX:
+ Collaboration diagram for BIAS::GuiWX:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
virtual bool CheckForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured More...
 
virtual bool CheckForEvent (char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible More...
 
virtual char CheckForKeyEvent ()
 checks if any key is pressed and returns it returns -1 if no key is pressed More...
 
virtual bool CheckForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 return true if mouse button is pressed or released, false else see WaitForMouseButtonEvent for detailed description More...
 
bool Closed ()
 returns true if window is closed by user via x button More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
virtual int DestroyWindow ()
 stops the main loop and closes the window More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
virtual void GetFactorOffset (int &xoffset, int &yoffset, int &factor)
 gets offset and factor for mouse position mouse position in (e.g. More...
 
int GetMouseX ()
 
int GetMouseY ()
 
std::string GetTitle ()
 
 GuiWX ()
 
long int Name2DebugLevel (const std::string &name) const
 looks up a debuglevel in the internal map, returns 0 if not found More...
 
long int NewDebugLevel (const std::string &name)
 creates a new debuglevel More...
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
virtual void SetFactorOffset (int xoffset, int yoffset, int factor)
 sets offset and factor for mouse position mouse position in (e.g. More...
 
virtual void SetTitle (std::string const &Title)
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
virtual int ShowImage (ImageBase &image, float min=0.0, float max=255.0)
 shows/updates the image shown in window. More...
 
virtual int ShowImage (PyramidImage< unsigned char > &pim)
 
virtual int ShowImage (PyramidImage< float > &pim)
 
virtual void WaitForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent More...
 
virtual char WaitForKeyEvent ()
 waits until a key is pressed and returns it tested More...
 
virtual void WaitForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits until any mouse button is pressed or released More...
 
 ~GuiWX ()
 

Static Public Member Functions

static long int GetGlobalDebugLevel ()
 
static void SetGlobalDebugLevel (long int lev)
 

Protected Member Functions

long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
template<class PixelType >
int ConvertToUC_ (Image< PixelType > &image, float min, float max)
 
virtual void Init_ (bool ShowMousePos)
 Set up thread and stuff. More...
 
virtual int ShowConvertedImage_ (BIAS::Image< unsigned char > &image)
 Does the real update of the image shown in window. Must be overloaded. More...
 
bool TestImage_ (Image< unsigned char > &image)
 test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size More...
 

Static Protected Member Functions

static void * guiThreadFunc_ (GuiWX *caller)
 

Protected Attributes

long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
GuiWXAppapp_
 
int Factor_
 
pthread_mutex_t guiMutex_
 
pthread_t guiThread_
 
unsigned int Height_
 
int IsPyramid_
 
char KeyBuffer_
 
int MouseButtonPressed_
 
int MouseButtonPressX_
 
int MouseButtonPressY_
 
int MouseButtonReleased_
 
int MouseButtonReleaseX_
 
int MouseButtonReleaseY_
 
int MousePosX_
 
int MousePosY_
 
unsigned int nChannels_
 
ImageBase OrigPicture_
 This is the original representation of the picture. More...
 
unsigned int Pyramid0Height_
 
unsigned int Pyramid0Width_
 
unsigned int PyramidLevels_
 
bool ShowMouse_
 
std::string Title_
 
unsigned int Width_
 if the following 3 variables are set , Buffer_ is already allocated More...
 
bool WindowCreated_
 
int XOffset_
 
int YOffset_
 

Static Protected Attributes

static std::ostream _zDebugStream
 
static bool BaseInitialized_ =false
 
static long int GlobalDebugLevel = 0
 
static pthread_mutex_t MouseButtonMutex_
 

Detailed Description

simple wxWindow to display an image.

WxWidgets is not optimal to do this, so a lot of workaround is needed. Still does not react to key presses, better use GuiCV

Author
ischiller
Date
06/2010

Definition at line 49 of file GuiWX.hh.

Constructor & Destructor Documentation

GuiWX::GuiWX ( )

Definition at line 10 of file GuiWX.cpp.

References guiThreadFunc_().

GuiWX::~GuiWX ( )

Definition at line 24 of file GuiWX.cpp.

Member Function Documentation

void BIAS::Debug::AddDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::AddDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 362 of file Debug.hh.

bool GuiBase::CheckForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

as above but does return immediate with true if event occured

Definition at line 296 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), and BIAS::GuiBase::CheckForMouseButtonEvent().

bool GuiBase::CheckForEvent ( char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible

Definition at line 331 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), and BIAS::GuiBase::CheckForMouseButtonEvent().

char GuiBase::CheckForKeyEvent ( )
virtualinherited

checks if any key is pressed and returns it returns -1 if no key is pressed

Author
Felix Woelk

Reimplemented in BIAS::GuiCV.

Definition at line 340 of file GuiBase.cpp.

References BIAS::GuiBase::KeyBuffer_.

Referenced by BIAS::GuiBase::CheckForEvent(), and BIAS::GuiBase::WaitForEvent().

bool GuiBase::CheckForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited
bool BIAS::GuiBase::Closed ( )
inlineinherited

returns true if window is closed by user via x button

Author
woelk 05/2003

Definition at line 164 of file GuiBase.hh.

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

template<class PixelType >
int GuiBase::ConvertToUC_ ( Image< PixelType > &  image,
float  min,
float  max 
)
protectedinherited
bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const
inlineinherited
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const
inlineinherited

Definition at line 350 of file Debug.hh.

int GuiBase::DestroyWindow ( )
virtualinherited

stops the main loop and closes the window

Reimplemented in BIAS::GuiCV.

Definition at line 283 of file GuiBase.cpp.

int BIAS::Debug::GetDebugLevel ( ) const
inlineinherited
std::ostream& BIAS::Debug::GetDebugStream ( ) const
inlineinherited

Definition at line 405 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const
inlineinherited

Definition at line 414 of file Debug.hh.

void GuiBase::GetFactorOffset ( int &  xoffset,
int &  yoffset,
int &  factor 
)
virtualinherited

gets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 130 of file GuiBase.cpp.

References BIAS::GuiBase::Factor_, BIAS::GuiBase::XOffset_, and BIAS::GuiBase::YOffset_.

static long int BIAS::Debug::GetGlobalDebugLevel ( )
inlinestaticinherited

Definition at line 431 of file Debug.hh.

int BIAS::GuiBase::GetMouseX ( )
inlineinherited

Definition at line 115 of file GuiBase.hh.

int BIAS::GuiBase::GetMouseY ( )
inlineinherited

Definition at line 116 of file GuiBase.hh.

std::string BIAS::GuiBase::GetTitle ( )
inlineinherited

Definition at line 89 of file GuiBase.hh.

void * GuiWX::guiThreadFunc_ ( GuiWX caller)
staticprotected

Definition at line 31 of file GuiWX.cpp.

References app_, BIAS::GuiWXApp, and BIAS::GuiWXApp::Init().

Referenced by GuiWX().

void GuiBase::Init_ ( bool  ShowMousePos)
protectedvirtualinherited
long int BIAS::Debug::Name2DebugLevel ( const std::string &  name) const
inlineinherited

looks up a debuglevel in the internal map, returns 0 if not found

Author
woelk 09/2006

Definition at line 454 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name)
inlineinherited
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

Definition at line 383 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv)
inlineinherited

Definition at line 369 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 376 of file Debug.hh.

void BIAS::Debug::SetDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 325 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os)
inlineinherited

Definition at line 398 of file Debug.hh.

void GuiBase::SetFactorOffset ( int  xoffset,
int  yoffset,
int  factor 
)
virtualinherited

sets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 123 of file GuiBase.cpp.

References BIAS::GuiBase::Factor_, BIAS::GuiBase::XOffset_, and BIAS::GuiBase::YOffset_.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev)
inlinestaticinherited

Definition at line 424 of file Debug.hh.

void GuiWX::SetTitle ( std::string const &  Title)
virtual

Reimplemented from BIAS::GuiBase.

Definition at line 46 of file GuiWX.cpp.

int GuiWX::ShowConvertedImage_ ( BIAS::Image< unsigned char > &  image)
protectedvirtual

Does the real update of the image shown in window. Must be overloaded.

Reimplemented from BIAS::GuiBase.

Definition at line 53 of file GuiWX.cpp.

void BIAS::Debug::ShowDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

prints all internally known debuglevels

Author
woelk 09/2006

Definition at line 496 of file Debug.hh.

int GuiBase::ShowImage ( ImageBase image,
float  min = 0.0,
float  max = 255.0 
)
virtualinherited
int GuiBase::ShowImage ( PyramidImage< unsigned char > &  pim)
virtualinherited
int GuiBase::ShowImage ( PyramidImage< float > &  pim)
virtualinherited
bool BIAS::GuiBase::TestImage_ ( Image< unsigned char > &  image)
inlineprotectedinherited

test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size

Definition at line 217 of file GuiBase.hh.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), and BIAS::ImageBase::GetWidth().

void GuiBase::WaitForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent

Definition at line 311 of file GuiBase.cpp.

References BIAS::GuiBase::CheckForKeyEvent(), BIAS::GuiBase::CheckForMouseButtonEvent(), and BIAS::GuiBase::WindowCreated_.

char GuiBase::WaitForKeyEvent ( )
virtualinherited

waits until a key is pressed and returns it tested

Author
Felix Woelk

Reimplemented in BIAS::GuiCV.

Definition at line 352 of file GuiBase.cpp.

References BIAS::GuiBase::KeyBuffer_, and BIAS::GuiBase::WindowCreated_.

void GuiBase::WaitForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtualinherited

waits until any mouse button is pressed or released

Xpos and Ypos are set to the coordinates within the drawing area Pressed is set to true if the button was pressed and to false if the button was released Button is set to th mouse button no: 1 = left, 2 = middle, 3 = right

Reimplemented in BIAS::GuiCV.

Definition at line 398 of file GuiBase.cpp.

References BIAS::GuiBase::MouseButtonMutex_, BIAS::GuiBase::MouseButtonPressed_, BIAS::GuiBase::MouseButtonPressX_, BIAS::GuiBase::MouseButtonPressY_, BIAS::GuiBase::MouseButtonReleased_, BIAS::GuiBase::MouseButtonReleaseX_, BIAS::GuiBase::MouseButtonReleaseY_, and BIAS::GuiBase::WindowCreated_.

Member Data Documentation

long int BIAS::Debug::_liDebugLevel
protectedinherited

Definition at line 510 of file Debug.hh.

Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().

long int BIAS::Debug::_liNextDebugLevel
protectedinherited

new concept, debuglevel are managed here in the debug class

Definition at line 516 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::ostream BIAS::Debug::_zDebugStream
staticprotectedinherited

Definition at line 511 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

GuiWXApp* BIAS::GuiWX::app_
protected

Definition at line 58 of file GuiWX.hh.

Referenced by guiThreadFunc_().

bool GuiBase::BaseInitialized_ =false
staticprotectedinherited

Definition at line 208 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

int BIAS::GuiBase::Factor_
protectedinherited
long int BIAS::Debug::GlobalDebugLevel = 0
staticprotectedinherited

Definition at line 513 of file Debug.hh.

pthread_mutex_t BIAS::GuiWX::guiMutex_
protected

Definition at line 63 of file GuiWX.hh.

pthread_t BIAS::GuiWX::guiThread_
protected

Definition at line 62 of file GuiWX.hh.

unsigned int BIAS::GuiBase::Height_
protectedinherited

Definition at line 183 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

int BIAS::GuiBase::IsPyramid_
protectedinherited

Definition at line 205 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

char BIAS::GuiBase::KeyBuffer_
protectedinherited
pthread_mutex_t GuiBase::MouseButtonMutex_
staticprotectedinherited
int BIAS::GuiBase::MouseButtonPressed_
protectedinherited
int BIAS::GuiBase::MouseButtonPressX_
protectedinherited
int BIAS::GuiBase::MouseButtonPressY_
protectedinherited
int BIAS::GuiBase::MouseButtonReleased_
protectedinherited
int BIAS::GuiBase::MouseButtonReleaseX_
protectedinherited
int BIAS::GuiBase::MouseButtonReleaseY_
protectedinherited
int BIAS::GuiBase::MousePosX_
protectedinherited

Definition at line 189 of file GuiBase.hh.

Referenced by BIAS::GuiCV::MouseCallback().

int BIAS::GuiBase::MousePosY_
protectedinherited

Definition at line 190 of file GuiBase.hh.

Referenced by BIAS::GuiCV::MouseCallback().

unsigned int BIAS::GuiBase::nChannels_
protectedinherited

Definition at line 184 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

ImageBase BIAS::GuiBase::OrigPicture_
protectedinherited

This is the original representation of the picture.

Definition at line 199 of file GuiBase.hh.

Referenced by BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Height_
protectedinherited

Definition at line 186 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Width_
protectedinherited

Definition at line 185 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

unsigned int BIAS::GuiBase::PyramidLevels_
protectedinherited

Definition at line 187 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_(), and BIAS::GuiBase::ShowImage().

bool BIAS::GuiBase::ShowMouse_
protectedinherited

Definition at line 179 of file GuiBase.hh.

Referenced by BIAS::GuiBase::GuiBase(), and BIAS::GuiBase::Init_().

std::string BIAS::GuiBase::Title_
protectedinherited
unsigned int BIAS::GuiBase::Width_
protectedinherited

if the following 3 variables are set , Buffer_ is already allocated

Definition at line 182 of file GuiBase.hh.

Referenced by BIAS::GuiBase::Init_().

bool BIAS::GuiBase::WindowCreated_
protectedinherited
int BIAS::GuiBase::XOffset_
protectedinherited
int BIAS::GuiBase::YOffset_
protectedinherited

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