26#ifndef RENDERERWIDGET_H
27#define RENDERERWIDGET_H
30#error "Header Error: headers reordering required. Please include Log.h after including RendererWidget.h and InteractiveViewer.h or any OpenGL window based class."
38#include <vtkVersion.h>
40#include <CamiTKDisableWarnings>
41#include <QVTKInteractor.h>
42#include <CamiTKReEnableWarnings>
44#if VTK_MAJOR_VERSION == 6
45#include <QVTKWidget2.h>
47#include <vtkGenericOpenGLRenderWindow.h>
49#elif VTK_MAJOR_VERSION == 7
53#if defined(__GNUC__) || defined(__clang__)
54#pragma GCC diagnostic push
55#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
57#ifdef QT_WARNING_DISABLE_DEPRECATED
58QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
61#include <QVTKWidget.h>
63#if defined(__GNUC__) || defined(__clang__)
64#pragma GCC diagnostic pop
66#ifdef QT_WARNING_DISABLE_DEPRECATED
70#include <vtkSmartPointer.h>
73#elif VTK_MAJOR_VERSION == 8
74#include <QVTKOpenGLWidget.h>
75#include <vtkSmartPointer.h>
77#elif VTK_MAJOR_VERSION == 9
78#include <QVTKOpenGLStereoWidget.h>
81#error "Invalid VTK version: not (yet) supported."
86class vtkInteractorStyle;
92class vtkScalarBarActor;
93class vtkEventQtSlotConnect;
94class vtkCallbackCommand;
97class vtkAnnotatedCubeActor;
98class vtkScalarBarWidget;
100class vtkAbstractPropPicker;
105class vtkInteractorStylePick;
125#if VTK_MAJOR_VERSION == 6
128#elif VTK_MAJOR_VERSION == 7
131#elif VTK_MAJOR_VERSION == 8
134#elif VTK_MAJOR_VERSION == 9
138#error "Invalid VTK version: not (yet) supported."
162 Q_ENUM(CameraOrientation)
212 void setPicker(vtkSmartPointer<vtkAbstractPropPicker> woodyWood);
355 void addProp(vtkSmartPointer<vtkProp> p,
bool refresh =
false);
364 void removeProp(vtkSmartPointer<vtkProp> p,
bool refresh =
false);
367 void actorTransform(vtkSmartPointer<vtkActor>,
double*,
int,
double**,
double*,
double*);
424 vtkSmartPointer<vtkRenderer>
renderer;
454 vtkSmartPointer<vtkCallbackCommand> pickingButtonDiverter;
457 bool pickingDiverter;
460 vtkSmartPointer<vtkInteractorStylePick> pickInteractorStyle;
467 bool displayGradient;
473 vtkSmartPointer<vtkLogoWidget> logoWidget;
476 bool displayColorScale;
485 vtkSmartPointer<vtkAxesActor>
axes;
#define CAMITK_API
Definition CamiTKAPI.h:49
void toogle3DRedBlue()
toggle stereo 3D red/blue rendering (you will need red/blue glasses)
void setBackfaceCulling(bool)
void pick()
Perform picking using the current mouse position.
void setPicker(vtkSmartPointer< vtkAbstractPropPicker > woodyWood)
set the picker to handle the action
void setColorScale(bool)
display the color scale in the viewport, use setColorScaleMinMax to change the displayed values
void resetCameraSettings()
void setGradientBackground(bool)
set the gradient background
void setColorScaleMinMax(double m, double M)
set the min and max values.
void getBackgroundColor(double &, double &, double &)
get the background color (rgb)
renderWindowInteractor
Definition RendererWidget.cpp:343
void setAreaPicking(bool areaPicking)
RendererWidget::CameraOrientation getCameraOrientation() const
Return the current axes mode.
rendering3DRedBlue
is rendering in 3D stereo red/blue
Definition RendererWidget.cpp:314
bool getBackfaceCulling() const
Get the current state of backface culling.
vtkSmartPointer< vtkActor2D > orientationDecorationActors[4]
annotated cube text actors
Definition RendererWidget.h:491
void actorPicked(vtkSmartPointer< vtkPicker >)
ControlMode getControlMode() const
get the current control mode
CameraOrientation
Definition RendererWidget.h:155
@ RIGHT_UP
World axes are seen so that x points to the right, y points upward.
Definition RendererWidget.h:158
@ RIGHT_DOWN
World axes are seen so that x points to the right, y points downward.
Definition RendererWidget.h:156
@ BACK_DOWN
< World axes are seen so that x points to the left, y points backward. For Medical Images Coronal Vie...
Definition RendererWidget.h:160
@ LEFT_BACK
Definition RendererWidget.h:159
@ LEFT_UP
World axes are seen so that x points to the left, y points upward.
Definition RendererWidget.h:157
void setPointSize(double size)
set the default point size
vtkSmartPointer< vtkScalarBarActor > colorScale
the color scale displaying the lookup table + values
Definition RendererWidget.h:479
void removeProp(vtkSmartPointer< vtkProp > p, bool refresh=false)
remove the given vtkProp (e.g.
void computeVisiblePropBounds(double *bounds)
get the bounding box of all visible actors [xmin,xmax, ymin,ymax, zmin,zmax]
void setFxaaAntialiasing(bool)
Set/unset FXAA Antialiasing in renderer.
renderer
The current renderer.
Definition RendererWidget.cpp:319
void mouseReleaseEvent(QMouseEvent *event) override
mouse release handler overriden to manage different version of VTK
void setColorScaleTitle(QString t)
set the color scale title.
setBackgroundColor(0.0, 0.0, 0.0)
void toggleLogo(bool)
toggle logo
bool getFxaaAntialiasing() const
Get the current state of FXAA Antialiasing in renderer.
void toggleOrientationDecorations(bool)
display orientation decorations
cameraOrientation
state of the initial camera orientation
Definition RendererWidget.cpp:350
annotatedCube
annotated cube actor
Definition RendererWidget.cpp:406
void mouseMoveEvent(QMouseEvent *event) override
mouse move handler overriden to manage different version of VTK
void toggleAxes(bool)
display the axes
void resetClippingPlanes(double *bounds=nullptr)
reset the camera clipping plane to a given bounding box If no bounds are given, reset to show all vis...
void setLightFollowCamera(bool)
Set/unset the light to follow the camera.
void rightButtonPressed()
send when the mouse right button is clicked
void keyPressEvent(QKeyEvent *e) override
key events (do nothing but pass on e to the parent widget), please do not add any shortcut management...
bool getLightFollowCamera() const
Get the current state of the property.
RendererWidget(QWidget *parent=nullptr, ControlMode mode=RendererWidget::TRACKBALL)
constructors.
bool getColorScale() const
get the color display state
void mousePressEvent(QMouseEvent *event) override
mouse press handler overriden to manage different version of VTK
~RendererWidget() override
destructor
double getPointSize() const
get the current value of point size
controlMode
current control mode
Definition RendererWidget.cpp:349
void pickActor(int, int)
Perform picking from screen coordinates.
pointSize
default point size
Definition RendererWidget.cpp:316
void rotateCamera(double angle, int axe)
Rotate the camera around param "axe" of "angle" degrees.
void refresh()
refresh the display
axes
axes actor
Definition RendererWidget.cpp:364
colorBarWidget
the scalar bar widget
Definition RendererWidget.cpp:538
bool lightFollowCamera
Is the light following the camera.
Definition RendererWidget.h:436
void updateAxes()
update the axes sizes
void setOrientationDecorationsLetters(QString letters[4])
give the lettres for orientation decoration: Left, Right, Top, Down
void resetCamera()
reset the camera to the default position, default FOV.
static void divertionCallback(vtkObject *, unsigned long, void *, void *)
a diverter observer callback (to be used to divert undesired events)
Definition RendererWidget.h:451
void getMouse3DCoordinates(double &x, double &y, double &z)
get the mouse coordinates in 3D
ControlMode
list of possible user interaction control mode
Definition RendererWidget.h:165
@ NONE
Definition RendererWidget.h:169
@ TRACKBALL_2D
same as TRACKBALL but does not allow rotation using left button (but zoom and displacement parallel t...
Definition RendererWidget.h:168
@ JOYSTICK
the mouse is used a joystick
Definition RendererWidget.h:166
@ TRACKBALL
the mouse is used as a trackball (default)
Definition RendererWidget.h:167
vtkSmartPointer< vtkTextMapper > orientationDecorationsTextMapper[4]
annotated cube text
Definition RendererWidget.h:494
setCameraOrientation(cameraOrientation)
controlInteractorStyle
for the interaction with the scene
Definition RendererWidget.cpp:351
void getCameraSettings(double *position, double *focalPoint, double *viewUp)
get camera settings information (position, what is looked at and how) in world coordinates
fxaaAntialiasing
Definition RendererWidget.cpp:312
void endPicking()
end picking
bool containsProp(vtkSmartPointer< vtkProp >)
is the given vtkProp (e.g. vtkActor or vtkActor2D) in this renderer
void actorTransform(vtkSmartPointer< vtkActor >, double *, int, double **, double *, double *)
perform the transformation of the actor
MouseButtonState
state of the pressed button (for 3 buttons mouse)
Definition RendererWidget.h:174
@ LEFT_BUTTON
the mouse left button is currently pressed
Definition RendererWidget.h:176
@ RIGHT_BUTTON
the mouse right button is currently pressed
Definition RendererWidget.h:178
@ NO_BUTTON
no buttons are currently pressed
Definition RendererWidget.h:175
@ MIDDLE_BUTTON
the mouse middle button is currently pressed (or 3rd button emulation)
Definition RendererWidget.h:177
void screenshot(QString filename)
save the screenshot in a file
vtkCamera * getActiveCamera()
get the active camera
bool getGradientBackground()
get the current state of the gradient background
backfaceCulling
Is back face culling on?
Definition RendererWidget.cpp:311
void setActiveCamera(vtkCamera *cam)
set active camera