CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkVTKAbstractView Class Reference

#include <Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h>

Inheritance diagram for ctkVTKAbstractView:
Inheritance graph
[legend]
Collaboration diagram for ctkVTKAbstractView:
Collaboration graph
[legend]

Public Types

typedef QWidget Superclass
 

Public Slots

virtual void forceRender ()
 
virtual bool isRenderPaused () const
 
virtual int pauseRender ()
 
virtual int resumeRender ()
 
virtual void scheduleRender ()
 
virtual void setBackgroundColor (const QColor &newBackgroundColor)
 Set the background color of the rendering screen. More...
 
virtual void setBackgroundColor2 (const QColor &newBackgroundColor)
 
virtual void setCornerAnnotationText (const QString &text)
 Set corner annotation text. More...
 
void setFPSVisible (bool show)
 Show/Hide the FPS annotation. More...
 
virtual void setGradientBackground (bool enable)
 
void setMaximumUpdateRate (double fps)
 
void setRenderEnabled (bool value)
 Enable/Disable rendering. More...
 
virtual int setRenderPaused (bool pause)
 
void setUseDepthPeeling (bool use)
 

Public Member Functions

virtual QColor backgroundColor () const
 Get background color. More...
 
virtual QColor backgroundColor2 () const
 Get the second background color. More...
 
Q_INVOKABLE vtkCornerAnnotation * cornerAnnotation () const
 
QString cornerAnnotationText () const
 Get corner annotation text. More...
 
 ctkVTKAbstractView (QWidget *parent=0)
 
double fps () const
 Return the current FPS. More...
 
virtual bool gradientBackground () const
 Is the background a gradient. More...
 
virtual bool hasHeightForWidth () const
 
virtual int heightForWidth (int width) const
 
Q_INVOKABLE vtkRenderWindowInteractor * interactor () const
 Set/Get window interactor. More...
 
Q_INVOKABLE vtkInteractorObserver * interactorStyle () const
 Get current interactor style. More...
 
bool isFPSVisible () const
 Return true if the FPS annotation is visible, false otherwise. More...
 
double maximumUpdateRate () const
 
virtual QSize minimumSizeHint () const
 
bool renderEnabled () const
 Return if rendering is enabled. More...
 
Q_INVOKABLE vtkRenderWindow * renderWindow () const
 Get underlying RenderWindow. More...
 
virtual void setInteractor (vtkRenderWindowInteractor *interactor)
 
virtual QSize sizeHint () const
 
bool useDepthPeeling () const
 
Q_INVOKABLE ctkVTKOpenGLNativeWidgetVTKWidget () const
 Get the underlying QVTKWidget. More...
 
virtual ~ctkVTKAbstractView ()
 

Static Public Member Functions

static int multiSamples ()
 
static void setMultiSamples (int)
 

Protected Slots

void onRender ()
 
virtual void requestRender ()
 
void updateFPS ()
 

Protected Member Functions

 ctkVTKAbstractView (ctkVTKAbstractViewPrivate *pimpl, QWidget *parent)
 

Protected Attributes

QScopedPointer< ctkVTKAbstractViewPrivate > d_ptr
 

Properties

QColor backgroundColor
 
QColor backgroundColor2
 
QVTK_OBJECTQString cornerAnnotationText
 
bool fpsVisible
 
bool gradientBackground
 
double maximumUpdateRate
 Set a maximum rate (in frames per second) for rendering. More...
 
bool renderEnabled
 
bool useDepthPeeling
 

Detailed Description

Definition at line 39 of file ctkVTKAbstractView.h.

Member Typedef Documentation

◆ Superclass

Definition at line 61 of file ctkVTKAbstractView.h.

Constructor & Destructor Documentation

◆ ctkVTKAbstractView() [1/2]

ctkVTKAbstractView::ctkVTKAbstractView ( QWidget *  parent = 0)
explicit

◆ ~ctkVTKAbstractView()

virtual ctkVTKAbstractView::~ctkVTKAbstractView ( )
virtual

◆ ctkVTKAbstractView() [2/2]

ctkVTKAbstractView::ctkVTKAbstractView ( ctkVTKAbstractViewPrivate *  pimpl,
QWidget *  parent 
)
protected

Member Function Documentation

◆ backgroundColor()

virtual QColor ctkVTKAbstractView::backgroundColor ( ) const
virtual

Get background color.

Reimplemented in ctkVTKSliceView.

◆ backgroundColor2()

virtual QColor ctkVTKAbstractView::backgroundColor2 ( ) const
virtual

Get the second background color.

◆ cornerAnnotation()

Q_INVOKABLE vtkCornerAnnotation* ctkVTKAbstractView::cornerAnnotation ( ) const

◆ cornerAnnotationText()

QString ctkVTKAbstractView::cornerAnnotationText ( ) const

Get corner annotation text.

◆ forceRender

virtual void ctkVTKAbstractView::forceRender ( )
virtualslot

Force a render even if a render is already ocurring Be careful when calling forceRender() as it can slow down your application. It is preferable to use scheduleRender() instead.

See also
scheduleRender

◆ fps()

double ctkVTKAbstractView::fps ( ) const

Return the current FPS.

◆ gradientBackground()

virtual bool ctkVTKAbstractView::gradientBackground ( ) const
virtual

Is the background a gradient.

◆ hasHeightForWidth()

virtual bool ctkVTKAbstractView::hasHeightForWidth ( ) const
virtual

◆ heightForWidth()

virtual int ctkVTKAbstractView::heightForWidth ( int  width) const
virtual

◆ interactor()

Q_INVOKABLE vtkRenderWindowInteractor* ctkVTKAbstractView::interactor ( ) const

Set/Get window interactor.

◆ interactorStyle()

Q_INVOKABLE vtkInteractorObserver* ctkVTKAbstractView::interactorStyle ( ) const

Get current interactor style.

◆ isFPSVisible()

bool ctkVTKAbstractView::isFPSVisible ( ) const

Return true if the FPS annotation is visible, false otherwise.

◆ isRenderPaused

virtual bool ctkVTKAbstractView::isRenderPaused ( ) const
virtualslot

Returns true if the current pause render count is greater than 0

See also
setPauseRender

◆ maximumUpdateRate()

double ctkVTKAbstractView::maximumUpdateRate ( ) const

Returns maximum rate for rendering (in frames per second). \sa setMaximumUpdateRate

◆ minimumSizeHint()

virtual QSize ctkVTKAbstractView::minimumSizeHint ( ) const
virtual

◆ multiSamples()

static int ctkVTKAbstractView::multiSamples ( )
static

Return the current multisamples default

See also
setMultiSamples()

◆ onRender

void ctkVTKAbstractView::onRender ( )
protectedslot

◆ pauseRender

virtual int ctkVTKAbstractView::pauseRender ( )
virtualslot

Increments the pause render count

See also
setPauseRender

◆ renderEnabled()

bool ctkVTKAbstractView::renderEnabled ( ) const

Return if rendering is enabled.

◆ renderWindow()

Q_INVOKABLE vtkRenderWindow* ctkVTKAbstractView::renderWindow ( ) const

Get underlying RenderWindow.

◆ requestRender

virtual void ctkVTKAbstractView::requestRender ( )
protectedvirtualslot

Calls forceRender if the rendering has not been paused from pauseRender()

See also
pauseRender

◆ resumeRender

virtual int ctkVTKAbstractView::resumeRender ( )
virtualslot

De-increments the pause render count and calls scheduleRender() if one is currently pending

See also
setPauseRender

◆ scheduleRender

virtual void ctkVTKAbstractView::scheduleRender ( )
virtualslot

Notify QVTKWidget that the view needs to be rendered. scheduleRender() respects the maximum update rate of the view, it won't render the window more frequently than what the maximum update rate is.

See also
setMaximumUpdateRate

◆ setBackgroundColor

virtual void ctkVTKAbstractView::setBackgroundColor ( const QColor &  newBackgroundColor)
virtualslot

Set the background color of the rendering screen.

Reimplemented in ctkVTKSliceView.

◆ setBackgroundColor2

virtual void ctkVTKAbstractView::setBackgroundColor2 ( const QColor &  newBackgroundColor)
virtualslot

Set the second background color of the rendering screen for gradient backgrounds.

◆ setCornerAnnotationText

virtual void ctkVTKAbstractView::setCornerAnnotationText ( const QString &  text)
virtualslot

Set corner annotation text.

◆ setFPSVisible

void ctkVTKAbstractView::setFPSVisible ( bool  show)
slot

Show/Hide the FPS annotation.

◆ setGradientBackground

virtual void ctkVTKAbstractView::setGradientBackground ( bool  enable)
virtualslot

Set whether this view should have a gradient background using the Background (top) and Background2 (bottom) colors. Default is off.

◆ setInteractor()

virtual void ctkVTKAbstractView::setInteractor ( vtkRenderWindowInteractor *  interactor)
virtual

QVTKWidget catches all render requests, and ensure the desired framerate is respected. The interactor never calls Render() on the render window. TBD: can we only set a QVTKRenderWindowInteractor ?

Reimplemented in ctkVTKRenderView.

◆ setMaximumUpdateRate

void ctkVTKAbstractView::setMaximumUpdateRate ( double  fps)
slot

Set maximum rate for rendering (in frames per second). If rendering is requested more frequently than this rate using scheduleRender, actual rendering will happen at this rate. This mechanism prevents repeated rendering caused by cluster of rendering requests.

If maximum update rate is set to 0 then it indicates that rendering is done next time the application is idle, i.e., pending timer events are processed. This option should be used with caution, as policy of timer event processing may differ between operating systems. Specifically, on macOS, timer events may be indefinitely delayed if user interface continuously generates events.

RenderWindow's DesiredUpdateRate property is intended for determining rendering quality settings, and is not suitable to be used as maximum update rate. The main reason is that VTK usually makes the rendering much faster and lower quality than DesiredUpdateRate would dictate, and so it would unnecessarily decrease the actual refresh rate.

By default maximum update rate is set to 60FPS, which allows smooth updates, while effectively suppressing repeated update requests (after a rendering has been completed, repeated rendering requests will be ignored for 17 milliseconds).

See also
scheduleRender

◆ setMultiSamples()

static void ctkVTKAbstractView::setMultiSamples ( int  )
static

Set the default number of multisamples to use. Note that a negative value means "auto", which means the renderer will attempt to select the maximum number (but is not guaranteed to work).

WARNING: Multisampling should be set before creation of the OpenGL context (e.g., initializing the rendering window) in order to have an effect. Consider using setMultisamples before instantiating ctkVTKAbstractView objects.

See also
multiSamples

◆ setRenderEnabled

void ctkVTKAbstractView::setRenderEnabled ( bool  value)
slot

Enable/Disable rendering.

◆ setRenderPaused

virtual int ctkVTKAbstractView::setRenderPaused ( bool  pause)
virtualslot

Calls pauseRender() if pause is true or resumeRender() if pause is false When pause render count is greater than 0, prevents requestRender() from calling forceRender() Callers are responsible for calling both setPauseRender(true) and setPauseRender(false) Ex.

view->pauseRender() // Or setPauseRender(true)
// Perform operations that may call view->scheduleRender().
view->resumeRender(); // Or setPauseRender(false)

If the pause render count reaches zero when calling resumeRender(), scheduleRender() will be called if a scheduleRender() was invoked while rendering was paused. Rendering can still be triggered while the paused with forceRender()

This behaviour is different from renderEnabled(), which will prevent all rendering calls from both scheduleRender() and forceRender(), and will not invoke either when re-enabled.

See also
renderEnabled

◆ setUseDepthPeeling

void ctkVTKAbstractView::setUseDepthPeeling ( bool  use)
slot

Set the useDepthPeeling property value.

See also
useDepthPeeling

◆ sizeHint()

virtual QSize ctkVTKAbstractView::sizeHint ( ) const
virtual

◆ updateFPS

void ctkVTKAbstractView::updateFPS ( )
protectedslot

◆ useDepthPeeling()

bool ctkVTKAbstractView::useDepthPeeling ( ) const

Returns true if depth peeling is enabled.

See also
setUseDepthPeeling

◆ VTKWidget()

Q_INVOKABLE ctkVTKOpenGLNativeWidget* ctkVTKAbstractView::VTKWidget ( ) const

Get the underlying QVTKWidget.

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkVTKAbstractViewPrivate> ctkVTKAbstractView::d_ptr
protected

Definition at line 234 of file ctkVTKAbstractView.h.

Property Documentation

◆ backgroundColor

QColor ctkVTKAbstractView::backgroundColor
readwrite

Definition at line 42 of file ctkVTKAbstractView.h.

◆ backgroundColor2

QColor ctkVTKAbstractView::backgroundColor2
readwrite

Definition at line 42 of file ctkVTKAbstractView.h.

◆ cornerAnnotationText

QVTK_OBJECTQString ctkVTKAbstractView::cornerAnnotationText
readwrite

Definition at line 42 of file ctkVTKAbstractView.h.

◆ fpsVisible

bool ctkVTKAbstractView::fpsVisible
readwrite

This property controls whether a corner annotation is visible with the last frames per second (FPS) value. false by default.

Definition at line 42 of file ctkVTKAbstractView.h.

◆ gradientBackground

bool ctkVTKAbstractView::gradientBackground
readwrite

Definition at line 42 of file ctkVTKAbstractView.h.

◆ maximumUpdateRate

double ctkVTKAbstractView::maximumUpdateRate
readwrite

Set a maximum rate (in frames per second) for rendering.

Definition at line 42 of file ctkVTKAbstractView.h.

◆ renderEnabled

bool ctkVTKAbstractView::renderEnabled
readwrite

Definition at line 42 of file ctkVTKAbstractView.h.

◆ useDepthPeeling

bool ctkVTKAbstractView::useDepthPeeling
readwrite

This property controls whether the render window uses depth peeling or not. false by default.

Definition at line 42 of file ctkVTKAbstractView.h.


The documentation for this class was generated from the following file: