![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/GlSliceView.h>
OpenGL view for 2D slice rendering of one or multiple images and GlObjects. More...
OpenGL view for 2D slice rendering of one or multiple images and GlObjects.
GlSliceView employs a GlSlice instance for performing multi-planar reconstruction (MPR) rendering of 2D and 3D image data integrating the regular render scene based on registered GlObjects.
This renderer offers optional support for order-independent transparency (OIT) and will take care of setting up the OIT manager instance and blending the fragments. This feature is disabled by default and needs to be enabled explicitly. Note that OIT requires OpenGL 4.4. support by the host system, see GL::OrderIndependentTransparency for more details.
Public Member Functions | |
GlSliceView (Slice::AnatomicalPlane plane, std::unique_ptr< GlSlice > slice) | |
Constructor optionally providing a standard plane direction and custom GlSlice class. | |
GlSliceView (bool is3d, Slice::AnatomicalPlane plane=Slice::AnatomicalPlane::Undefined) | |
~GlSliceView () override | |
Destructor, deletes shader and working variables. | |
void | setMatrix (const mat4 &m) override |
Set matrix of the corresponding slice. | |
void | setFlip (bool flag) |
Use flipped representation of image axes. | |
bool | render () override |
Render the view. | |
void | reset () |
Reset settings to their default values. | |
Type | type () const override |
Return view type as 2D or 3D slice. | |
GlObject * | object () const |
Return the OpenGL slice of this view, implementing the base class method. | |
const GlSlice * | slice () const |
Return the OpenGL slice of this view. | |
GlSlice * | slice () |
Return the OpenGL slice of this view. | |
bool | flip () const |
Return the flip flag. | |
void | setScale (double scale) |
Set scale. | |
void | setZoom (double zoom) |
Set zoom. | |
void | setClipDistance (double val) |
Set the distance with which rendering on either side of the view is clipped. | |
void | setDefaultClipDistance () |
Set the average image spacing as default clipping distance. | |
void | setShowZoom (bool flag) |
Specify if the view zoom shall be shown on the slice itself (affecting other views) | |
void | setShowIntersectionLines (bool flag) |
Specify if the intersection lines with other slices shall be drawn. | |
void | alignToPixelGrid () |
Attempts to configure view matrix and zoom factor so that it can render a pixel-perfect version of imageData(). | |
void | setPixelZoom () |
Set zoom for a one-on-one pixel mapping on the screen. | |
bool | isPixelZoom () const |
Return true if we are already displaying content in pixel zoom. | |
double | scale () const |
Get scale. | |
double | optimalScale () const |
Compute the best scale to fit the current image into the view given a zoom factor of 1. | |
double | optimalZoom () const |
Compute the zoom to fit the current image into the view given the current scale. | |
double | zoom () const |
Get zoom. | |
bool | showZoom () const |
Return if the view zoom is shown on the slice. | |
bool | showIntersectionLines () const |
Return if the intersection lines with other slices are drawn. | |
void | resize (int width, int height) override |
Handle viewport resize. Called with valid OpenGL context. | |
Geometry::AlignedBox | sceneBounds () const |
Return axis-aligned bounding box of all annotations. | |
virtual std::string | typeName () const |
Slice::AnatomicalPlane | originalPlane () const |
Return the original designated plane (axial=0, sagittal=1, coronal=2) of this view. | |
mat4 | originalPlaneMatrix () const |
Return the original matrix of the original designated plane of this view. | |
bool | isOrderIndependentTransparencyEnabled () const |
Returns true if order-independent transparency support is enabled. | |
void | setOrderIndependentTransparencyEnabled (bool value) |
Specify whether order-independent transparency support should be enabled. | |
const GL::OrderIndependentTransparency * | orderIndependentTransparency () const override |
Returns the order-independent transparency handling object used by this view if supported and enabled. | |
![]() | |
virtual const mat4 & | matrix () const |
Returns the current view matrix (view coordinates to world coordinates). | |
int | height () const |
Current viewport height of the view. | |
int | width () const |
Current viewport width of the view. | |
void | addObject (GlObject *object) |
Add a reference to a GlObject to be drawn by this view. | |
void | removeObject (GlObject *object) |
Remove a reference to a GlObject drawn by this view. | |
const std::vector< GlObject * > & | objects () const |
Return the set of GlObjects that are drawn by this view. | |
const GL::ViewState & | state () const |
Return the view state that was set during the last render() call. | |
Protected Member Functions | |
void | applyExtent () |
Applies the slice extent, distinguishing if zoom/pan is shown. | |
![]() | |
GL::OrderIndependentTransparency * | sharedOitInstance () const |
Offers support for GlViews sharing GL::OrderIndependentTransparency instances to reduce GPU memory consumption. | |
Protected Attributes | |
std::unique_ptr< GlSlice > | m_slice |
Own OpenGL slice object. | |
bool | m_isOitEnabled = false |
Flag whether OIT support is enabled or not. | |
bool | m_oitWasRequested = false |
Flag whether OIT was actually requested so far (used to lazy-instantiate the A-buffer) | |
double | m_scale = 1.0 |
Scale. | |
double | m_zoom = 1.0 |
Zoom. | |
double | m_clipDistance = 0.5 |
Distance with which to clip on either side of the view. | |
bool | m_flip = true |
Use flipped representation of images axes where the image origin is in the top-left corner. | |
bool | m_showZoom = true |
Flag if the view zoom shall be applied on the slice. | |
bool | m_showIntersectionLines = true |
Flag if intersection lines with other slices are drawn. | |
Slice::AnatomicalPlane | m_originalPlane = Slice::AnatomicalPlane::Undefined |
Original MPR plane used on reset. | |
![]() | |
std::vector< GlObject * > | m_objects |
Other objects to consider during rendering. | |
mat4 | m_matrix = mat4::Identity() |
Matrix converting view coordinates to world coords (inverse of a traditional OpenGL view matrix) | |
GL::ViewState | m_state |
OpenGL state describing viewport, projection and model-view matrix of last render call. | |
int | m_width = 0 |
int | m_height = 0 |
Additional Inherited Members | |
![]() | |
enum | Type { SLICE2D = 0 , SLICE3D = 1 , SPACE3D = 2 , OTHER = 3 } |
Type of the view. More... | |
|
overridevirtual |
Set matrix of the corresponding slice.
Reimplemented from GlView.
|
inline |
Use flipped representation of image axes.
If this is set to true the image origin is considered to be in the top-left corner.
|
overridevirtual |
Render the view.
Implements GlView.
void alignToPixelGrid | ( | ) |
Attempts to configure view matrix and zoom factor so that it can render a pixel-perfect version of imageData().
Be aware that this is only possible if the spacing is isotropic and the image matrix does not have a rotational component.
|
overridevirtual |
Handle viewport resize. Called with valid OpenGL context.
Reimplemented from GlView.
|
overridevirtual |
Returns the order-independent transparency handling object used by this view if supported and enabled.
GlObjects can use this instance to support correct blending of their semi-transparent surfaces with the ones from the other GlObjects.
Reimplemented from GlView.