Image Component Library (ICL)
|
Class for openGL-based image visualization components. More...
#include <Widget.h>
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 ImageStatistics & | getImageStatistics () |
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::Img8u & | grabFrameBufferICL () |
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 MouseEvent & | createMouseEvent (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 |
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
Internally, the icl::qt:GLImg is used for OpenGL-texture-based image rendering. This allows image hardware-scaling -zooming, -intensity and -contrast-adaption.
generic background color creator plugin
determines how the image is fit into the widget geometry
icl::qt::ICLWidget::ICLWidget | ( | QWidget * | parent = 0 | ) |
creates a new ICLWidget within the parent widget
virtual icl::qt::ICLWidget::~ICLWidget | ( | ) | [virtual] |
destructor
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.
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.
id | handle to reference the button lateron |
untoggledIcon | optional button icon(recommeded: use buttons from the ICLQt::IconFactory class) |
toggledIcon | optional 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::captureCurrentFrameBuffer | ( | ) | [slot] |
void icl::qt::ICLWidget::captureCurrentImage | ( | ) | [slot] |
void icl::qt::ICLWidget::contrastChanged | ( | int | val | ) | [slot] |
const MouseEvent& icl::qt::ICLWidget::createMouseEvent | ( | MouseEventType | type | ) | [private] |
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
std::string icl::qt::ICLWidget::getImageCaptureFileName | ( | ) | [private] |
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
utils::Size icl::qt::ICLWidget::getSize | ( | ) | [inline] |
returns the widgets size as icl::Size
const core::Img8u& icl::qt::ICLWidget::grabFrameBufferICL | ( | ) | [private] |
internally used, grabs the current framebuffer as core::Img8u
virtual void icl::qt::ICLWidget::hideEvent | ( | QHideEvent * | e | ) | [virtual] |
void icl::qt::ICLWidget::histoPanelParamChanged | ( | ) | [slot] |
virtual void icl::qt::ICLWidget::initializeGL | ( | ) | [virtual] |
GLContext initialization.
void icl::qt::ICLWidget::install | ( | MouseHandler * | h | ) |
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] |
void icl::qt::ICLWidget::rebufferImageInternal | ( | ) | [private] |
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
cb | callback functor to use |
eventList | comma-separated list of events. Supported types are:
|
void icl::qt::ICLWidget::removeCallbacks | ( | ) |
removes all callbacks registered using registerCallback
void icl::qt::ICLWidget::removeSpecialButton | ( | const std::string & | id | ) |
removes special button with given ID
void icl::qt::ICLWidget::render | ( | ) |
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] |
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
void icl::qt::ICLWidget::setBackgroundBlack | ( | ) | [slot] |
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::setBackgroundGray | ( | ) | [slot] |
void icl::qt::ICLWidget::setBackgroundWhite | ( | ) | [slot] |
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] |
void icl::qt::ICLWidget::setFitMode | ( | fitmode | fm | ) |
sets the current fitmode
void icl::qt::ICLWidget::setGridAlpha | ( | int | alpha | ) | [slot] |
void icl::qt::ICLWidget::setGridBlack | ( | ) | [slot] |
void icl::qt::ICLWidget::setGridGray | ( | ) | [slot] |
void icl::qt::ICLWidget::setGridWhite | ( | ) | [slot] |
void icl::qt::ICLWidget::setImage | ( | const core::ImgBase * | image | ) | [slot] |
sets up the current image
void icl::qt::ICLWidget::setImageInfoIndicatorEnabled | ( | bool | enabled | ) |
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
void icl::qt::ICLWidget::setRangeMode | ( | rangemode | rm | ) |
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] |
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
virtual void icl::qt::ICLWidget::setVisible | ( | bool | visible | ) | [virtual] |
void icl::qt::ICLWidget::showBackgroundColorDialog | ( | ) | [slot] |
void icl::qt::ICLWidget::showGridColorDialog | ( | ) | [slot] |
void icl::qt::ICLWidget::showHideMenu | ( | ) | [slot] |
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
void icl::qt::ICLWidget::stopButtonClicked | ( | ) | [slot] |
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.
void icl::qt::ICLWidget::uninstall | ( | MouseHandler * | h | ) |
deletes mouse handler connection
Ownership was not passed -> h is not deleted
void icl::qt::ICLWidget::updateInfoTab | ( | ) | [private] |
internal utility function
virtual void icl::qt::ICLWidget::wheelEvent | ( | QWheelEvent * | e | ) | [virtual] |
friend class OSDGLButton [friend] |
just used internally
Data* icl::qt::ICLWidget::m_data [private] |
Internal data class (large, so it's hidden)
Reimplemented in icl::geom::PlotWidget3D.