Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
icl::qt::ICLWidget Class Reference

Class for openGL-based image visualization components. More...

#include <Widget.h>

Inheritance diagram for icl::qt::ICLWidget:
icl::qt::ICLDrawWidget icl::qt::ICLDrawWidget3D icl::geom::PlotWidget3D

List of all members.

Public Types

enum  fitmode { fmNoScale = 0, fmHoldAR = 1, fmFit = 2, fmZoom = 3 }
 determines how the image is fit into the widget geometry More...
enum  rangemode { rmOn = 1, rmOff = 2, rmAuto }
 determines intensity adaption mode More...
typedef utils::Function
< core::Color
BGColorSource
 generic background color creator plugin

Public Slots

void setImage (const core::ImgBase *image)
 sets up the current image
void showHideMenu ()
void setMenuEmbedded (bool embedded)
void bciModeChanged (int modeIdx)
void brightnessChanged (int val)
void contrastChanged (int val)
void intensityChanged (int val)
void scaleModeChanged (int modeIdx)
void currentChannelChanged (int modeIdx)
void captureCurrentImage ()
void captureCurrentFrameBuffer ()
void recordButtonToggled (bool checked)
void pauseButtonToggled (bool checked)
void stopButtonClicked ()
void skipFramesChanged (int frameSkip)
void menuTabChanged (int index)
void histoPanelParamChanged ()
void setEmbeddedZoomModeEnabled (bool enabled)
void setLinInterpolationEnabled (bool enabled)
void setShowPixelGridEnabled (bool enabled)
void setRangeModeNormalOrScaled (bool enabled)
void showBackgroundColorDialog ()
void showGridColorDialog ()
void setGridAlpha (int alpha)
void setBackgroundBlack ()
void setBackgroundWhite ()
void setBackgroundGray ()
void setGridBlack ()
void setGridWhite ()
void setGridGray ()

Signals

void mouseEvent (const MouseEvent &event)
 invoked when any mouse interaction was performed
void specialButtonClicked (const std::string &id)
 synchronizes special button clicks with GUI thread
void specialButtonToggled (const std::string &id, bool down)
 synchronizes special toggle button clicks with GUI thread

Public Member Functions

 ICLWidget (QWidget *parent=0)
 creates a new ICLWidget within the parent widget
virtual ~ICLWidget ()
 destructor
virtual void initializeGL ()
 GLContext initialization.
virtual void resizeGL (int w, int h)
 called by resizeEvent to adapt the current GL-Viewport
virtual void paintGL ()
 draw function
virtual void paintEvent (QPaintEvent *e)
 drawing function for NO-GL fallback
virtual void customPaintEvent (PaintEngine *e)
 this function can be overwritten do draw additional misc using the given PaintEngine
virtual void setVisible (bool visible)
void setFitMode (fitmode fm)
 sets the current fitmode
void setRangeMode (rangemode rm)
 sets the current rangemode
void setBCI (int brightness, int contrast, int intensity)
 set up current brightness, contrast and intensity adaption values
utils::Size getSize ()
 returns the widgets size as icl::Size
utils::Size getImageSize (bool fromGUIThread=false)
 returns the current images size
utils::Rect getImageRect (bool fromGUIThread=false)
 returns the rect, that is currently used to draw the image into
fitmode getFitMode ()
 returns current fit-mode
rangemode getRangeMode ()
 returns current range mode
std::vector< std::string > getImageInfo ()
 returns a list of image specification string (used by the OSD)
void install (MouseHandler *h)
 adds a new mouse handler via signal-slot connection
void uninstall (MouseHandler *h)
 deletes mouse handler connection
void registerCallback (const GUI::Callback &cb, const std::string &eventList="drag,press")
 registers a simple callback
void removeCallbacks ()
 removes all callbacks registered using registerCallback
void render ()
 re-renders the widget (thread-safe)
virtual bool event (QEvent *event)
 overloaded event function processing special thread save update events
const ImageStatisticsgetImageStatistics ()
 returns current ImageStatistics struct (used by OSD)
void setMenuEnabled (bool enabled)
 if the menu is disabled, there will be no menu button at the top left of the widget
void setImageInfoIndicatorEnabled (bool enabled)
 This can be used in order to hide to label at the lower right image rect.
void setShowNoImageWarnings (bool showWarnings)
 sets wheather to notify, that no image was set
void setViewPort (const utils::Size &size)
 Sets a viewport size that is used if no image was set.
void addSpecialToggleButton (const std::string &id, const core::ImgBase *untoggledIcon=0, const core::ImgBase *toggledIcon=0, bool initiallyToggled=0, const utils::Function< void, bool > &cb=(utils::FunctionImpl< void, bool > *) 0, const std::string &toolTipText="")
 Adds a new toggle-button to the OSD-button bar on the upper widget edge.
void addSpecialButton (const std::string &id, const core::ImgBase *icon=0, const utils::Function< void > &cb=(utils::FunctionImpl< void > *) 0, const std::string &toolTipText="")
 Adds a new toggle-button to the OSD-button bar on the upper widget edge.
void setInfoText (const std::string &text)
 sets an info text, is shown as a dialog when pressing an extra info button
void removeSpecialButton (const std::string &id)
 removes special button with given ID
void setAutoRenderOnSetImage (bool on)
 sets whether the widget will automatically call render when setImage is called
void setBackgroundColorSource (BGColorSource src)
 can be used to replace the default OSD-GUI based background color source
virtual void mousePressEvent (QMouseEvent *e)
virtual void mouseReleaseEvent (QMouseEvent *e)
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void enterEvent (QEvent *e)
virtual void leaveEvent (QEvent *e)
virtual void resizeEvent (QResizeEvent *e)
virtual void wheelEvent (QWheelEvent *e)
virtual void hideEvent (QHideEvent *e)
virtual void keyPressEvent (QKeyEvent *event)
 listens for F11 which enables the fullscreen mode

Protected Member Functions

void showInfoDialog ()
 shows a help dialog
virtual void swapQueues ()
 this is reimplemented by the DrawWidget and by the DrawWidget3D for internal buffers swapping

Private Member Functions

const core::Img8ugrabFrameBufferICL ()
 internally used, grabs the current framebuffer as core::Img8u
std::string getImageCaptureFileName ()
 internal utility function
void updateInfoTab ()
 internal utility function
void rebufferImageInternal ()
 just internally used
const MouseEventcreateMouseEvent (MouseEventType type)
 creates internal event instance

Private Attributes

Data * m_data
 Internal data class (large, so it's hidden)

Friends

class OSDGLButton
 just used internally

Detailed Description

Class for openGL-based image visualization components.

The ICLWidget class provide ICL's fundamental abilities for real-time image visualization. It always comes up with a set of special buttons, that are used to affect the image display in real-time. The left-most button shows an extra menu, which provides a larger set of additional options. The widget can be embedded to external Qt-based GUI-applications. However, we recomment to use ICL's GUI-Creation-Framework rather than using the ICLWidget class directly

Performance

Internally, the icl::qt:GLImg is used for OpenGL-texture-based image rendering. This allows image hardware-scaling -zooming, -intensity and -contrast-adaption.


Member Typedef Documentation

generic background color creator plugin


Member Enumeration Documentation

determines how the image is fit into the widget geometry

Enumerator:
fmNoScale 

the image is not scaled it is centered to the image rect

fmHoldAR 

the image is scaled to fit into the image rect, but its aspect ratio is hold

fmFit 

the image is fit into the frame ( this may change the images aspect ratio)

fmZoom 

new mode where an image rect can be specified in the gui ...

determines intensity adaption mode

Enumerator:
rmOn 

range settings of the sliders are used

rmOff 

no range adjustment is used

rmAuto 

automatic range adjustment


Constructor & Destructor Documentation

icl::qt::ICLWidget::ICLWidget ( QWidget *  parent = 0)

creates a new ICLWidget within the parent widget

virtual icl::qt::ICLWidget::~ICLWidget ( ) [virtual]

destructor


Member Function Documentation

void icl::qt::ICLWidget::addSpecialButton ( const std::string &  id,
const core::ImgBase icon = 0,
const utils::Function< void > &  cb = (utils::FunctionImpl< void > *) 0,
const std::string &  toolTipText = "" 
)

Adds a new toggle-button to the OSD-button bar on the upper widget edge.

See also:
addSpecialToggleButton
void icl::qt::ICLWidget::addSpecialToggleButton ( const std::string &  id,
const core::ImgBase untoggledIcon = 0,
const core::ImgBase toggledIcon = 0,
bool  initiallyToggled = 0,
const utils::Function< void, bool > &  cb = (utils::FunctionImpl< void, bool > *) 0,
const std::string &  toolTipText = "" 
)

Adds a new toggle-button to the OSD-button bar on the upper widget edge.

Special buttons can directly be attached to specific ICLWidget slots, furthermore special button- clicks and toggle events are notified using the ICLWidget-signals specialButtonClicked and specialButtonToggled.

Parameters:
idhandle to reference the button lateron
untoggledIconoptional button icon(recommeded: use buttons from the ICLQt::IconFactory class)
toggledIconoptional button icon (recommeded: use buttons from the ICLQt::IconFactory class)
initiallyToggled
cb
toolTipText
void icl::qt::ICLWidget::bciModeChanged ( int  modeIdx) [slot]
void icl::qt::ICLWidget::brightnessChanged ( int  val) [slot]
void icl::qt::ICLWidget::contrastChanged ( int  val) [slot]

creates internal event instance

void icl::qt::ICLWidget::currentChannelChanged ( int  modeIdx) [slot]
virtual void icl::qt::ICLWidget::customPaintEvent ( PaintEngine e) [virtual]

this function can be overwritten do draw additional misc using the given PaintEngine

Reimplemented in icl::qt::ICLDrawWidget, and icl::qt::ICLDrawWidget3D.

virtual void icl::qt::ICLWidget::enterEvent ( QEvent *  e) [virtual]
virtual bool icl::qt::ICLWidget::event ( QEvent *  event) [virtual]

overloaded event function processing special thread save update events

returns current fit-mode

internal utility function

std::vector<std::string> icl::qt::ICLWidget::getImageInfo ( )

returns a list of image specification string (used by the OSD)

utils::Rect icl::qt::ICLWidget::getImageRect ( bool  fromGUIThread = false)

returns the rect, that is currently used to draw the image into

utils::Size icl::qt::ICLWidget::getImageSize ( bool  fromGUIThread = false)

returns the current images size

returns current ImageStatistics struct (used by OSD)

returns current range mode

returns the widgets size as icl::Size

internally used, grabs the current framebuffer as core::Img8u

virtual void icl::qt::ICLWidget::hideEvent ( QHideEvent *  e) [virtual]
virtual void icl::qt::ICLWidget::initializeGL ( ) [virtual]

GLContext initialization.

adds a new mouse handler via signal-slot connection

Ownership is not passed !

void icl::qt::ICLWidget::intensityChanged ( int  val) [slot]
virtual void icl::qt::ICLWidget::keyPressEvent ( QKeyEvent *  event) [virtual]

listens for F11 which enables the fullscreen mode

virtual void icl::qt::ICLWidget::leaveEvent ( QEvent *  e) [virtual]
void icl::qt::ICLWidget::menuTabChanged ( int  index) [slot]
void icl::qt::ICLWidget::mouseEvent ( const MouseEvent event) [signal]

invoked when any mouse interaction was performed

virtual void icl::qt::ICLWidget::mouseMoveEvent ( QMouseEvent *  e) [virtual]
virtual void icl::qt::ICLWidget::mousePressEvent ( QMouseEvent *  e) [virtual]
virtual void icl::qt::ICLWidget::mouseReleaseEvent ( QMouseEvent *  e) [virtual]
virtual void icl::qt::ICLWidget::paintEvent ( QPaintEvent *  e) [virtual]

drawing function for NO-GL fallback

virtual void icl::qt::ICLWidget::paintGL ( ) [virtual]

draw function

void icl::qt::ICLWidget::pauseButtonToggled ( bool  checked) [slot]

just internally used

void icl::qt::ICLWidget::recordButtonToggled ( bool  checked) [slot]
void icl::qt::ICLWidget::registerCallback ( const GUI::Callback cb,
const std::string &  eventList = "drag,press" 
)

registers a simple callback

Parameters:
cbcallback functor to use
eventListcomma-separated list of events. Supported types are:
  • all (for all events)
  • move (mouse if moved, no button pressed)
  • drag (mouse is moved, at least one button is pressed)
  • press, (guess what)
  • release (button released)
  • enter (mouse cursor enters the widget)
  • leave (mouse cursor leaved the widget)

removes all callbacks registered using registerCallback

void icl::qt::ICLWidget::removeSpecialButton ( const std::string &  id)

removes special button with given ID

re-renders the widget (thread-safe)

in subclasses,

virtual void icl::qt::ICLWidget::resizeEvent ( QResizeEvent *  e) [virtual]
virtual void icl::qt::ICLWidget::resizeGL ( int  w,
int  h 
) [virtual]

called by resizeEvent to adapt the current GL-Viewport

void icl::qt::ICLWidget::scaleModeChanged ( int  modeIdx) [slot]

sets whether the widget will automatically call render when setImage is called

Default is true for the ICLWidget class and false for the Derived classes ICLDrawWidget and ICLDrawWidget3D

can be used to replace the default OSD-GUI based background color source

The background color source can e.g. be adapted by higher level visualization tool, such as the geom::Scene. In this case, the default background color source (background color can be adjusted by the widget's OSD-menu cannot be used any more

void icl::qt::ICLWidget::setBCI ( int  brightness,
int  contrast,
int  intensity 
)

set up current brightness, contrast and intensity adaption values

void icl::qt::ICLWidget::setEmbeddedZoomModeEnabled ( bool  enabled) [slot]

sets the current fitmode

void icl::qt::ICLWidget::setGridAlpha ( int  alpha) [slot]
void icl::qt::ICLWidget::setImage ( const core::ImgBase image) [slot]

sets up the current image

This can be used in order to hide to label at the lower right image rect.

void icl::qt::ICLWidget::setInfoText ( const std::string &  text)

sets an info text, is shown as a dialog when pressing an extra info button

If the info text is set, an extra info (Question-Mark) button is created, that shows an information dialog with this text, when pressed)

void icl::qt::ICLWidget::setLinInterpolationEnabled ( bool  enabled) [slot]
void icl::qt::ICLWidget::setMenuEmbedded ( bool  embedded) [slot]
void icl::qt::ICLWidget::setMenuEnabled ( bool  enabled)

if the menu is disabled, there will be no menu button at the top left of the widget

sets the current rangemode

void icl::qt::ICLWidget::setRangeModeNormalOrScaled ( bool  enabled) [slot]
void icl::qt::ICLWidget::setShowNoImageWarnings ( bool  showWarnings)

sets wheather to notify, that no image was set

void icl::qt::ICLWidget::setShowPixelGridEnabled ( bool  enabled) [slot]

Sets a viewport size that is used if no image was set.

if no image was set, then the OpenGL viewport is adapted as if there was an image with this size. If the given size is utils::Size::null the viewport is not adated

virtual void icl::qt::ICLWidget::setVisible ( bool  visible) [virtual]
void icl::qt::ICLWidget::showInfoDialog ( ) [protected]

shows a help dialog

void icl::qt::ICLWidget::skipFramesChanged ( int  frameSkip) [slot]
void icl::qt::ICLWidget::specialButtonClicked ( const std::string &  id) [signal]

synchronizes special button clicks with GUI thread

void icl::qt::ICLWidget::specialButtonToggled ( const std::string &  id,
bool  down 
) [signal]

synchronizes special toggle button clicks with GUI thread

virtual void icl::qt::ICLWidget::swapQueues ( ) [inline, protected, virtual]

this is reimplemented by the DrawWidget and by the DrawWidget3D for internal buffers swapping

swapQueues is automatically called by render

Reimplemented in icl::qt::ICLDrawWidget.

deletes mouse handler connection

Ownership was not passed -> h is not deleted

internal utility function

virtual void icl::qt::ICLWidget::wheelEvent ( QWheelEvent *  e) [virtual]

Friends And Related Function Documentation

friend class OSDGLButton [friend]

just used internally


Member Data Documentation

Data* icl::qt::ICLWidget::m_data [private]

Internal data class (large, so it's hidden)

Reimplemented in icl::geom::PlotWidget3D.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines