last update 20 Sep 2009 |
#include <cvrViewer2D.h>
Classes | |
class | configDialog |
Configuration dialog for 2D data. More... | |
class | information |
Information block. More... | |
class | mainWindow |
Main window of the 2D viewer. More... | |
class | parameters |
There are parameters related with the GUI, for example which interaction configuration starts the config dialog, the position of the window, etc. More... | |
Public Types | |
enum | eDataType |
Public Member Functions | |
viewer2D (const std::string &title="Unknown") | |
viewer2D (const viewer2D &other) | |
viewer2D (const parameters ¶ms) | |
~viewer2D () | |
virtual viewer2D * | clone () const |
virtual viewer2D * | newInstance () const |
viewer2D & | copy (const viewer2D &other) |
const parameters & | getParameters () const |
virtual bool | setPainter (const viewer2DPainter &painter) |
virtual bool | saveButtonPressed (const std::string &filename) |
const information & | getInformation () const |
Show images or matrices | |
bool | show (const matrix< rgbaPixel > &img) |
bool | show (const matrix< float > &chnl) |
bool | show (const matrix< int32 > &mask) |
bool | show (const matrix< ubyte > &chnl8) |
Protected Member Functions | |
virtual viewer2DPainter * | newDefaultPainter () const |
information & | getInformation () |
bool | ensureInformationType (const eDataType &type, const ipoint &matrixSize) |
virtual bool | updateInformation () |
virtual bool | validPosition (const ipoint &position) const |
virtual bool | onKMInteraction (const interaction &action, const ipoint &position) |
virtual bool | ensureMainWindow () |
const mainWindow & | getMainWindow () const |
mainWindow & | getMainWindow () |
const configDialog & | getConfigDialog () const |
configDialog & | getConfigDialog () |
virtual bool | getFormattedData (const irectangle &area, image &img) |
const matrix< rgbaPixel > * | getDataAsImage () const |
const matrix< float > * | getDataAsChannel () const |
const matrix< ubyte > * | getDataAsChannel8 () const |
const matrix< int32 > * | getDataAsChannel32 () const |
Protected Attributes | |
mutex | lock_ |
const container * | data_ |
viewer2DPainter * | painter_ |
Viewer class to display images, channels and masks.
It handles the following general matrix types and their corresponding derived classes:
As default behaviour you can get the configuration window pressing the right button of the mouse, but you can change this behaviour setting the parameters accordingly.
If you like the way the viewer displays your data, and you would like the images, then you may want to take a look at cvr::viewer2DPainter, the class responsible for painting the images you see.
guiServer::start(); passiveWait(250000); // wait 1/4 of a second
Types of data that can be displayed with the viewer2D.
cvr::viewer2D::viewer2D | ( | const std::string & | title = "Unknown" |
) |
Constructor.
cvr::viewer2D::viewer2D | ( | const viewer2D & | other | ) |
Copy constructor.
Create a new viewer, with its own window and configuration dialog, with the same content as the other viewer. If that viewer is still inactive, this viewer will also be.
cvr::viewer2D::viewer2D | ( | const parameters & | params | ) |
Constructor.
Sets the given params
cvr::viewer2D::~viewer2D | ( | ) |
Destructor.
virtual viewer2D* cvr::viewer2D::clone | ( | ) | const [virtual] |
bool cvr::viewer2D::ensureInformationType | ( | const eDataType & | type, | |
const ipoint & | matrixSize | |||
) | [protected] |
Ensure that the current information block has the given type and the correct data size.
This saves time getting the information and allows the viewer more speed if a sort of video-out use is planned.
Returns false if it already had the given type or true if it was changed. This is important to know in order to setup the configuration dialog accordingly.
virtual bool cvr::viewer2D::ensureMainWindow | ( | ) | [protected, virtual] |
Ensure that a main window of the proper type has been created.
Reimplemented from cvr::viewerBase.
configDialog& cvr::viewer2D::getConfigDialog | ( | ) | [protected] |
const configDialog& cvr::viewer2D::getConfigDialog | ( | ) | const [protected] |
const matrix<float>* cvr::viewer2D::getDataAsChannel | ( | ) | const [inline, protected] |
Cast data_ as channel.
Cast data_ as channel32.
Cast data_ as channel8.
Cast data_ as image.
virtual bool cvr::viewer2D::getFormattedData | ( | const irectangle & | area, | |
image & | img | |||
) | [protected, virtual] |
Get data as an image for the window indicated by area.
information& cvr::viewer2D::getInformation | ( | ) | [protected] |
Get a writable reference to the internal information block.
This can return a wrong reference. You should check validInformation() first.
Reimplemented from cvr::viewerBase.
const information& cvr::viewer2D::getInformation | ( | ) | const |
Get a read-only reference to the internal information block.
This can return a wrong reference. You should check validInformation() first.
Reimplemented from cvr::viewerBase.
mainWindow& cvr::viewer2D::getMainWindow | ( | ) | [protected] |
Return the main window as reference.
This will throw an assertion if the mainWindow has not been set yet.
Reimplemented from cvr::viewerBase.
const mainWindow& cvr::viewer2D::getMainWindow | ( | ) | const [protected] |
Return the main window as read-only reference.
This will throw an assertion if the mainWindow has not been set yet.
Reimplemented from cvr::viewerBase.
const parameters& cvr::viewer2D::getParameters | ( | ) | const |
virtual viewer2DPainter* cvr::viewer2D::newDefaultPainter | ( | ) | const [protected, virtual] |
Return a pointer to a new instance of the default painter you want to use.
virtual viewer2D* cvr::viewer2D::newInstance | ( | ) | const [virtual] |
virtual bool cvr::viewer2D::onKMInteraction | ( | const interaction & | action, | |
const ipoint & | position | |||
) | [protected, virtual] |
Mouse/Keyboard interaction handler.
This virtual function can be completely overriden and is called each time some interaction with the main window occurs. The default behaviour is to display the position of the mouse pointer within the window in the status bar.
Usually, derived classes override this method to intercept the interaction used to display some information under the mouse pointer.
Reimplemented from cvr::viewerBase.
virtual bool cvr::viewer2D::saveButtonPressed | ( | const std::string & | filename | ) | [virtual] |
Save button pressed.
Method called when the user pressed the save button. Usually this method just call the viewer2D::saveButtonPressed();
Note that if you call this method you can force from the code that the displayed image is saved at the location specified in the parameters.
virtual bool cvr::viewer2D::setPainter | ( | const viewer2DPainter & | painter | ) | [virtual] |
The user can specify a viewer2DPainter object.
Usually you will only use this method if you want to completely change the way 2D data is displayed, beyond the configuration posibilities through parameters, which is only possible if you create your own cvr::viewer2DPainter derived class.
A clone of the given painter will be done.
If you derive a class of cvr::viewer2D and want to always set your own painter, then you should only overload the method newDefaultPainter()
Show a two dimensional image mask with integer values.
mask | the mask to be displayed. |
bool cvr::viewer2D::show | ( | const matrix< float > & | chnl | ) |
virtual bool cvr::viewer2D::updateInformation | ( | ) | [protected, virtual] |
This virtual method is called just before the configuration dialog is to be displayed, in order to update the information block to the data being processed.
Reimplemented from cvr::viewerBase.
virtual bool cvr::viewer2D::validPosition | ( | const ipoint & | position | ) | const [protected, virtual] |
const container* cvr::viewer2D::data_ [protected] |
Pointer to the last object shown.
mutex cvr::viewer2D::lock_ [protected] |
viewer2DPainter* cvr::viewer2D::painter_ [protected] |
The painter.