![]() |
Computer Assited Medical Intervention Tool Kit
|
RendererWidget implements all support methods to use camiTK with Qt interface. More...
#include <RendererWidget.h>
Classes | |
class | ScreenshotFormatInfo |
sub-class containing all information concerning exporting images (screenshot) More... | |
Protected Member Functions | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
overloaded mouse move handler because a potentialbug in vtk 5.2.1 More... | |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
overloaded mouse release handler because a potentialbug in vtk 5.2.1 More... | |
Static Protected Member Functions | |
screenshot management | |
build the map | |
static void | buildScreenshotMap () |
static const ScreenshotFormatInfo * | getScreenshotFormatInfo (QString) |
get the information from the extension (QString) More... | |
Protected Attributes | |
extra actors managements | |
is the gradient background displayed | |
bool | displayGradient |
bool | displayCopyright |
is the copyright text displayed More... | |
vtkSmartPointer< vtkActor2D > | copyrightTextActor |
copyright text vtk actor More... | |
bool | displayColorScale |
is the color scale currently displayed More... | |
vtkSmartPointer < vtkScalarBarActor > | colorScale |
the color scale displaying the lookup table + values More... | |
vtkSmartPointer < vtkScalarBarWidget > | colorBarWidget |
the scalar bar widget More... | |
vtkSmartPointer< vtkAxesActor > | axes |
axes actor More... | |
vtkSmartPointer < vtkAnnotatedCubeActor > | annotatedCube |
annotated cube actor More... | |
Private Types | |
enum | ControlMode { JOYSTICK, TRACKBALL, TRACKBALL_2D, NONE } |
list of possible user interaction control mode More... | |
enum | MouseButtonState { NO_BUTTON, LEFT_BUTTON, MIDDLE_BUTTON, RIGHT_BUTTON } |
state of the pressed button (for 3 buttons mouse) More... | |
enum | ScreenshotFormat { PNG = 0, JPG, BMP, PS, EPS, PDF, TEX, SVG, OBJ, RIB, VRML, NOT_SUPPORTED } |
list of supported screenshot export formats More... | |
Private Member Functions | |
RendererWidget (QWidget *parent=0, ControlMode mode=RendererWidget::TRACKBALL) | |
constructors. More... | |
~RendererWidget () | |
destructor More... | |
add/manipulate actors | |
void | addProp (vtkSmartPointer< vtkProp > p, bool refresh=false) |
add a vtkActor or vtkActor2D, updating the cull face depending on the current state. More... | |
bool | containsProp (vtkSmartPointer< vtkProp >) |
is the given vtkProp (e.g. vtkActor or vtkActor2D) in this renderer More... | |
void | removeProp (vtkSmartPointer< vtkProp > p, bool refresh=false) |
remove the given vtkProp (e.g. More... | |
void | actorTransform (vtkSmartPointer< vtkActor >, double *, int, double **, double *, double *) |
perform the transformation of the actor More... | |
picking and interaction | |
vtkSmartPointer< QVTKInteractor > | interactor |
vtkSmartPointer < vtkInteractorStyle > | interactorStyle |
for the interaction with the scene More... | |
ControlMode | controlMode |
current control mode More... | |
ControlMode | getControlMode () const |
void | setControlMode (ControlMode mode) |
Set the interaction like trackball or joystick style. More... | |
void | setPicker (vtkSmartPointer< vtkPicker > woodyWood) |
set the picker to handle the action More... | |
void | pick () |
Perform picking using the current mouse position. More... | |
void | pickActor (int x, int y) |
Perform picking from screen coordinates. More... | |
void | keyPressEvent (QKeyEvent *e) |
key events (do nothing but pass on e to the parent widget), please do not add any shortcut management here (see note in implementation)! More... | |
void | screenshot (QString filename) |
save the screenshot in a file More... | |
void | refresh () |
refresh the display More... | |
static const ScreenshotFormatInfo * | getScreenshotFormatInfo (unsigned int) |
return the information concerning the supporting format using an index corresponding to the enum (check index validity) More... | |
static const ScreenshotFormatInfo * | getScreenshotFormatInfo (ScreenshotFormat) |
retun the information concerning the supporting format using an index corresponding to the enum (check index validity) More... | |
void | leftClick () |
void | rightClick () |
manage right mouse click interactions, can emit rightButtonPressed() signal More... | |
void | actorPicked (vtkSmartPointer< vtkPicker >) |
void | rightButtonPressed () |
send when the mouse right button is clicked More... | |
view/camera settings | |
vtkSmartPointer< vtkRenderer > | renderer |
The current renderer. More... | |
bool | backfaceCulling |
Is back face culling on? More... | |
CameraOrientation | cameraOrientation |
state of the initial camera orientation More... | |
bool | lightFollowCamera |
Is the light following the camera. More... | |
double | pointSize |
default point size More... | |
bool | rendering3DRedBlue |
is rendering in 3D stereo red/blue More... | |
void | setBackfaceCulling (bool) |
bool | getBackfaceCulling () const |
Get the current state of backface culling. More... | |
void | setCameraOrientation (RendererWidget::CameraOrientation) |
Set the current axes mode. More... | |
RendererWidget::CameraOrientation | getCameraOrientation () const |
Return the current axes mode. More... | |
void | setLightFollowCamera (bool) |
Set/unset the light to follow the camera. More... | |
bool | getLightFollowCamera () const |
Get the current state of the property. More... | |
void | setPointSize (double size) |
set the default point size More... | |
double | getPointSize () const |
get the current value of point size More... | |
void | rotateCamera (double angle, int axe) |
Rotate the camera around param "axe" of "angle" degrees. More... | |
void | resetCamera () |
reset the camera to the default position, default FOV. More... | |
void | resetCamera (double bounds[6]) |
reset the camera to the default position, default FOV and use the given bounds to focus on More... | |
void | getCameraSettings (double position[3], double focalPoint[3], double viewUp[3]) |
get camera settings information (position, what is looked at and how) in world coordinates More... | |
void | setActiveCamera (vtkCamera *cam) |
set active camera More... | |
vtkCamera * | getActiveCamera () |
get the active camera More... | |
void | getMouse3DCoordinates (double &x, double &y, double &z) |
get the mouse coordinates in 3D More... | |
void | setBackgroundColor (double, double, double) |
set the background color (rgb) More... | |
void | getBackgroundColor (double &, double &, double &) |
get the background color (rgb) More... | |
bool | getGradientBackground () |
get the current state of the gradient background More... | |
void | setGradientBackground (bool) |
set the gradient background More... | |
void | toogle3DRedBlue () |
toggle stereo 3D red/blue rendering (you will need red/blue glasses) More... | |
void | toggleCopyright (bool) |
toggle copyright text More... | |
void | toggleAxes (bool) |
display the axes More... | |
void | updateAxes () |
update the axes sizes More... | |
void | setColorScale (bool) |
display the color scale in the viewport, use setColorScaleMinMax to change the displayed values More... | |
bool | getColorScale () const |
get the color display state More... | |
void | setColorScaleMinMax (double m, double M) |
set the min and max values. More... | |
void | setColorScaleTitle (QString t) |
set the color scale title. More... | |
void | computeVisiblePropBounds (double bounds[6]) |
get the bounding box of all visible actors [xmin,xmax, ymin,ymax, zmin,zmax] More... | |
void | resetCameraSettings () |
callback and interaction | |
vtkSmartPointer < vtkEventQtSlotConnect > | connector |
vtkSmartPointer < vtkCallbackCommand > | pickingButtonDiverter |
the callback to remove left button interaction while in picking mode More... | |
bool | pickingDiverter |
is the picking diverter used More... | |
static void | divertionCallback (vtkObject *caller, unsigned long eid, void *clientdata, void *calldata) |
a diverter observer callback (to be used to divert undesired events) More... | |
RendererWidget implements all support methods to use camiTK with Qt interface.
This class wraps the necessary VTK method for rendering, interactions, and signal/slot connections. This class should be usable completely independantly of Core.
The Core companion class is InteractiveViewer (which delegates all vtk stuff to RendererWidget.
It is directly based on QVTKWidget, the GUI support class available in Vtk version >= 5.0 This is a pure Qt/vtk wrapper class (no Core stuff).
For developers: please check the coding policy in InteractiveViewer API documentation first.
|
private |
|
private |
|
private |
list of supported screenshot export formats
|
private |
constructors.
By default:
parent | the parent widget |
mode | the mouse interaction control mode (default is TRACKBALL) |
References addProp(), annotatedCube, axes, backfaceCulling, buildScreenshotMap(), cameraOrientation, colorBarWidget, connector, controlMode, copyrightTextActor, displayColorScale, displayCopyright, displayGradient, divertionCallback(), interactor, interactorStyle, leftClick(), NONE, pickingButtonDiverter, pickingDiverter, pointSize, renderer, rendering3DRedBlue, rightClick(), setBackgroundColor(), setCameraOrientation(), and setControlMode().
|
private |
destructor
|
signal |
Referenced by mouseReleaseEvent(), and pickActor().
|
private |
perform the transformation of the actor
|
private |
add a vtkActor or vtkActor2D, updating the cull face depending on the current state.
The method checks it is not already there first. This method is "clever": it does different things (that should be documented bellow), depending on the type of the vtkProp
Action performed depending on the vtkProp (true) type:
p | the vtkProp to add to the scene |
refresh | if true the axes are refreshed (default false) |
References backfaceCulling, containsProp(), pointSize, renderer, and updateAxes().
Referenced by camitk::InteractiveViewer::addActor(), RendererWidget(), setGradientBackground(), and toggleCopyright().
|
staticprotected |
References BMP, EPS, JPG, NOT_SUPPORTED, OBJ, PDF, PNG, PS, RIB, camitk::screenshotMap, SVG, TEX, and VRML.
Referenced by RendererWidget().
|
private |
get the bounding box of all visible actors [xmin,xmax, ymin,ymax, zmin,zmax]
References renderer.
Referenced by camitk::InteractiveViewer::getBounds(), camitk::InteractiveViewer::keyPressEvent(), and updateAxes().
|
private |
is the given vtkProp (e.g. vtkActor or vtkActor2D) in this renderer
References renderer.
Referenced by addProp(), and removeProp().
|
inlinestaticprotected |
a diverter observer callback (to be used to divert undesired events)
Referenced by RendererWidget().
|
private |
get the active camera
References renderer.
Referenced by camitk::InteractiveViewer::InteractiveViewer().
|
private |
Get the current state of backface culling.
References backfaceCulling.
Referenced by camitk::InteractiveViewer::getBackfaceCulling(), and camitk::InteractiveViewer::keyPressEvent().
|
private |
get the background color (rgb)
References renderer.
Referenced by camitk::InteractiveViewer::getBackgroundColor().
|
private |
Return the current axes mode.
References cameraOrientation.
Referenced by camitk::InteractiveViewer::cameraOrientationChanged(), camitk::InteractiveViewer::initActions(), and camitk::InteractiveViewer::initSettings().
|
private |
get camera settings information (position, what is looked at and how) in world coordinates
References renderer.
Referenced by camitk::InteractiveViewer::keyPressEvent().
|
private |
get the color display state
References displayColorScale.
Referenced by camitk::InteractiveViewer::getColorScale(), and camitk::InteractiveViewer::keyPressEvent().
|
private |
References controlMode.
|
private |
get the current state of the gradient background
References displayGradient.
Referenced by camitk::InteractiveViewer::getGradientBackground().
|
private |
Get the current state of the property.
References lightFollowCamera.
Referenced by camitk::InteractiveViewer::keyPressEvent().
|
private |
get the mouse coordinates in 3D
References renderer.
|
private |
get the current value of point size
References pointSize.
Referenced by camitk::InteractiveViewer::getPointSize().
|
staticprivate |
return the information concerning the supporting format using an index corresponding to the enum (check index validity)
References NOT_SUPPORTED.
Referenced by getScreenshotFormatInfo(), screenshot(), and camitk::InteractiveViewer::screenshot().
|
staticprivate |
retun the information concerning the supporting format using an index corresponding to the enum (check index validity)
References camitk::screenshotMap.
|
staticprotected |
get the information from the extension (QString)
References camitk::RendererWidget::ScreenshotFormatInfo::extension, getScreenshotFormatInfo(), and NOT_SUPPORTED.
|
private |
key events (do nothing but pass on e to the parent widget), please do not add any shortcut management here (see note in implementation)!
|
protectedslot |
References interactorStyle, pick(), pickingButtonDiverter, and pickingDiverter.
Referenced by RendererWidget().
|
protectedvirtual |
overloaded mouse move handler because a potentialbug in vtk 5.2.1
References pick().
|
protectedvirtual |
overloaded mouse release handler because a potentialbug in vtk 5.2.1
References actorPicked(), interactorStyle, pickingButtonDiverter, and pickingDiverter.
|
private |
Perform picking using the current mouse position.
References pickActor().
Referenced by camitk::InteractiveViewer::keyPressEvent(), leftClick(), and mouseMoveEvent().
|
private |
Perform picking from screen coordinates.
References actorPicked(), and renderer.
Referenced by pick().
|
private |
refresh the display
Referenced by camitk::InteractiveViewer::backgroundColor(), camitk::InteractiveViewer::cameraOrientationChanged(), camitk::InteractiveViewer::keyPressEvent(), camitk::InteractiveViewer::refresh(), camitk::InteractiveViewer::refreshRenderer(), camitk::InteractiveViewer::setBackfaceCulling(), camitk::InteractiveViewer::setBackgroundColor(), camitk::InteractiveViewer::setGradientBackground(), camitk::InteractiveViewer::setPointSize(), camitk::InteractiveViewer::toggleAxes(), and camitk::InteractiveViewer::toggleCopyright().
|
private |
remove the given vtkProp (e.g.
vtkActor or vtkActor2D, such as color scale)
p | the vtkProp to add to the scene |
refresh | if true the axes are refreshed (default false) |
References containsProp(), renderer, and updateAxes().
Referenced by camitk::InteractiveViewer::removeAllActors(), setGradientBackground(), and toggleCopyright().
|
private |
reset the camera to the default position, default FOV.
The camera focal is set so that all the things in the scenes are visible (i.e. reset the camera clipping range based on the bounds of the visible actors. This ensures that no props are cut off)
References renderer, and resetCameraSettings().
Referenced by camitk::InteractiveViewer::resetCamera().
|
private |
reset the camera to the default position, default FOV and use the given bounds to focus on
References renderer, and resetCameraSettings().
|
protected |
References cameraOrientation, and renderer.
Referenced by resetCamera().
|
signal |
send when the mouse right button is clicked
Referenced by rightClick().
|
protectedslot |
manage right mouse click interactions, can emit rightButtonPressed() signal
References rightButtonPressed().
Referenced by RendererWidget().
|
private |
Rotate the camera around param "axe" of "angle" degrees.
References renderer.
Referenced by camitk::InteractiveViewer::keyPressEvent().
|
private |
save the screenshot in a file
filename | the filename extension (suffix) must be supported (use getScreenshotFormatInfo to get the correct extension) |
References BMP, EPS, getScreenshotFormatInfo(), JPG, NOT_SUPPORTED, OBJ, PDF, PNG, PS, RIB, camitk::screenshotMap, SVG, TEX, and VRML.
Referenced by camitk::InteractiveViewer::screenshot().
|
private |
|
private |
References backfaceCulling, and renderer.
Referenced by camitk::InteractiveViewer::initSettings(), camitk::InteractiveViewer::keyPressEvent(), and camitk::InteractiveViewer::setBackfaceCulling().
|
private |
set the background color (rgb)
References copyrightTextActor, and renderer.
Referenced by camitk::InteractiveViewer::initSettings(), RendererWidget(), and camitk::InteractiveViewer::setBackgroundColor().
|
private |
Set the current axes mode.
References cameraOrientation.
Referenced by camitk::InteractiveViewer::cameraOrientationChanged(), camitk::InteractiveViewer::initSettings(), and RendererWidget().
|
private |
display the color scale in the viewport, use setColorScaleMinMax to change the displayed values
References colorBarWidget, and displayColorScale.
Referenced by camitk::InteractiveViewer::setColorScale(), setColorScaleMinMax(), and setColorScaleTitle().
|
private |
set the min and max values.
m | minimum value (blue) |
M | maximum value (red) |
References colorBarWidget, displayColorScale, and setColorScale().
Referenced by camitk::InteractiveViewer::setColorScaleMinMax().
|
private |
set the color scale title.
t | title of the color scale |
References colorBarWidget, displayColorScale, and setColorScale().
Referenced by camitk::InteractiveViewer::setColorScaleTitle().
|
private |
Set the interaction like trackball or joystick style.
References controlMode, interactor, interactorStyle, JOYSTICK, TRACKBALL, and TRACKBALL_2D.
Referenced by camitk::InteractiveViewer::initSettings(), camitk::InteractiveViewer::keyPressEvent(), RendererWidget(), and camitk::InteractiveViewer::viewControlModeChanged().
|
private |
set the gradient background
References addProp(), copyrightTextActor, displayCopyright, displayGradient, removeProp(), and renderer.
Referenced by camitk::InteractiveViewer::initSettings(), and camitk::InteractiveViewer::setGradientBackground().
|
private |
Set/unset the light to follow the camera.
References interactor, lightFollowCamera, and renderer.
Referenced by camitk::InteractiveViewer::keyPressEvent().
|
private |
set the picker to handle the action
woodyWood | the picker (sorry, I could not resist this one!) |
Referenced by camitk::InteractiveViewer::initPicking().
|
private |
set the default point size
References pointSize, and renderer.
Referenced by camitk::InteractiveViewer::initSettings(), and camitk::InteractiveViewer::setPointSize().
|
private |
display the axes
References annotatedCube, axes, and updateAxes().
Referenced by camitk::InteractiveViewer::toggleAxes().
|
private |
toggle copyright text
References addProp(), copyrightTextActor, displayCopyright, and removeProp().
Referenced by camitk::InteractiveViewer::toggleCopyright().
|
private |
toggle stereo 3D red/blue rendering (you will need red/blue glasses)
References rendering3DRedBlue.
Referenced by camitk::InteractiveViewer::keyPressEvent().
|
private |
update the axes sizes
References annotatedCube, axes, and computeVisiblePropBounds().
Referenced by addProp(), camitk::InteractiveViewer::refresh(), removeProp(), and toggleAxes().
|
protected |
annotated cube actor
Referenced by RendererWidget(), toggleAxes(), and updateAxes().
|
protected |
axes actor
Referenced by RendererWidget(), toggleAxes(), and updateAxes().
|
protected |
Is back face culling on?
Referenced by addProp(), getBackfaceCulling(), RendererWidget(), and setBackfaceCulling().
|
protected |
state of the initial camera orientation
Referenced by getCameraOrientation(), RendererWidget(), resetCameraSettings(), and setCameraOrientation().
|
protected |
the scalar bar widget
Referenced by RendererWidget(), setColorScale(), setColorScaleMinMax(), and setColorScaleTitle().
|
protected |
the color scale displaying the lookup table + values
|
protected |
Referenced by RendererWidget().
|
protected |
current control mode
Referenced by getControlMode(), RendererWidget(), and setControlMode().
|
protected |
copyright text vtk actor
Referenced by RendererWidget(), setBackgroundColor(), setGradientBackground(), and toggleCopyright().
|
protected |
is the color scale currently displayed
Referenced by getColorScale(), RendererWidget(), setColorScale(), setColorScaleMinMax(), and setColorScaleTitle().
|
protected |
is the copyright text displayed
Referenced by RendererWidget(), setGradientBackground(), and toggleCopyright().
|
protected |
Referenced by getGradientBackground(), RendererWidget(), and setGradientBackground().
|
protected |
Referenced by RendererWidget(), setControlMode(), and setLightFollowCamera().
|
protected |
for the interaction with the scene
Referenced by leftClick(), mouseReleaseEvent(), RendererWidget(), and setControlMode().
|
protected |
Is the light following the camera.
Referenced by getLightFollowCamera(), and setLightFollowCamera().
|
protected |
the callback to remove left button interaction while in picking mode
Referenced by leftClick(), mouseReleaseEvent(), and RendererWidget().
|
protected |
is the picking diverter used
Referenced by leftClick(), mouseReleaseEvent(), and RendererWidget().
|
protected |
default point size
Referenced by addProp(), getPointSize(), RendererWidget(), and setPointSize().
|
protected |
The current renderer.
Referenced by addProp(), computeVisiblePropBounds(), containsProp(), getActiveCamera(), getBackgroundColor(), getCameraSettings(), getMouse3DCoordinates(), pickActor(), removeProp(), RendererWidget(), resetCamera(), resetCameraSettings(), rotateCamera(), setActiveCamera(), setBackfaceCulling(), setBackgroundColor(), setGradientBackground(), setLightFollowCamera(), and setPointSize().
|
protected |
is rendering in 3D stereo red/blue
Referenced by RendererWidget(), and toogle3DRedBlue().