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

A VL representation of a mitk::DataNode for rendering purposes. More...

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

Public Member Functions

 VLMapper (const mitk::DataNode *node, VLSceneView *sv)
 
virtual ~VLMapper ()
 
virtual bool init ()=0
 
virtual void update ()=0
 
virtual void remove ()
 
void updateCommon ()
 
vl::Actor * actor ()
 
const vl::Actor * actor () const
 
void setDataNodeVividUpdateEnabled (bool enable)
 
bool isDataNodeVividUpdateEnabled () const
 
void setRenderingMode (vl::Vivid::ERenderingMode mode)
 
vl::Vivid::ERenderingMode renderingMode () const
 
void setOutlineColor (const vl::vec4 &color)
 
vl::vec4 outlineColor () const
 
void setOutlineWidth (float width)
 
float outlineWidth () const
 
void setOutlineSlicePlane (const vl::vec4 &plane)
 
vl::vec4 outlineSlicePlane () const
 
void setIsStencil (bool is_stencil)
 
bool isStencil () const
 
void setLightingEnabled (bool enable)
 
int isLightingEnabled () const
 
void setMaterialDiffuseRGBA (const vl::vec4 &rgba)
 
const vl::vec4 & materialDiffuseRGBA () const
 
void setMaterialSpecularColor (const vl::vec4 &color)
 
const vl::vec4 & materialSpecularColor () const
 
void setMaterialSpecularShininess (float shininess)
 
float materialSpecularShininess () const
 
void setTextureMappingEnabled (bool enable)
 
bool isTextureMappingEnabled () const
 
void setTexture (vl::Texture *tex)
 
vl::Texture * texture ()
 
const vl::Texture * texture () const
 
void setPointSpriteEnabled (bool enable)
 
bool isPointSpriteEnabled () const
 
vl::PointSize * pointSize ()
 
const vl::PointSize * pointSize () const
 
vl::PolygonMode * polygonMode ()
 
const vl::PolygonMode * polygonMode () const
 
void setFogMode (vl::Vivid::EFogMode mode)
 
vl::Vivid::EFogMode fogMode () const
 
void setFogTarget (vl::Vivid::ESmartTarget target)
 
vl::Vivid::ESmartTarget fogTarget () const
 
void setFogColor (const vl::vec4 &color)
 
const vl::vec4 & fogColor () const
 
void setFogStart (float start)
 
float fogStart () const
 
void setFogEnd (float end)
 
float fogEnd () const
 
void setFogDensity (float density)
 
float fogDensity () const
 
void setClipMode (int i, vl::Vivid::EClipMode mode)
 
vl::Vivid::EClipMode clipMode (int i) const
 
void setClipTarget (int i, vl::Vivid::ESmartTarget target)
 
vl::Vivid::ESmartTarget clipTarget (int i) const
 
void setClipFadeRange (int i, float fadeRange)
 
float clipFadeRange (int i) const
 
void setClipColor (int i, const vl::vec4 &color)
 
vl::vec4 clipColor (int i) const
 
void setClipPlane (int i, const vl::vec4 &plane)
 
vl::vec4 clipPlane (int i) const
 
void setClipSphere (int i, const vl::vec4 &sphere)
 
vl::vec4 clipSphere (int i) const
 
void setClipBoxMin (int i, const vl::vec3 &boxMin)
 
vl::vec3 clipBoxMin (int i) const
 
void setClipBoxMax (int i, const vl::vec3 &boxMax)
 
vl::vec3 clipBoxMax (int i) const
 
void setClipReverse (int i, bool reverse)
 
bool clipReverse (int i) const
 

Static Public Member Functions

static vl::ref< VLMappercreate (const mitk::DataNode *node, VLSceneView *)
 

Protected Member Functions

vl::ref< vl::Actor > initActor (vl::Geometry *geom, vl::Effect *fx=NULL, vl::Transform *tr=NULL)
 

Protected Attributes

vl::OpenGLContext * m_OpenGLContext
 
vl::VividRendering * m_VividRendering
 
mitk::DataStorage * m_DataStorage
 
VLSceneViewm_VLSceneView
 
const mitk::DataNode * m_DataNode
 
vl::ref< vl::Actor > m_Actor
 
bool m_DataNodeVividUpdateEnabled
 

Detailed Description

A VL representation of a mitk::DataNode for rendering purposes.

The niftk::VLSceneView class keeps a map of mitk::DataNode -> niftk::VLMapper according to the events it receives from the data storage. Overall when a new data node is added to the store a new VLMapper is created and its init() and update() methods called. When a data node is removed its VLMapper is also removed after calling its VLMapper::remove() method which cleans up the VL rendering related bits. When a data node is updated its relative VLMapper::update() method is called. VLMapper keeps an internal pointer to the tracked mitk::DataNode so that on update() it can fetch all its values and update accordingly.

Constructor & Destructor Documentation

niftk::VLMapper::VLMapper ( const mitk::DataNode *  node,
VLSceneView sv 
)
virtual niftk::VLMapper::~VLMapper ( )
inlinevirtual

When a VLMapper is destroyed its remove() method must have been called by the VLSceneView.

Member Function Documentation

vl::Actor* niftk::VLMapper::actor ( )
inline

Returns the default vl::Actor associated with this VLMapper used by those VLMappers that map a data node to a single vl::Actor. Note: more complex VLMappers may not use the default Actor and instantiate their own ones.

const vl::Actor* niftk::VLMapper::actor ( ) const
inline
vl::vec3 niftk::VLMapper::clipBoxMax ( int  i) const
inline
vl::vec3 niftk::VLMapper::clipBoxMin ( int  i) const
inline
vl::vec4 niftk::VLMapper::clipColor ( int  i) const
inline
float niftk::VLMapper::clipFadeRange ( int  i) const
inline
vl::Vivid::EClipMode niftk::VLMapper::clipMode ( int  i) const
inline
vl::vec4 niftk::VLMapper::clipPlane ( int  i) const
inline
bool niftk::VLMapper::clipReverse ( int  i) const
inline
vl::vec4 niftk::VLMapper::clipSphere ( int  i) const
inline
vl::Vivid::ESmartTarget niftk::VLMapper::clipTarget ( int  i) const
inline
vl::ref< VLMapper > niftk::VLMapper::create ( const mitk::DataNode *  node,
VLSceneView sv 
)
static

Used by niftk::VLSceneview to create the appropriate niftk::VLMapper given a mitk::DataNode.

const vl::vec4& niftk::VLMapper::fogColor ( ) const
inline
float niftk::VLMapper::fogDensity ( ) const
inline
float niftk::VLMapper::fogEnd ( ) const
inline
vl::Vivid::EFogMode niftk::VLMapper::fogMode ( ) const
inline
float niftk::VLMapper::fogStart ( ) const
inline
vl::Vivid::ESmartTarget niftk::VLMapper::fogTarget ( ) const
inline
virtual bool niftk::VLMapper::init ( )
pure virtual

Initializes all the relevant VL data structures, uniforms etc. according to the node's settings.

Implemented in niftk::VLMapperPoints, niftk::VLMapperCoordinateAxes, niftk::VLMapper3DImage, niftk::VLMapper2DImage, niftk::VLMapperSurface, and niftk::VLMapperVLGlobalSettings.

vl::ref< vl::Actor > niftk::VLMapper::initActor ( vl::Geometry *  geom,
vl::Effect *  fx = NULL,
vl::Transform *  tr = NULL 
)
protected
bool niftk::VLMapper::isDataNodeVividUpdateEnabled ( ) const
inline
int niftk::VLMapper::isLightingEnabled ( ) const
inline
bool niftk::VLMapper::isPointSpriteEnabled ( ) const
inline
bool niftk::VLMapper::isStencil ( ) const
inline
bool niftk::VLMapper::isTextureMappingEnabled ( ) const
inline
const vl::vec4& niftk::VLMapper::materialDiffuseRGBA ( ) const
inline
const vl::vec4& niftk::VLMapper::materialSpecularColor ( ) const
inline
float niftk::VLMapper::materialSpecularShininess ( ) const
inline
vl::vec4 niftk::VLMapper::outlineColor ( ) const
inline
vl::vec4 niftk::VLMapper::outlineSlicePlane ( ) const
inline
float niftk::VLMapper::outlineWidth ( ) const
inline
vl::PointSize* niftk::VLMapper::pointSize ( )
inline

The size in pixels of the point or point sprites being rendered.

const vl::PointSize* niftk::VLMapper::pointSize ( ) const
inline
vl::PolygonMode* niftk::VLMapper::polygonMode ( )
inline

Useful to render surfaces, boxes etc. in wireframe.

const vl::PolygonMode* niftk::VLMapper::polygonMode ( ) const
inline
virtual void niftk::VLMapper::remove ( )
inlinevirtual

Removes all the relevant Actor(s) from the scene.

Reimplemented in niftk::VLMapperPoints.

vl::Vivid::ERenderingMode niftk::VLMapper::renderingMode ( ) const
inline
void niftk::VLMapper::setClipBoxMax ( int  i,
const vl::vec3 &  boxMax 
)
inline

The max corner of the box used for clipping when clipping mode == box (world coords).

void niftk::VLMapper::setClipBoxMin ( int  i,
const vl::vec3 &  boxMin 
)
inline

The min corner of the box used for clipping when clipping mode == box (world coords).

void niftk::VLMapper::setClipColor ( int  i,
const vl::vec4 &  color 
)
inline

The color to use when target == color.

void niftk::VLMapper::setClipFadeRange ( int  i,
float  fadeRange 
)
inline

The fuzzyness of the clipping in pixels.

void niftk::VLMapper::setClipMode ( int  i,
vl::Vivid::EClipMode  mode 
)
inline

Enable/disable clipping unit and sets clipping mode. We can have up to 4 "clipping units" active (i parameter). Each clipping unit can be independently enabled with its clipping mode:

  • Plane: clipping is performed according to the clipPlane() equation (world space).
  • Sphere: clipping is performed according to the clipSphere() settings (world space).
  • Box: clipping is performed according to the clipBoxMin/Max() settings (world space). We can target: color, alpha and saturation -> setClipTarget() We can have soft clipping: setClipFadeRange() We can reverse the clipping effect: setClipReverse(), by default the negative/outside space is the one "clipped".
void niftk::VLMapper::setClipPlane ( int  i,
const vl::vec4 &  plane 
)
inline

The plane equation used for clipping when clipping mode == plane (world coords).

void niftk::VLMapper::setClipReverse ( int  i,
bool  reverse 
)
inline

Reverse the clipping effect "inside-out".

void niftk::VLMapper::setClipSphere ( int  i,
const vl::vec4 &  sphere 
)
inline

The sphere equation used for clipping when clipping mode == sphere (world coords).

void niftk::VLMapper::setClipTarget ( int  i,
vl::Vivid::ESmartTarget  target 
)
inline

The clipping target: color, alpha, saturation.

void niftk::VLMapper::setDataNodeVividUpdateEnabled ( bool  enable)
inline

When enabled (default) the mapper will reflect updates to the VL.* variables coming from the DataNode. Enable this when you want a data node to have its settings update all VLWidgets/VLSceneViews. Disable this when you want a data node to have different settings across different VLWidgets/VLSceneViews. Updates to the "visible" property are also ignored while updates to the transform are never ignored. At the moment this only applies to VLMapperSurface, VLMapper2DImage, VLMapperCUDAImage.

void niftk::VLMapper::setFogColor ( const vl::vec4 &  color)
inline

The fog color as per standard OpenGL.

void niftk::VLMapper::setFogDensity ( float  density)
inline

The fog density in camera coordinates as per standard OpenGL (only used if mode == exp or exp2)

void niftk::VLMapper::setFogEnd ( float  end)
inline

The fog end in camera coordinates as per standard OpenGL (only used if mode == linear)

void niftk::VLMapper::setFogMode ( vl::Vivid::EFogMode  mode)
inline

Enable/disable fogging and sets linear, exp or exp2 mode. Fog behaves just like in standard OpenGL (see red book for settings) except that instead of just targeting the color we can target also alpha and saturation.

void niftk::VLMapper::setFogStart ( float  start)
inline

The fog start in camera coordinates as per standard OpenGL (only used if mode == linear)

void niftk::VLMapper::setFogTarget ( vl::Vivid::ESmartTarget  target)
inline

The fog target: color, alpha, saturation.

void niftk::VLMapper::setIsStencil ( bool  is_stencil)
inline

Use this VLMapper's Actor as stencil when VLSceneView->isStencilEnabled() == true.

void niftk::VLMapper::setLightingEnabled ( bool  enable)
inline

Enable/disable ligthing. When lighting is enabled:

  • the vertex color is computed using the material properties below and the default light following the camera.
  • the object opacity is determined by its diffuse alpha value. When lighting is disabled:
  • the vertex color is computed using the Actor's Geometry's colorArray() (required)
  • the object opacity is determined on a per-vertex basis according to the Actor's Geometry's colorArray()
void niftk::VLMapper::setMaterialDiffuseRGBA ( const vl::vec4 &  rgba)
inline

The diffuse color and opacity of this object.

void niftk::VLMapper::setMaterialSpecularColor ( const vl::vec4 &  color)
inline

The specular color of this object.

void niftk::VLMapper::setMaterialSpecularShininess ( float  shininess)
inline

The specular shininess of this object as defined by OpenGL.

void niftk::VLMapper::setOutlineColor ( const vl::vec4 &  color)
inline

The ouline color and transparency.

void niftk::VLMapper::setOutlineSlicePlane ( const vl::vec4 &  plane)
inline

The plane equation to be used when rendering mode slicing mode is enabled.

void niftk::VLMapper::setOutlineWidth ( float  width)
inline

The outline width in pixels (approximately).

void niftk::VLMapper::setPointSpriteEnabled ( bool  enable)
inline

Enable/disable point sprites rendering (requires isTextureMappingEnabled() == true) This makes sense only if the VLMapper is rendering points using vl::PT_POINTS.

See also
pointSize()
void niftk::VLMapper::setRenderingMode ( vl::Vivid::ERenderingMode  mode)
inline

Whether a surface is rendered with polygons, 3D outline, 2D outline or an outline-slice through a plane. 3D outlines & slice mode:

  • computed on the GPU by a geometry shader
  • are clipped by the stencil
  • interact with the depth buffer (ie they're visible only if they're in front of other objects)
  • include creases inside the silhouette regardless of whether they're facing or not the viewer 2D outlines:
  • computed using offscreen image based edge detection
  • are not clipped against the stencil
  • do not interact with depth buffer (ie they're always in front of any geometry)
  • look cleaner, renders only the external silhouette of an object
void niftk::VLMapper::setTexture ( vl::Texture *  tex)
inline

The 2D texture to be used when rendering this object. The specific texture coordinates used depend on the VLMapper subclass.

void niftk::VLMapper::setTextureMappingEnabled ( bool  enable)
inline

Enable/disable texture mapping for this object.

vl::Texture* niftk::VLMapper::texture ( )
inline
const vl::Texture* niftk::VLMapper::texture ( ) const
inline
virtual void niftk::VLMapper::update ( )
pure virtual

Updates all the relevant VL data structures, uniforms etc. according to the node's settings.

Implemented in niftk::VLMapperPoints, niftk::VLMapperCoordinateAxes, niftk::VLMapper3DImage, niftk::VLMapper2DImage, niftk::VLMapperSurface, and niftk::VLMapperVLGlobalSettings.

void niftk::VLMapper::updateCommon ( )

Utility function to update the default niftk::VLMapper::actor()'s visibility and transform. Note that not all VLMappers use the default Actor.

Member Data Documentation

vl::ref<vl::Actor> niftk::VLMapper::m_Actor
protected
const mitk::DataNode* niftk::VLMapper::m_DataNode
protected
bool niftk::VLMapper::m_DataNodeVividUpdateEnabled
protected
mitk::DataStorage* niftk::VLMapper::m_DataStorage
protected
vl::OpenGLContext* niftk::VLMapper::m_OpenGLContext
protected
vl::VividRendering* niftk::VLMapper::m_VividRendering
protected
VLSceneView* niftk::VLMapper::m_VLSceneView
protected

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