NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
niftk::VLSceneView Class Reference

A vl::UIEventListener bound to a QGLWidget (niftk::VLWidget) managing all VL/Vivid rendering and options and listening to mitk::DataStorage events. More...

Inheritance diagram for niftk::VLSceneView:
Inheritance graph
[legend]
Collaboration diagram for niftk::VLSceneView:
Collaboration graph
[legend]

Public Types

typedef std::map
< mitk::DataNode::ConstPointer,
vl::ref< VLMapper > > 
DataNodeVLMapperMapType
 

Public Member Functions

 VLSceneView (VLWidget *vlwidget)
 
 ~VLSceneView ()
 
void setDataStorage (mitk::DataStorage *ds)
 
bool setCameraTrackingNode (const mitk::DataNode *node)
 
void setEyeHandFileName (const std::string &fileName)
 
bool setBackgroundNode (const mitk::DataNode *node)
 
void setRenderingMode (vl::Vivid::ERenderingMode)
 
vl::Vivid::ERenderingMode renderingMode () const
 
void setBackgroundColor (float r, float g, float b)
 
vl::vec3 backgroundColor () const
 
void setStencilEnabled (bool enabled)
 
bool isStencilEnabled () const
 
void setStencilBackgroundColor (const vl::vec4 &color)
 
const vl::vec4 & stencilBackgroundColor () const
 
void setStencilSmoothness (float smoothness)
 
float stencilSmoothness () const
 
void setOpacity (float opacity)
 
float opacity () const
 
void setDepthPeelingPasses (int n)
 
int depthPeelingPasses () const
 
void reInit (const vl::vec3 &dir=vl::vec3(0, 0, 1), const vl::vec3 &up=vl::vec3(0, 1, 0), float bias=1.0f)
 
void globalReInit (const vl::vec3 &dir=vl::vec3(0, 0, 1), const vl::vec3 &up=vl::vec3(0, 1, 0), float bias=1.0f)
 
vl::VividRendering * vividRendering ()
 
const vl::VividRendering * vividRendering () const
 
niftk::VLTrackballManipulatortrackball ()
 
const
niftk::VLTrackballManipulator
trackball () const
 
vl::CalibratedCamera * camera ()
 
const vl::CalibratedCamera * camera () const
 
mitk::DataStorage * dataStorage ()
 
const mitk::DataStorage * dataStorage () const
 
void scheduleSceneRebuild ()
 

Protected Member Functions

void initSceneFromDataStorage ()
 
void clearScene ()
 
void updateScene ()
 
void renderScene ()
 
void addDataStorageListeners ()
 
void removeDataStorageListeners ()
 
void scheduleTrackballAdjustView (bool schedule=true)
 
void scheduleNodeAdd (const mitk::DataNode *node)
 Schedules an addDataNode() at the next rendering. More...
 
void scheduleNodeRemove (const mitk::DataNode *node)
 Schedules a removeDataNode() at the next rendering. More...
 
void scheduleNodeUpdate (const mitk::DataNode *node)
 Schedules an updateDataNode() at the next rendering. More...
 
void addDataNode (const mitk::DataNode *node)
 Adds to the scene a VLMapper subclass representing the given DataNode. More...
 
void removeDataNode (const mitk::DataNode *node)
 Removes from the scene the VLMapper subclass representing the given DataNode. More...
 
void updateDataNode (const mitk::DataNode *node)
 Updates the VLMapper subclass representing the given DataNode. More...
 
void updateCameraParameters ()
 Updates the camera position, projection and viewport. More...
 
VLMappergetVLMapper (const mitk::DataNode *node)
 Returns the VLMapper associated to the given DataNode. More...
 
virtual void initEvent ()
 
virtual void resizeEvent (int width, int height)
 
virtual void updateEvent ()
 
virtual void destroyEvent ()
 
virtual void addedListenerEvent (vl::OpenGLContext *)
 
virtual void removedListenerEvent (vl::OpenGLContext *)
 
virtual void enableEvent (bool)
 
virtual void visibilityEvent (bool)
 
virtual void mouseMoveEvent (int, int)
 
virtual void mouseUpEvent (vl::EMouseButton, int, int)
 
virtual void mouseDownEvent (vl::EMouseButton, int, int)
 
virtual void mouseWheelEvent (int)
 
virtual void keyPressEvent (unsigned short, vl::EKey)
 
virtual void keyReleaseEvent (unsigned short, vl::EKey)
 
virtual void fileDroppedEvent (const std::vector< vl::String > &)
 

Protected Attributes

VLWidgetm_VLWidget
 
vl::ref< vl::VividRendering > m_VividRendering
 
vl::ref< vl::VividRenderer > m_VividRenderer
 
vl::ref
< vl::SceneManagerActorTree > 
m_SceneManager
 
vl::ref< vl::CalibratedCamera > m_Camera
 
vl::ref
< niftk::VLTrackballManipulator
m_Trackball
 
mitk::DataStorage::Pointer m_DataStorage
 
DataNodePropertyListener::Pointer m_NodeVisibilityListener
 
DataNodePropertyListener::Pointer m_NodeColorPropertyListener
 
DataNodePropertyListener::Pointer m_NodeOpacityPropertyListener
 
DataNodeVLMapperMapType m_DataNodeVLMapperMap
 
std::set
< mitk::DataNode::ConstPointer > 
m_NodesToUpdate
 
std::set
< mitk::DataNode::ConstPointer > 
m_NodesToAdd
 
std::set
< mitk::DataNode::ConstPointer > 
m_NodesToRemove
 
mitk::DataNode::ConstPointer m_CameraNode
 
mitk::DataNode::ConstPointer m_BackgroundNode
 
mitk::Image::ConstPointer m_BackgroundImage
 
vl::mat4 m_EyeHandMatrix
 
bool m_ScheduleTrackballAdjustView
 
bool m_ScheduleInitScene
 
bool m_RenderingInProgressGuard
 

Detailed Description

A vl::UIEventListener bound to a QGLWidget (niftk::VLWidget) managing all VL/Vivid rendering and options and listening to mitk::DataStorage events.

"Vivid" is the short name of the rendering engine based on Visualization Library developed exclusively for NifTK (see vl::VividRendering, vl::VividRenderer, vl::VividVolume and relative GLSL shaders).

VLSceneView listens for the QGLWidget update, resize, mouse, keyboard events and updates the rendering accordingly also allowing for user interaction via trackball. It also listens for mitk::DataStorage events and updates the scene adding, removing and updating objects according to the state of the mitk::DataStorage.

VLSceneView keeps track of ievery mitk::DataNode added and uses a niftk::VLMapper sub-class to render it and update it's visual aspect. The mapping from mitk::DataNode to niftk::VLMapper is done in the factory method niftk::VLMapper::create().

Supported objects types:

Member Typedef Documentation

typedef std::map< mitk::DataNode::ConstPointer, vl::ref<VLMapper> > niftk::VLSceneView::DataNodeVLMapperMapType

Constructor & Destructor Documentation

niftk::VLSceneView::VLSceneView ( VLWidget vlwidget)
niftk::VLSceneView::~VLSceneView ( )

Member Function Documentation

void niftk::VLSceneView::addDataNode ( const mitk::DataNode *  node)
protected

Adds to the scene a VLMapper subclass representing the given DataNode.

void niftk::VLSceneView::addDataStorageListeners ( )
protected
virtual void niftk::VLSceneView::addedListenerEvent ( vl::OpenGLContext *  )
inlineprotectedvirtual
vl::vec3 niftk::VLSceneView::backgroundColor ( ) const
vl::CalibratedCamera* niftk::VLSceneView::camera ( )
inline

Returns the underlying vl::CalibratedCamera, usually you don't need to touch this.

const vl::CalibratedCamera* niftk::VLSceneView::camera ( ) const
inline
void niftk::VLSceneView::clearScene ( )
protected
mitk::DataStorage* niftk::VLSceneView::dataStorage ( )
inline

Returns the underlying mitk::DataStorage, usually you don't need to touch this.

const mitk::DataStorage* niftk::VLSceneView::dataStorage ( ) const
inline
int niftk::VLSceneView::depthPeelingPasses ( ) const
void niftk::VLSceneView::destroyEvent ( )
protectedvirtual
virtual void niftk::VLSceneView::enableEvent ( bool  )
inlineprotectedvirtual
virtual void niftk::VLSceneView::fileDroppedEvent ( const std::vector< vl::String > &  )
inlineprotectedvirtual
VLMapper * niftk::VLSceneView::getVLMapper ( const mitk::DataNode *  node)
protected

Returns the VLMapper associated to the given DataNode.

void niftk::VLSceneView::globalReInit ( const vl::vec3 &  dir = vl::vec3(0,0,1),
const vl::vec3 &  up = vl::vec3(0,1,0),
float  bias = 1.0f 
)

Positions the camera for optimal scene visibility.

void niftk::VLSceneView::initEvent ( )
protectedvirtual
void niftk::VLSceneView::initSceneFromDataStorage ( )
protected
bool niftk::VLSceneView::isStencilEnabled ( ) const
virtual void niftk::VLSceneView::keyPressEvent ( unsigned  short,
vl::EKey   
)
inlineprotectedvirtual
virtual void niftk::VLSceneView::keyReleaseEvent ( unsigned  short,
vl::EKey   
)
inlineprotectedvirtual
virtual void niftk::VLSceneView::mouseDownEvent ( vl::EMouseButton  ,
int  ,
int   
)
inlineprotectedvirtual
virtual void niftk::VLSceneView::mouseMoveEvent ( int  ,
int   
)
inlineprotectedvirtual
virtual void niftk::VLSceneView::mouseUpEvent ( vl::EMouseButton  ,
int  ,
int   
)
inlineprotectedvirtual
virtual void niftk::VLSceneView::mouseWheelEvent ( int  )
inlineprotectedvirtual
float niftk::VLSceneView::opacity ( ) const
void niftk::VLSceneView::reInit ( const vl::vec3 &  dir = vl::vec3(0,0,1),
const vl::vec3 &  up = vl::vec3(0,1,0),
float  bias = 1.0f 
)

Positions the camera for optimal visibility of the currently selected DataNode.

void niftk::VLSceneView::removeDataNode ( const mitk::DataNode *  node)
protected

Removes from the scene the VLMapper subclass representing the given DataNode.

void niftk::VLSceneView::removeDataStorageListeners ( )
protected
virtual void niftk::VLSceneView::removedListenerEvent ( vl::OpenGLContext *  )
inlineprotectedvirtual
vl::Vivid::ERenderingMode niftk::VLSceneView::renderingMode ( ) const
void niftk::VLSceneView::renderScene ( )
protected
void niftk::VLSceneView::resizeEvent ( int  width,
int  height 
)
protectedvirtual
void niftk::VLSceneView::scheduleNodeAdd ( const mitk::DataNode *  node)
protected

Schedules an addDataNode() at the next rendering.

void niftk::VLSceneView::scheduleNodeRemove ( const mitk::DataNode *  node)
protected

Schedules a removeDataNode() at the next rendering.

void niftk::VLSceneView::scheduleNodeUpdate ( const mitk::DataNode *  node)
protected

Schedules an updateDataNode() at the next rendering.

void niftk::VLSceneView::scheduleSceneRebuild ( )

Destroys the current scene and schedules a rebuild at the next rendering.

void niftk::VLSceneView::scheduleTrackballAdjustView ( bool  schedule = true)
protected
void niftk::VLSceneView::setBackgroundColor ( float  r,
float  g,
float  b 
)

The rendering background color.

bool niftk::VLSceneView::setBackgroundNode ( const mitk::DataNode *  node)

Sets a node containing an mitk::Image or niftk::CUDAImage to be used as background. Passing NULL will disable the background image.

bool niftk::VLSceneView::setCameraTrackingNode ( const mitk::DataNode *  node)

Sets the transform to be used to move the camera around. Passing NULL will disable camera tracking and enable the trackball.

void niftk::VLSceneView::setDataStorage ( mitk::DataStorage *  ds)

Sets the mitk::DataStorage to listen from. The scene will be destroyed and recreated and niftk::VLGlobalSettingsDataNode added if not present already.

void niftk::VLSceneView::setDepthPeelingPasses ( int  n)

The number of depth peeling passes to be done. The more passes the more transparency layers will be rendered and the slower the rendering. When vl::VividRendering::depthPeelingAutoThrottleEnabled() is false the rendering will always do N passes, else it will try to do only one pass if all objects are fully opaque and no fogging or clipping is using the alpha target.

void niftk::VLSceneView::setEyeHandFileName ( const std::string fileName)

Loads the file storing the eye-hand calibration matrix.

void niftk::VLSceneView::setOpacity ( float  opacity)

The opacity of the 3D rendering above the background. The background is always fully opaque.

void niftk::VLSceneView::setRenderingMode ( vl::Vivid::ERenderingMode  mode)

The rendering mode, mainly for debugging purposes.

void niftk::VLSceneView::setStencilBackgroundColor ( const vl::vec4 &  color)

Color of the stencil background.

void niftk::VLSceneView::setStencilEnabled ( bool  enabled)

Whether geometry stencil effect is enabled.

void niftk::VLSceneView::setStencilSmoothness ( float  smoothness)

Smoothness in pixels of the stencil background. Defines the size of the smoothing kernel so the bigger the slower the rendering.

const vl::vec4 & niftk::VLSceneView::stencilBackgroundColor ( ) const
float niftk::VLSceneView::stencilSmoothness ( ) const
niftk::VLTrackballManipulator* niftk::VLSceneView::trackball ( )
inline

Returns the underlying niftk::VLTrackballManipulator, usually you don't need to touch this.

const niftk::VLTrackballManipulator* niftk::VLSceneView::trackball ( ) const
inline
void niftk::VLSceneView::updateCameraParameters ( )
protected

Updates the camera position, projection and viewport.

void niftk::VLSceneView::updateDataNode ( const mitk::DataNode *  node)
protected

Updates the VLMapper subclass representing the given DataNode.

void niftk::VLSceneView::updateEvent ( )
protectedvirtual
void niftk::VLSceneView::updateScene ( )
protected
virtual void niftk::VLSceneView::visibilityEvent ( bool  )
inlineprotectedvirtual
vl::VividRendering* niftk::VLSceneView::vividRendering ( )
inline

Returns the underlying vl::VividRendering, usually you don't need to touch this.

const vl::VividRendering* niftk::VLSceneView::vividRendering ( ) const
inline

Member Data Documentation

mitk::Image::ConstPointer niftk::VLSceneView::m_BackgroundImage
protected
mitk::DataNode::ConstPointer niftk::VLSceneView::m_BackgroundNode
protected
vl::ref<vl::CalibratedCamera> niftk::VLSceneView::m_Camera
protected
mitk::DataNode::ConstPointer niftk::VLSceneView::m_CameraNode
protected
DataNodeVLMapperMapType niftk::VLSceneView::m_DataNodeVLMapperMap
protected
mitk::DataStorage::Pointer niftk::VLSceneView::m_DataStorage
protected
vl::mat4 niftk::VLSceneView::m_EyeHandMatrix
protected
DataNodePropertyListener::Pointer niftk::VLSceneView::m_NodeColorPropertyListener
protected
DataNodePropertyListener::Pointer niftk::VLSceneView::m_NodeOpacityPropertyListener
protected
std::set<mitk::DataNode::ConstPointer> niftk::VLSceneView::m_NodesToAdd
protected
std::set<mitk::DataNode::ConstPointer> niftk::VLSceneView::m_NodesToRemove
protected
std::set<mitk::DataNode::ConstPointer> niftk::VLSceneView::m_NodesToUpdate
protected
DataNodePropertyListener::Pointer niftk::VLSceneView::m_NodeVisibilityListener
protected
bool niftk::VLSceneView::m_RenderingInProgressGuard
protected
vl::ref<vl::SceneManagerActorTree> niftk::VLSceneView::m_SceneManager
protected
bool niftk::VLSceneView::m_ScheduleInitScene
protected
bool niftk::VLSceneView::m_ScheduleTrackballAdjustView
protected
vl::ref<niftk::VLTrackballManipulator> niftk::VLSceneView::m_Trackball
protected
vl::ref<vl::VividRenderer> niftk::VLSceneView::m_VividRenderer
protected
vl::ref<vl::VividRendering> niftk::VLSceneView::m_VividRendering
protected
VLWidget* niftk::VLSceneView::m_VLWidget
protected

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