![]() |
Computer Assited Medical Intervention Tool Kit
version 3.2
|
InteractiveViewer is used to view 3D objects and slices (anything that provides either a InterfaceBitMap or a InterfaceGeometry). More...
#include <InteractiveViewer.h>
Public Slots | |
void | actorPicked (vtkSmartPointer< vtkPicker >) |
Slot activated when something was picked in the 3D interactor. More... | |
void | sliderChanged (int) |
Slot called when the InteractiveViewer slider has been changed. More... | |
void | toggleCopyright (bool) |
show/hide the copyright in 3D More... | |
void | xAngleChanged (double angle) |
Slot called when the InteractiveViewer x angle update has been changed. More... | |
void | yAngleChanged (double angle) |
Slot called when the InteractiveViewer y angle update has been changed. More... | |
void | zAngleChanged (double angle) |
Slot called when the InteractiveViewer z angle update has been changed. More... | |
Public Member Functions | |
Misc | |
void | setColorScale (bool) |
bool | getColorScale () const |
get the current value of the color scale property. 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 | initPicking (PickingMode) |
Init the picker with a given picking mode. More... | |
void | getBoundsOfSelected (double bound[6]) |
Compute the bounding box of the selected elements [xmin,xmax, ymin,ymax, zmin,zmax]. More... | |
void | getBounds (double bound[6]) |
Compute the bounding box of all displayed Component. More... | |
void | setSideFrameVisible (bool) |
set the slice viewer side bar+screenshot button visibility More... | |
![]() | |
virtual void | refreshInterfaceNode (Component *comp) |
Update the whole tree of the representation of the Component. More... | |
Viewer (QString name) | |
default constructor More... | |
virtual | ~Viewer () |
default destructor More... | |
Protected Slots | |
All the slots called by the menu actions | |
void | renderingActorsChanged () |
void | highlightModeChanged (QAction *selectedAction) |
void | cameraOrientationChanged (QAction *selectedAction) |
void | viewControlModeChanged (QAction *) |
void | backgroundColor () |
void | toggleAxes (bool) |
void | pickingModeChanged (QAction *) |
void | rightClick () |
void | setLabel (bool) |
if true currently selected Components label will have their label on (shown) More... | |
void | setGlyph (bool) |
Protected Attributes | |
Picking management | |
std::vector< Component * > | pickedComponent |
list of Component that are currently picked, correctly displayed in the InteractiveViewer, but for speed optimization that are not yet selected in the explorer. More... | |
PickingMode | pickingMode |
Current picking mode, NO_PICKING be default. More... | |
bool | pickingEffectIsSelecting |
picking effect while mouse button is kept pressed is selecting (depends on the selection state of the first component picked) More... | |
bool | pickingEffectUpdated |
was the picking effect updated (it has to be updated with the first picking for a given button down session) More... | |
Private Types | |
enum | HighlightMode { OFF, SELECTION, SELECTION_ONLY } |
describes the current mode of display. More... | |
enum | PickingMode { PIXEL_PICKING, POINT_PICKING, CELL_PICKING, NO_PICKING } |
Different kind of picking must be available: pixel in slice, a point, a cell, ... More... | |
Private Member Functions | |
Inherited from Viewer | |
virtual unsigned int | numberOfViewedComponent () |
virtual void | refresh (Viewer *whoIsAsking=NULL) |
Refresh the display. More... | |
virtual QWidget * | getWidget (QWidget *parent) |
get the InteractiveViewer widget (QTreeWidget). More... | |
virtual QObject * | getPropertyObject () |
get the InteractiveViewer propertyObject (only non-null for GEOMETRY_VIEWER) More... | |
virtual QMenu * | getMenu () |
get the explorer menu More... | |
virtual QToolBar * | getToolBar () |
get the viewer toolbar More... | |
General/Singleton | |
static QMap< QString, InteractiveViewer * > | viewers |
the map containing all the InteractiveViewer instances More... | |
static QString | defaultNames [5] |
the QString array containing all InteractiveViewer instance default names More... | |
static InteractiveViewer * | getNewViewer (QString, ViewerType type) |
Use this method to create a new custom instance of this class. More... | |
static InteractiveViewer * | getViewer (QString) |
get a viewer by its name (return NULL if no instance has the given name, use getNewViewer to create one viewer) More... | |
static InteractiveViewer * | get3DViewer () |
get the 3D viewer default InteractiveViewer (provided for convenience, equivalent to getViewer("3DViewer") More... | |
static InteractiveViewer * | getAxialViewer () |
get the axial default InteractiveViewer (provided for convenience, equivalent to getViewer("axialViewer") More... | |
static InteractiveViewer * | getCoronalViewer () |
get the coronal default InteractiveViewer (provided for convenience, equivalent to getViewer("coronalViewer") More... | |
static InteractiveViewer * | getSagittalViewer () |
get the sagittal default InteractiveViewer (provided for convenience, equivalent to getViewer("sagittalViewer") More... | |
static InteractiveViewer * | getArbitraryViewer () |
get the arbitrary default InteractiveViewer (provided for convenience, equivalent to getViewer("arbitraryViewer") More... | |
virtual | ~InteractiveViewer () |
Destructor. More... | |
QString | getName () const |
get the scene name More... | |
InteractiveViewer (QString &name, ViewerType type) | |
Construtor. More... | |
Refresh/screenshot | |
void | refreshRenderer () |
just refresh the renderer More... | |
void | resetCamera () |
Reset scene camera. More... | |
void | setActiveCamera (QString cameraName) |
Set the active virtual camera. More... | |
vtkSmartPointer< vtkCamera > | getCamera (QString cameraName="default") |
get a camera by its name, creates one if it does not exist already. More... | |
void | screenshot (QString) |
call this method to take a screenshot using the given filename (the extension must be a supported format extension, see class RendererWindow) More... | |
void | screenshot () |
call this method to take a screenshot in various format and write the resulting image to a file More... | |
Viewing/Interaction Property | |
void | setBackfaceCulling (bool) |
set the backface culling mode (default is true). More... | |
void | setLinesAsTubes (bool tubes) |
Update the visualization of lines (for all the InterfaceGeometry of the scene). More... | |
virtual void | setGradientBackground (bool) |
set gradient background on/off More... | |
bool | getGradientBackground () const |
get the current background gradient mode. More... | |
virtual void | setBackgroundColor (QColor) |
set background color More... | |
QColor | getBackgroundColor () const |
get the background color More... | |
bool | getBackfaceCulling () const |
get the backface current culling mode. More... | |
void | keyPressEvent (QKeyEvent *e) |
Handle keyboard events in the scene, let to the parent widget if not processed here. This method is a friend of class InteractiveViewerFrame. More... | |
bool | getLinesAsTubes () const |
get the boolean indicating if the lines are currently set to be displayed as tubes. More... | |
void | setPointSize (double size) |
update the visualization of points (for all object3D in the scene). More... | |
double | getPointSize () const |
get the current point size value More... | |
virtual void | setHighlightMode (InteractiveViewer::HighlightMode) |
Set the current highlighting mode. More... | |
InteractiveViewer::HighlightMode | getHighlightMode () const |
Return the current highlighting mode. More... | |
RendererWidget * | getRendererWidget () |
return interactiveViewer RendererWidget More... | |
Display properties | |
Properties that can be managed without the knowledge/intervention of the InterfaceGeometry:
Properties that need to be managed by the InterfaceGeometry itself (not boolean state managed somewhere by vtk, not integer/float value manage in InteractiveViewer as a user-preference)
| |
ViewerType | myType |
type of InteractiveViewer (display slice or geometry) More... | |
bool | linesAsTubes |
Are lines currently displayed as tubes (the actors have to add a vtkTubeFilter between the source and the mapper) More... | |
HighlightMode | highlightMode |
keep the value of the hightlight mode More... | |
QMultiMap< Component *, vtkSmartPointer< vtkProp > > | actorMap |
the map containing all the actors in the InteractiveViewer More... | |
unsigned int | displayedTopLevelComponents |
number of top-level component that are currently displayed More... | |
QMap< QString, vtkSmartPointerCamera > | cameraMap |
all the available camera More... | |
void | initSettings () |
initialize the property object and state using the user settings (user preferences system files .config/.ini) More... | |
void | toggleInterpolation () |
for InterfaceBitMap, toggle the interpolation mode (intern method, not a property because it can only be modified by the keyboard interaction) More... | |
void | updateSelectionDisplay (Component *) |
Update the display of the given Component, according to its selection state and the current HighlightMode. More... | |
void | addActor (Component *, vtkSmartPointer< vtkProp >) |
add the given actor of the given Component to the renderer and insert it in the map More... | |
void | removeAllActors (Component *) |
remove all the given Component actors from the renderer and delete comp from the map More... | |
Widget/Action management | |
RendererWidget * | rendererWidget |
SliderSpinBoxWidget * | sliceSlider |
Slider used to control the slice index in a InteractiveViewer. More... | |
InteractiveViewerFrame * | frame |
the InteractiveViewer frame More... | |
QFrame * | sideFrame |
the right side frame (this is where the slider and screenshot buttons are shown) More... | |
QMenu * | viewerMenu |
the QMenu for the InteractiveViewer More... | |
QToolBar * | viewerToolBar |
the QToolBar for the InteractiveViewer More... | |
QAction * | screenshotAction |
Screenshot. More... | |
QMenu * | renderingMenu |
Rendering. More... | |
QAction * | surfaceAction |
QAction * | wireframeAction |
QAction * | pointsAction |
QAction * | colorAction |
QAction * | glyphAction |
QAction * | highlightSelectionAction |
display mode More... | |
QAction * | highlightSelectionOnlyAction |
QAction * | highlightOffAction |
QAction * | controlModeTrackballAction |
to change the camera control mode More... | |
QAction * | controlModeJoystickAction |
QAction * | cameraOrientationRightDownAction |
to change the axes view mode More... | |
QAction * | cameraOrientationLeftUpAction |
QAction * | cameraOrientationRightUpAction |
QAction * | backgroundColorAction |
background color More... | |
QAction * | toggleAxesAction |
button allows to display the Axes in the InteractiveViewer More... | |
QAction * | toggleCopyrightAction |
button to remove the copyright More... | |
QAction * | toggleLabelAction |
button allows to display the labels of the object3D More... | |
QAction * | toggleLinesAsTubesAction |
button allows to display the lines as tubes (the lines are to be in vtkPolyData) More... | |
QAction * | toggleBackfaceCullingAction |
back face culling More... | |
QAction * | pickPointAction |
action of the picking menu More... | |
QAction * | pickCellAction |
void | initActions () |
init all the actions (called only once in the getWidget() method) More... | |
void | updateActions () |
update the viewer menu depending on the selection,... More... | |
void | InteractiveViewerFrame::keyPressEvent (QKeyEvent *e) |
the InteractiveViewerFrame keyPressEvent is a good friend of InteractiveViewer More... | |
Help Whats This Utility | |
QString | whatsThis |
bool | oddWhatsThis |
are we currently in a odd table line More... | |
void | initWhatsThis () |
initialize the what's this html string More... | |
void | startWhatsThisSection (const QString &title="") |
start a table (section) in the what's this message More... | |
void | endWhatsThisSection () |
end a table (section) in the what's this message More... | |
void | addWhatsThisItem (const QString &key, const QString &description) |
add an item (row) in the the what's this message (to describe a shortcut) More... | |
Additional Inherited Members | |
![]() | |
void | selectionChanged () |
this signal is emitted when the current selection was changed by the viewer More... | |
![]() | |
void | clearSelection () |
clear the selection More... | |
void | selectionChanged (ComponentList &compSet) |
The selection has changed to the given ComponentList. More... | |
void | selectionChanged (Component *comp) |
the selection has changed to be just one comp More... | |
InteractiveViewer is used to view 3D objects and slices (anything that provides either a InterfaceBitMap or a InterfaceGeometry).
It contains a renderer (class RendererWidget) that combines VTK and QT. The RendererWidget instance manage all the display at the VTK level. InteractiveViewer delegates all pure VTK level stuff to the renderer. All things that needs InterfaceBitMap/InterfaceGeometry interaction/knowledge/access are manage at this level. The keyboard events are all managed in InteractiveViewer as well. Keyboard/Mouse interactions: check "what's this?" on the scene 3D to get all interaction shortcuts.
There are five default InteractiveViewer "singleton" instances named:
InteractiveViewer class is completely independant from MainWindow application skeleton (and please keep it that way!)
InteractiveViewer manages a list of cameras. Each camera has a name. Use getCamera(QString) to create a new camera, or get the default camera and setActiveCamera(QString) to change the active camera. The default camera is called "default".
InteractiveViewer manages picking session. A picking session starts when the control key is pressed and the left mouse button is clicked and ends when the mouse button is released. A picking session is a nice/quick way to do a lot of picking by simply moving the mouse, without the need to click for each picking. At the start of a picking session, the picking action is determined: it is either selection or unselection. If one of the first picked components was already selected, then the user wants to unselect, therefore picking action is "unselection", and all subsequently calls to pickPoint(..) or pickCell(..) will use pickingIsSelecting=false (2nd parameter of the method). If the first picked component was not selected, then the picking session is going to select any picked component.
The following help is for InteractiveViewer/RendererWidget developers, please read if you want/need to change anything in one of this two class. It should help you in your coding decisions (hopefully!).
|
private |
describes the current mode of display.
It is usefull to change the way the currently selected Components look compared to the unselected ones. In the default mode a Component is not highlighted, not shaded and not hidden.
|
private |
Different kind of picking must be available: pixel in slice, a point, a cell, ...
So far, only pixel picking is implemented.
Enumerator | |
---|---|
PIXEL_PICKING |
pick a pixel on a Slice |
POINT_PICKING |
pick a point in the VTK representation of an Geometry |
CELL_PICKING |
pick a cell in the VTK representation of an Geometry |
NO_PICKING |
no picking possible |
|
privatevirtual |
Destructor.
|
protected |
Construtor.
name | the name of the scene is mandatory, it is used as an identifier (e.g. in MedicalImageViewer) |
type | type of the InteractiveViewer, depending on which it will behave as slice viewer, i.e. with no rotation interactions are possible, or 3D viewer |
|
slot |
Slot activated when something was picked in the 3D interactor.
Process the picker accordingly to the current pickingMode state. It is connected to the RendererWidget actorPicked signal
|
protected |
add the given actor of the given Component to the renderer and insert it in the map
|
protected |
add an item (row) in the the what's this message (to describe a shortcut)
|
protectedslot |
|
protectedslot |
|
protected |
end a table (section) in the what's this message
|
staticprivate |
get the 3D viewer default InteractiveViewer (provided for convenience, equivalent to getViewer("3DViewer")
|
staticprivate |
get the arbitrary default InteractiveViewer (provided for convenience, equivalent to getViewer("arbitraryViewer")
|
staticprivate |
get the axial default InteractiveViewer (provided for convenience, equivalent to getViewer("axialViewer")
bool camitk::InteractiveViewer::getBackfaceCulling | ( | ) | const |
get the backface current culling mode.
QColor camitk::InteractiveViewer::getBackgroundColor | ( | ) | const |
get the background color
void camitk::InteractiveViewer::getBounds | ( | double | bound[6] | ) |
Compute the bounding box of all displayed Component.
void camitk::InteractiveViewer::getBoundsOfSelected | ( | double | bound[6] | ) |
Compute the bounding box of the selected elements [xmin,xmax, ymin,ymax, zmin,zmax].
|
private |
get a camera by its name, creates one if it does not exist already.
This method does not activate the given camera, please use setActiveCamera for this.
bool camitk::InteractiveViewer::getColorScale | ( | ) | const |
get the current value of the color scale property.
|
staticprivate |
get the coronal default InteractiveViewer (provided for convenience, equivalent to getViewer("coronalViewer")
bool camitk::InteractiveViewer::getGradientBackground | ( | ) | const |
get the current background gradient mode.
InteractiveViewer::HighlightMode camitk::InteractiveViewer::getHighlightMode | ( | ) | const |
Return the current highlighting mode.
bool camitk::InteractiveViewer::getLinesAsTubes | ( | ) | const |
get the boolean indicating if the lines are currently set to be displayed as tubes.
|
privatevirtual |
get the explorer menu
Reimplemented from camitk::Viewer.
|
private |
get the scene name
|
staticprivate |
Use this method to create a new custom instance of this class.
Of course you can create as many InteractiveViewer instance as you like, but if you try to create a InteractiveViewer with a name that match one of the default InteractiveViewer name, getNewViewer(..) automatically will return the corresponding default InteractiveViewer instance.
double camitk::InteractiveViewer::getPointSize | ( | ) | const |
get the current point size value
|
privatevirtual |
get the InteractiveViewer propertyObject (only non-null for GEOMETRY_VIEWER)
Reimplemented from camitk::Viewer.
|
inline |
return interactiveViewer RendererWidget
|
staticprivate |
get the sagittal default InteractiveViewer (provided for convenience, equivalent to getViewer("sagittalViewer")
|
privatevirtual |
get the viewer toolbar
Reimplemented from camitk::Viewer.
|
staticprivate |
get a viewer by its name (return NULL if no instance has the given name, use getNewViewer to create one viewer)
|
privatevirtual |
get the InteractiveViewer widget (QTreeWidget).
parent | the parent widget for the viewer widget |
Implements camitk::Viewer.
|
protectedslot |
|
protected |
init all the actions (called only once in the getWidget() method)
void camitk::InteractiveViewer::initPicking | ( | PickingMode | ) |
Init the picker with a given picking mode.
|
protected |
initialize the property object and state using the user settings (user preferences system files .config/.ini)
|
protected |
initialize the what's this html string
void camitk::InteractiveViewer::keyPressEvent | ( | QKeyEvent * | e | ) |
Handle keyboard events in the scene, let to the parent widget if not processed here. This method is a friend of class InteractiveViewerFrame.
|
privatevirtual |
returns the number of Component that are displayed by this viewer
Implements camitk::Viewer.
|
protectedslot |
|
privatevirtual |
Refresh the display.
Implements camitk::Viewer.
|
private |
just refresh the renderer
|
protected |
remove all the given Component actors from the renderer and delete comp from the map
|
protectedslot |
|
private |
Reset scene camera.
Use a trick (when this is a SLICE_VIEWER) for scaling up to max size in the viewer
|
protectedslot |
|
private |
call this method to take a screenshot using the given filename (the extension must be a supported format extension, see class RendererWindow)
|
slot |
call this method to take a screenshot in various format and write the resulting image to a file
|
private |
Set the active virtual camera.
|
slot |
set the backface culling mode (default is true).
|
virtual |
set background color
void camitk::InteractiveViewer::setColorScale | ( | bool | ) |
set the color scale in the viewport, use setColorScaleMinMax / setColorScaleTitle to change the displayed values.
void camitk::InteractiveViewer::setColorScaleMinMax | ( | double | m, |
double | M | ||
) |
set the min and max values.
Automatically turns setColorScale to true.
m | minimum value (blue) |
M | maximum value (red) |
void camitk::InteractiveViewer::setColorScaleTitle | ( | QString | t | ) |
set the color scale title.
t | title of the color scale |
|
protectedslot |
|
virtual |
set gradient background on/off
|
virtual |
Set the current highlighting mode.
|
protectedslot |
if true currently selected Components label will have their label on (shown)
|
slot |
Update the visualization of lines (for all the InterfaceGeometry of the scene).
tubes | if true, then the lines have to be displayed as tube |
void camitk::InteractiveViewer::setPointSize | ( | double | size | ) |
update the visualization of points (for all object3D in the scene).
This property acts directly on the actor, thus it can be changed outside the InterfaceGeometry, thus the InterfaceGeometry should not be aware of its value (no method should be concerned with this property)
void camitk::InteractiveViewer::setSideFrameVisible | ( | bool | ) |
set the slice viewer side bar+screenshot button visibility
|
slot |
Slot called when the InteractiveViewer slider has been changed.
If there is a InterfaceBitMap in the scene, set the slice index with the new slider value.
|
protected |
start a table (section) in the what's this message
|
protectedslot |
|
slot |
show/hide the copyright in 3D
|
protected |
for InterfaceBitMap, toggle the interpolation mode (intern method, not a property because it can only be modified by the keyboard interaction)
|
protected |
update the viewer menu depending on the selection,...
|
protected |
Update the display of the given Component, according to its selection state and the current HighlightMode.
|
protectedslot |
|
slot |
Slot called when the InteractiveViewer x angle update has been changed.
|
slot |
Slot called when the InteractiveViewer y angle update has been changed.
|
slot |
Slot called when the InteractiveViewer z angle update has been changed.
|
friend |
the InteractiveViewerFrame keyPressEvent is a good friend of InteractiveViewer
|
protected |
the map containing all the actors in the InteractiveViewer
|
protected |
background color
|
protected |
all the available camera
|
protected |
|
protected |
to change the axes view mode
|
protected |
|
protected |
|
protected |
|
protected |
to change the camera control mode
|
staticprotected |
the QString array containing all InteractiveViewer instance default names
|
protected |
number of top-level component that are currently displayed
|
protected |
the InteractiveViewer frame
|
protected |
|
protected |
keep the value of the hightlight mode
|
protected |
|
protected |
display mode
|
protected |
|
protected |
Are lines currently displayed as tubes (the actors have to add a vtkTubeFilter between the source and the mapper)
|
protected |
type of InteractiveViewer (display slice or geometry)
|
protected |
are we currently in a odd table line
|
protected |
|
protected |
list of Component that are currently picked, correctly displayed in the InteractiveViewer, but for speed optimization that are not yet selected in the explorer.
They will all be selected in the explorer when the user release the mouse button.
|
protected |
picking effect while mouse button is kept pressed is selecting (depends on the selection state of the first component picked)
|
protected |
was the picking effect updated (it has to be updated with the first picking for a given button down session)
|
protected |
Current picking mode, NO_PICKING be default.
|
protected |
action of the picking menu
|
protected |
|
protected |
The 3D scene itself, wrapping VTK render window, renderer and interactor in a single Qt widget
|
protected |
Rendering.
|
protected |
Screenshot.
|
protected |
the right side frame (this is where the slider and screenshot buttons are shown)
|
protected |
Slider used to control the slice index in a InteractiveViewer.
This slider is visible only when the scene a 2D viewer (see constructor).
|
protected |
|
protected |
button allows to display the Axes in the InteractiveViewer
|
protected |
back face culling
|
protected |
button to remove the copyright
|
protected |
button allows to display the labels of the object3D
|
protected |
button allows to display the lines as tubes (the lines are to be in vtkPolyData)
|
protected |
the QMenu for the InteractiveViewer
|
staticprotected |
the map containing all the InteractiveViewer instances
|
protected |
the QToolBar for the InteractiveViewer
|
protected |
The what's html string
|
protected |