ImFusion SDK 4.3
VolumeView Class Reference

#include <ImFusion/GUI/VolumeView.h>

Volumetric 3D renderer for SharedImageSets that can be hosted inside a Display. More...

+ Inheritance diagram for VolumeView:

Detailed Description

Volumetric 3D renderer for SharedImageSets that can be hosted inside a Display.

This class wraps the GlVolumeView renderer that implements Direct Volume Rendering (DVR) of one or many 3D images with correct compositing and blending with any number of regular geometry-based GlObjects. It is mostly a wrapper object to combine the plain OpenGL renderer with input event handling functionality and put it into the a Display.

It comes with a VolumeViewDefaultEventHandler pre-installed so that it is ready to use directly after instantiation. Furthermore, it provides a couple of additional high-level member functions to configure the most important properties of the renderer.

See also
GlVolumeView, GlVolumeRenderer

Public Types

enum class  RenderMode {
  DRR , MIP , IsoSurface , UnshadedDVR ,
  PhongDVR , GlobalIllumDVR , Unknown
}
 Enumeration of built-in default render modes for image data, implemented by GlVolumeRendererBasic and GlVolumeRendererGlobalIllum. More...
 
enum class  ResetOptions { None = 0 , Everything = 0xFFFF , ViewMatrix = 1 << 0 , ClipPlane = 1 << 2 }
 Bitfield enumeration to specify what aspects of the view shall be reset.
 

Public Member Functions

 VolumeView (std::unique_ptr< GlVolumeView > glVolumeView=nullptr)
 Creates a new instance using the given GlVolumeView.
 
const GlVolumeViewglView () const
 Returns the underlying GlVolumeView.
 
GlVolumeViewglView ()
 
RadiologyViewGroupviewGroup () const
 Returns the optional RadiologyViewGroup this view can participate in.
 
const DisplayOptions3ddisplayOptions (const Data &data) const
 Returns the DisplayOptions3d instance that is used for the given dataset by the underlying GlVolumeRenderer.
 
DisplayOptions3ddisplayOptions (const Data &data)
 
VolumeViewDefaultEventHandlerdefaultEventHandler () const
 Convenience function to return the first interaction of type VolumeViewDefaultEventHandler if present.
 
RenderMode renderMode () const
 Returns the render mode of the underlying GlVolumeRenderer.
 
void setRenderMode (RenderMode value)
 Sets the render mode of the underlying GlVolumeRenderer.
 
const Cameracamera () const
 Returns the Camera of the underlying GlVolumeView defining view and projection matrix.
 
void setCamera (const Camera &camera, bool suppressAnimation=false)
 Sets Camera of underlying GlVolumeView using a smooth animation if enabled/unless suppressed.
 
void setMatrix (const mat4 &camToWorldMatrix, bool suppressAnimation=false)
 Set camera-to-world matrix of the underlying GlVolumeView using a smooth animation if enabled/unless suppressed.
 
void reset (Flags< ResetOptions > resetOptions=ResetOptions::Everything)
 Reset selected parameters of this view to their default state.
 
- Public Member Functions inherited from View
 View (std::unique_ptr< GlView > glView)
 Instantiate a new View using the given GlView as renderer; glView must not be null.
 
virtual void render ()
 Will render the view into the viewport() of the current framebuffer by drawing the optional background color, the optional border, the underlying GlView, and finally all overlays().
 
const GlViewglView () const
 Returns the underlying GlView.
 
GlViewglView ()
 Returns the underlying GlView.
 
virtual void setViewport (const GL::Viewport &rect)
 Sets the area where this view is drawn in render() wrt. the attached framebuffer.
 
const GL::Viewportviewport () const
 Returns the area where this view is drawn in render() wrt. the attached framebuffer.
 
bool isVisible () const
 Returns whether this view has a non-zero viewport and can therefore be considered visible.
 
std::optional< vec3 > backgroundColor () const
 Returns the optional background color used to clear the viewport before rendering anything.
 
void setBackgroundColor (std::optional< vec3 > value)
 Sets the optional background color used to clear the viewport before rendering anything.
 
const BorderConfigborderConfig () const
 Returns the BorderConfig struct defining if and how to render a border frame surrounding the view.
 
virtual void setBorderConfig (const BorderConfig &value)
 Sets the BorderConfig struct defining if and how to render a border frame surrounding the view.
 
bool showsOverlays () const
 Returns the flag whether to show overlays or not.
 
void setShowOverlays (bool value)
 Sets the flag whether to show overlays or not.
 
void setWatermark (const SharedImage &image)
 Sets a watermark image to be rendered on top of the view.
 
virtual EventResult handleInputEvent (const InputEvent &event)
 Called by the parent Display if a user input event has happened on this view.
 
void setDataDisplayDispatcher (std::shared_ptr< DataDisplayDispatcher > ddd)
 Sets a common DataDisplayDispatcher so that it can be shared across views.
 
const DataDisplayDispatcher * dataDisplayDispatcher () const
 Returns the DataDisplayDispatcher used by this view.
 
virtual bool acceptsData (const Data *data) const
 Returns whether this view is capable of displaying the given data.
 
void setVisibleData (const DataList &data)
 Set the data that should be shown in this view.
 
const DataListvisibleData () const
 Returns a list of the currently displayed data.
 
bool showData (Data *data)
 Appends the given Data instance to the list of visible data.
 
void hideData (const Data *data)
 Removes the given Data instance to the list of visible data.
 
void setEventHandlers (std::vector< std::unique_ptr< EventHandler > > eventHandlers)
 Replace all existing EventHandlers with the ones in eventHandlers.
 
void addEventHandler (std::unique_ptr< EventHandler > eventHandler, int where=-1)
 Add an EventHandler at the given position (default is at the end).
 
std::unique_ptr< EventHandlerremoveEventHandler (EventHandler *interaction)
 Delete the given interaction, if it exists. Note: This will make the pointer invalid.
 
std::vector< EventHandler * > eventHandlers () const
 Returns all view interactions of this view.
 
template<typename T>
T * findEventHandler () const
 Returns the first EventHandler that dynamic_casts to T, or nullptr if no such EventHandler exists.
 
void addOverlay (std::unique_ptr< ViewOverlay > overlay, ViewOverlay::Anchor anchor, int position=-1)
 Inserts overlay into the list of overlays of this view at position of the given anchor.
 
virtual std::unique_ptr< ViewOverlayremoveOverlay (ViewOverlay *overlay)
 Remove a previously added overlay from this view again.
 
std::vector< ViewOverlay * > overlays () const
 Returns all InteractiveOverlays of this view.
 
void setOverlayAnchor (ViewOverlay *overlay, ViewOverlay::Anchor anchor)
 Set the anchor point to use for the given overlay.
 
void setOverlayLayoutDirection (ViewOverlay::Anchor anchor, ViewOverlay::LayoutDirection direction)
 Sets in which direction multiple overlays at one anchor are laid out.
 
virtual void addObject (ViewObject *object)
 Will add the underlying GlObject to the GlView and register the event handler.
 
virtual void removeObject (ViewObject *object)
 Remove the given ViewObject from this view.
 
std::vector< ViewObject * > objects () const
 Returns all ViewObjects of this view.
 
const GlViewview () const
 
GlViewview ()
 Return associated GlView object.
 
- Public Member Functions inherited from Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
 
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Public Attributes

Signal< Flags< ResetOptions > > signalResetted
 Emitted when reset() was called.
 
- Public Attributes inherited from View
Signal signalUpdateRequested
 Emitted when this view or one of its overlays has become outdated and needs to be re-rendered.
 
Signal< const DataList &, const DataList & > signalVisibleDataChanged
 Emitted when visibleData() has changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Protected Attributes

GlVolumeViewm_glVolumeView
 
RadiologyViewGroupm_viewGroup = nullptr
 
- Protected Attributes inherited from View
std::unique_ptr< GlViewm_glView
 
std::unique_ptr< ViewOverlayLayouter > m_overlayLayouter
 
std::vector< std::unique_ptr< EventHandler > > m_eventHandlers
 
std::vector< std::unique_ptr< ViewOverlay > > m_overlays
 
std::vector< ViewObject * > m_objects
 
DataList m_visibleData
 
GL::Viewport m_viewport
 
const void * m_mouseEventFocusObject = nullptr
 Pointer to the event receiver that shall receive MouseEvent::Type::Move events exclusively.
 
const void * m_touchEventFocusObject = nullptr
 Pointer to the event receiver that shall receive TouchEvent::Type::Update events exclusively.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Additional Inherited Members

- Protected Member Functions inherited from View
virtual EventResult dispatchToViewOverlays (const InputEvent &event)
 Dispatch event to all known ViewOverlays considering m_mouseEventFocusObject and m_touchEventFocusObject.
 
virtual EventResult dispatchToViewObjects (const InputEvent &event)
 Dispatch event to all known ViewObjects considering m_mouseEventFocusObject and m_touchEventFocusObject.
 
virtual EventResult dispatchToViewEventHandlers (const InputEvent &event)
 Dispatch event to all known View::EventHandlers considering m_mouseEventFocusObject and m_touchEventFocusObject.
 
void updateEventFocus (const InputEvent &event, const void *newTarget)
 Update the internal bookkeeping of "focus" event handlers:
 
bool filterEventFocus (const InputEvent &event, const void *target) const
 Checks if the object target should receive the given event based on the event type and current "focus" object.
 
virtual void showDataImpl (Data *data)
 Override this function to implement custom logic whenever a dataset is added to the list of visible data.
 
virtual void hideDataImpl (const Data *data)
 Override this function to implement custom logic whenever a dataset is removed from the list of visible data.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 

Member Enumeration Documentation

◆ RenderMode

enum class RenderMode
strong

Enumeration of built-in default render modes for image data, implemented by GlVolumeRendererBasic and GlVolumeRendererGlobalIllum.

Enumerator
DRR 

Digitally reconstructed radiograph.

MIP 

Maximum intensity projection.

IsoSurface 

Iso-surface rendering.

UnshadedDVR 

Direct Volume Rendering without any shading.

PhongDVR 

Direct Volume Rendering with local Phong shading.

GlobalIllumDVR 

Direct Volume Rendering with global illumination shading.

Unknown 

Unknown render mode (e.g. a custom renderer)

Constructor & Destructor Documentation

◆ VolumeView()

VolumeView ( std::unique_ptr< GlVolumeView > glVolumeView = nullptr)
explicit

Creates a new instance using the given GlVolumeView.

If glVolumeView is null it will use a default-constructed one. Furthermore, the constructor will add a VolumeViewDefaultEventHandler.

Member Function Documentation

◆ displayOptions()

const DisplayOptions3d * displayOptions ( const Data & data) const

Returns the DisplayOptions3d instance that is used for the given dataset by the underlying GlVolumeRenderer.

Returns nullptr in case data is not part of glView().vr()->data().

◆ setMatrix()

void setMatrix ( const mat4 & camToWorldMatrix,
bool suppressAnimation = false )

Set camera-to-world matrix of the underlying GlVolumeView using a smooth animation if enabled/unless suppressed.

This function has the same effect as calling setCamera() with the inverse of camToWorldMatrix as camera pose.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close