Image Component Library (ICL)
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
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

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::ColorBGColorSource
 generic background color creator plugin More...
 

Public Slots

void setImage (const core::ImgBase *image)
 sets up the current image More...
 
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 More...
 
void specialButtonClicked (const std::string &id)
 synchronizes special button clicks with GUI thread More...
 
void specialButtonToggled (const std::string &id, bool down)
 synchronizes special toggle button clicks with GUI thread More...
 

Public Member Functions

 ICLWidget (QWidget *parent=0)
 creates a new ICLWidget within the parent widget More...
 
virtual ~ICLWidget ()
 destructor More...
 
virtual void initializeGL ()
 GLContext initialization. More...
 
virtual void resizeGL (int w, int h)
 called by resizeEvent to adapt the current GL-Viewport More...
 
virtual void paintGL ()
 draw function More...
 
virtual void paintEvent (QPaintEvent *e)
 drawing function for NO-GL fallback More...
 
virtual void customPaintEvent (PaintEngine *e)
 this function can be overwritten do draw additional misc using the given PaintEngine More...
 
virtual void setVisible (bool visible)
 
void setFitMode (fitmode fm)
 sets the current fitmode More...
 
void setRangeMode (rangemode rm)
 sets the current rangemode More...
 
void setBCI (int brightness, int contrast, int intensity)
 set up current brightness, contrast and intensity adaption values More...
 
utils::Size getSize ()
 returns the widgets size as icl::Size More...
 
utils::Size getImageSize (bool fromGUIThread=false)
 returns the current images size More...
 
utils::Rect getImageRect (bool fromGUIThread=false)
 returns the rect, that is currently used to draw the image into More...
 
fitmode getFitMode ()
 returns current fit-mode More...
 
rangemode getRangeMode ()
 returns current range mode More...
 
std::vector< std::string > getImageInfo ()
 returns a list of image specification string (used by the OSD) More...
 
void install (MouseHandler *h)
 adds a new mouse handler via signal-slot connection More...
 
void uninstall (MouseHandler *h)
 deletes mouse handler connection More...
 
void registerCallback (const GUI::Callback &cb, const std::string &eventList="drag,press")
 registers a simple callback More...
 
void removeCallbacks ()
 removes all callbacks registered using registerCallback More...
 
void render ()
 re-renders the widget (thread-safe) More...
 
virtual bool event (QEvent *event)
 overloaded event function processing special thread save update events More...
 
const ImageStatisticsgetImageStatistics ()
 returns current ImageStatistics struct (used by OSD) More...
 
void setMenuEnabled (bool enabled)
 if the menu is disabled, there will be no menu button at the top left of the widget More...
 
void setImageInfoIndicatorEnabled (bool enabled)
 This can be used in order to hide to label at the lower right image rect. More...
 
void setShowNoImageWarnings (bool showWarnings)
 sets wheather to notify, that no image was set More...
 
void setViewPort (const utils::Size &size)
 Sets a viewport size that is used if no image was set. More...
 
void setFullScreenMode (bool on, int screen=-1)
 show the widget on fullscreen on the (or returns to the original embedded state) More...
 
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. More...
 
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. More...
 
void setInfoText (const std::string &text)
 sets an info text, is shown as a dialog when pressing an extra info button More...
 
void removeSpecialButton (const std::string &id)
 removes special button with given ID More...
 
void setAutoRenderOnSetImage (bool on)
 sets whether the widget will automatically call render when setImage is called More...
 
void setBackgroundColorSource (BGColorSource src)
 can be used to replace the default OSD-GUI based background color source More...
 
void startRecording (const std::string &outputDevice, const std::string &outputInfo, bool framebuffer=true, int frameskip=0, bool setParamsOnlyButDoNotStartRecording=false)
 sets up the capturing GUI and immediately initialized the internal capturer More...
 
void registerRecordingCallback (utils::Function< void, const core::ImgBase * > cb, const std::string &handle="default")
 adds a callback function that is executed each time an image is recorded! More...
 
void unregisterRecordingCallback (const std::string &handle="default")
 removes a recording callback function More...
 
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 More...
 

Protected Member Functions

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

Private Slots

void reEmbed ()
 internally used for re-embedding ... More...
 

Private Member Functions

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

Private Attributes

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

Friends

class OSDGLButton
 just used internally More...
 

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

◆ BGColorSource

generic background color creator plugin

Member Enumeration Documentation

◆ fitmode

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 ...

◆ rangemode

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

◆ ICLWidget()

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

creates a new ICLWidget within the parent widget

◆ ~ICLWidget()

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

destructor

Member Function Documentation

◆ addSpecialButton()

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

◆ 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

◆ bciModeChanged

void icl::qt::ICLWidget::bciModeChanged ( int  modeIdx)
slot

◆ brightnessChanged

void icl::qt::ICLWidget::brightnessChanged ( int  val)
slot

◆ captureCurrentFrameBuffer

void icl::qt::ICLWidget::captureCurrentFrameBuffer ( )
slot

◆ captureCurrentImage

void icl::qt::ICLWidget::captureCurrentImage ( )
slot

◆ contrastChanged

void icl::qt::ICLWidget::contrastChanged ( int  val)
slot

◆ createMouseEvent()

const MouseEvent& icl::qt::ICLWidget::createMouseEvent ( MouseEventType  type)
private

creates internal event instance

◆ currentChannelChanged

void icl::qt::ICLWidget::currentChannelChanged ( int  modeIdx)
slot

◆ customPaintEvent()

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.

◆ enterEvent()

virtual void icl::qt::ICLWidget::enterEvent ( QEvent *  e)
virtual

◆ event()

virtual bool icl::qt::ICLWidget::event ( QEvent *  event)
virtual

overloaded event function processing special thread save update events

◆ getFitMode()

fitmode icl::qt::ICLWidget::getFitMode ( )

returns current fit-mode

◆ getImageCaptureFileName()

std::string icl::qt::ICLWidget::getImageCaptureFileName ( )
private

internal utility function

◆ getImageInfo()

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

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

◆ getImageRect()

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

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

◆ getImageSize()

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

returns the current images size

◆ getImageStatistics()

const ImageStatistics& icl::qt::ICLWidget::getImageStatistics ( )

returns current ImageStatistics struct (used by OSD)

◆ getRangeMode()

rangemode icl::qt::ICLWidget::getRangeMode ( )

returns current range mode

◆ getSize()

utils::Size icl::qt::ICLWidget::getSize ( )
inline

returns the widgets size as icl::Size

◆ grabFrameBufferICL()

const core::Img8u& icl::qt::ICLWidget::grabFrameBufferICL ( )
private

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

◆ hideEvent()

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

◆ histoPanelParamChanged

void icl::qt::ICLWidget::histoPanelParamChanged ( )
slot

◆ initializeGL()

virtual void icl::qt::ICLWidget::initializeGL ( )
virtual

GLContext initialization.

◆ install()

void icl::qt::ICLWidget::install ( MouseHandler h)

adds a new mouse handler via signal-slot connection

Ownership is not passed !

◆ intensityChanged

void icl::qt::ICLWidget::intensityChanged ( int  val)
slot

◆ keyPressEvent()

virtual void icl::qt::ICLWidget::keyPressEvent ( QKeyEvent *  event)
virtual

listens for F11 which enables the fullscreen mode

◆ leaveEvent()

virtual void icl::qt::ICLWidget::leaveEvent ( QEvent *  e)
virtual

◆ menuTabChanged

void icl::qt::ICLWidget::menuTabChanged ( int  index)
slot

◆ mouseEvent

void icl::qt::ICLWidget::mouseEvent ( const MouseEvent event)
signal

invoked when any mouse interaction was performed

◆ mouseMoveEvent()

virtual void icl::qt::ICLWidget::mouseMoveEvent ( QMouseEvent *  e)
virtual

◆ mousePressEvent()

virtual void icl::qt::ICLWidget::mousePressEvent ( QMouseEvent *  e)
virtual

◆ mouseReleaseEvent()

virtual void icl::qt::ICLWidget::mouseReleaseEvent ( QMouseEvent *  e)
virtual

◆ paintEvent()

virtual void icl::qt::ICLWidget::paintEvent ( QPaintEvent *  e)
virtual

drawing function for NO-GL fallback

◆ paintGL()

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

draw function

◆ pauseButtonToggled

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

◆ rebufferImageInternal()

void icl::qt::ICLWidget::rebufferImageInternal ( )
private

just internally used

◆ recordButtonToggled

void icl::qt::ICLWidget::recordButtonToggled ( bool  checked)
slot

◆ reEmbed

void icl::qt::ICLWidget::reEmbed ( )
privateslot

internally used for re-embedding ...

◆ registerCallback()

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)

◆ registerRecordingCallback()

void icl::qt::ICLWidget::registerRecordingCallback ( utils::Function< void, const core::ImgBase * >  cb,
const std::string &  handle = "default" 
)

adds a callback function that is executed each time an image is recorded!

TODO: Use a non-default handle to manage different callbacks in parallel. use startRecording("null","",...) to use the callbacks without actually recording images.

◆ removeCallbacks()

void icl::qt::ICLWidget::removeCallbacks ( )

removes all callbacks registered using registerCallback

◆ removeSpecialButton()

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

removes special button with given ID

◆ render()

void icl::qt::ICLWidget::render ( )

re-renders the widget (thread-safe)

in subclasses,

◆ resizeEvent()

virtual void icl::qt::ICLWidget::resizeEvent ( QResizeEvent *  e)
virtual

◆ resizeGL()

virtual void icl::qt::ICLWidget::resizeGL ( int  w,
int  h 
)
virtual

called by resizeEvent to adapt the current GL-Viewport

◆ scaleModeChanged

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

◆ setAutoRenderOnSetImage()

void icl::qt::ICLWidget::setAutoRenderOnSetImage ( bool  on)

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

◆ setBackgroundBlack

void icl::qt::ICLWidget::setBackgroundBlack ( )
slot

◆ setBackgroundColorSource()

void icl::qt::ICLWidget::setBackgroundColorSource ( BGColorSource  src)

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

◆ setBackgroundGray

void icl::qt::ICLWidget::setBackgroundGray ( )
slot

◆ setBackgroundWhite

void icl::qt::ICLWidget::setBackgroundWhite ( )
slot

◆ setBCI()

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

set up current brightness, contrast and intensity adaption values

◆ setEmbeddedZoomModeEnabled

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

◆ setFitMode()

void icl::qt::ICLWidget::setFitMode ( fitmode  fm)

sets the current fitmode

◆ setFullScreenMode()

void icl::qt::ICLWidget::setFullScreenMode ( bool  on,
int  screen = -1 
)

show the widget on fullscreen on the (or returns to the original embedded state)

optionally, a screen can be passed on which the widget is to be shown in fullscreen mode

◆ setGridAlpha

void icl::qt::ICLWidget::setGridAlpha ( int  alpha)
slot

◆ setGridBlack

void icl::qt::ICLWidget::setGridBlack ( )
slot

◆ setGridGray

void icl::qt::ICLWidget::setGridGray ( )
slot

◆ setGridWhite

void icl::qt::ICLWidget::setGridWhite ( )
slot

◆ setImage

void icl::qt::ICLWidget::setImage ( const core::ImgBase image)
slot

sets up the current image

◆ setImageInfoIndicatorEnabled()

void icl::qt::ICLWidget::setImageInfoIndicatorEnabled ( bool  enabled)

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

◆ setInfoText()

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)

◆ setLinInterpolationEnabled

void icl::qt::ICLWidget::setLinInterpolationEnabled ( bool  enabled)
slot

◆ setMenuEmbedded

void icl::qt::ICLWidget::setMenuEmbedded ( bool  embedded)
slot

◆ setMenuEnabled()

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

◆ setRangeMode()

void icl::qt::ICLWidget::setRangeMode ( rangemode  rm)

sets the current rangemode

◆ setRangeModeNormalOrScaled

void icl::qt::ICLWidget::setRangeModeNormalOrScaled ( bool  enabled)
slot

◆ setShowNoImageWarnings()

void icl::qt::ICLWidget::setShowNoImageWarnings ( bool  showWarnings)

sets wheather to notify, that no image was set

◆ setShowPixelGridEnabled

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

◆ setViewPort()

void icl::qt::ICLWidget::setViewPort ( const utils::Size size)

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

◆ setVisible()

virtual void icl::qt::ICLWidget::setVisible ( bool  visible)
virtual

◆ showBackgroundColorDialog

void icl::qt::ICLWidget::showBackgroundColorDialog ( )
slot

◆ showGridColorDialog

void icl::qt::ICLWidget::showGridColorDialog ( )
slot

◆ showHideMenu

void icl::qt::ICLWidget::showHideMenu ( )
slot

◆ showInfoDialog()

void icl::qt::ICLWidget::showInfoDialog ( )
protected

shows a help dialog

◆ skipFramesChanged

void icl::qt::ICLWidget::skipFramesChanged ( int  frameSkip)
slot

◆ specialButtonClicked

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

synchronizes special button clicks with GUI thread

◆ specialButtonToggled

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

synchronizes special toggle button clicks with GUI thread

◆ startRecording()

void icl::qt::ICLWidget::startRecording ( const std::string &  outputDevice,
const std::string &  outputInfo,
bool  framebuffer = true,
int  frameskip = 0,
bool  setParamsOnlyButDoNotStartRecording = false 
)

sets up the capturing GUI and immediately initialized the internal capturer

◆ stopButtonClicked

void icl::qt::ICLWidget::stopButtonClicked ( )
slot

◆ swapQueues()

virtual void icl::qt::ICLWidget::swapQueues ( )
inlineprotectedvirtual

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.

◆ uninstall()

void icl::qt::ICLWidget::uninstall ( MouseHandler h)

deletes mouse handler connection

Ownership was not passed -> h is not deleted

◆ unregisterRecordingCallback()

void icl::qt::ICLWidget::unregisterRecordingCallback ( const std::string &  handle = "default")

removes a recording callback function

◆ updateInfoTab()

void icl::qt::ICLWidget::updateInfoTab ( )
private

internal utility function

◆ wheelEvent()

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

Friends And Related Function Documentation

◆ OSDGLButton

friend class OSDGLButton
friend

just used internally

Member Data Documentation

◆ m_data

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

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


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