![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/GlSlice.h>
Represents an MPR slice for rendering Data into 2D views. More...
Inheritance diagram for GlSlice:Represents an MPR slice for rendering Data into 2D views.
GlSlice will render MPRs of one or multiple Data instances. While the actual rendering of individual data is delegated to the GlSliceRenderer interface, GlSlice will take care of setting up the OpenGL context and blending the rendered images.
Furthermore, GlSlice can act as GlObject to render the extent (and optionally image content) of the MPR slice into other third-party views.
Classes | |
| struct | Renderbuffer |
| struct | RenderInfo |
| Structure storing information on how to render a data set. More... | |
Public Types | |
| enum class | BlendingMode { None = 0 , Default = 1 , Color = 2 , Checkerboard = 3 , DistanceToBorder = 4 , SingleColor = 5 , DualColor = 6 } |
| Enumeration of the blending modes available in GlSlice. More... | |
| enum class | ObjectRenderMode { Nothing = 0 , Border = 1 << 0 , ImageContent = 1 << 1 , Centerlines = 1 << 2 , Plane = 1 << 3 , Crosssection = 1 << 4 } |
| Enumeration for selecting what to render as GlObject. More... | |
| enum class | CrosssectionRenderMode { Nothing = 0 , Line = 1 << 1 , Thickness = 1 << 2 , OrientationMarkers = 1 << 3 , OrientationMarkersQuadrupedDefault = 1 << 4 } |
| Enumeration for selecting how to render the cross-section between this MPR and other MPR slice views. More... | |
Public Types inherited from GlObject | |
| enum | RenderingOrderGroup { RenderingGroupRest , RenderingGroupMesh , RenderingGroupManipulator } |
| Enumeration to determine rendering order of GlObjects in GlSliceView and GlVolumeView. More... | |
Public Member Functions | |
| GlSlice (bool is3D, const Slice &slice) | |
| Creates a new GlSlice instance. | |
| virtual bool | acceptsData (const Data *d) const |
| Returns whether this slice is capable of displaying the given data. | |
| virtual void | setData (const std::vector< std::pair< const Data *, const DisplayOptions2d * > > &data) |
| Sets the data that is to be rendered by this GlSlice. | |
| std::vector< std::pair< const Data *, const DisplayOptions2d * > > | data () const |
| Return the list of shown data paired with the DisplayOptions to use. | |
| SharedImageSet * | imageData () const |
| Returns the first SharedImageSet that is rendered by this GlSlice. | |
| virtual void | setSlice (const Slice &s) |
| Set a custom slice in 3D space. | |
| Slice | slice () const |
| Return the slice of this view. | |
| virtual bool | isMetric () const |
| Return whether displayed data is metric. | |
| void | setThickness (double val) |
| Set 3D MPR thickness. | |
| double | thickness () const |
| Get 3D MPR thickness. | |
| int | setNextSlice (int relative) |
| Jump to one of the next whole voxels before or behind the current slice imageData(). | |
| int | currentSlice () const |
| Return closest slice of imageData() to current position/view matrix. | |
| int | numSlices () const |
| Return the total number of slices of imageData() wrt. | |
| vec3 | center (const Data *data=nullptr) const |
| Returns the center in world coordinates of the given data. | |
| vec2 | extent () const |
| Returns slice extent based on the current image data. | |
| mat4 | defaultPose (const Data *data, Slice::AnatomicalPlane plane) const |
| Returns the default view matrix to use for showing the given dataset in a slice view of the given anatomical plane. | |
| void | setInterpolation (int mode) |
| Set the interpolation mode to nearest-neighbor (0), linear (1) or cubic (2) | |
| void | setColor (const vec3 &c) |
| Set the border color of the slice. | |
| void | draw (const GlView &view) override |
| Renders this GlSlice. | |
| int | interpolation () const |
| Return the interpolation mode. | |
| const vec3 & | color () const |
| Return the border color. | |
| virtual bool | is3D () const |
| Return if a 2D image or 3D MPR plane is shown. | |
| void | render (const GL::ViewState &viewState) const |
| Render the image content. | |
| bool | rendersFirstImageWithFullOpacity () const |
| Returns the flag whether to render the first image always with full opacity independent of its actual alpha channel. | |
| void | setRenderFirstImageWithFullOpacity (bool value) |
| Sets the flag whether to render the first image always with full opacity independent of its actual alpha channel. | |
| BlendingMode | blendingMode () const |
| Returns the blending mode to use. | |
| void | setBlendingMode (BlendingMode value) |
| Sets the blending mode to use. | |
| double | blendFactor () const |
| Returns the blending factor to be used in alpha blending mode. | |
| void | setBlendFactor (double value) |
| Sets the blending factor to be used in alpha blending mode. | |
| double | blendDistance () const |
| Returns the stitching overlap in pixels when using DistToBorder blending mode. | |
| void | setBlendDistance (double value) |
| Sets the stitching overlap in pixels when using DistToBorder blending mode. | |
| const std::pair< vec4, vec4 > & | blendingColors () const |
| Returns the primary and secondary tint color when using one of the color blending modes. | |
| void | setBlendingColors (const std::pair< vec4, vec4 > &value) |
| Sets the primary and secondary tint color when using one of the color blending modes. | |
| int | checkerboardFieldSize () const |
| Returns the field size in pixels when using BlendingMode::Checkerboard. | |
| void | setCheckerboardFieldSize (int value) |
| Sets the field size in pixels when using BlendingMode::Checkerboard. | |
| std::optional< vec2f > | customCheckerboardLocation () const |
| Returns the optional custom location in normalized [0..1]^2 space for a basic 2x2 checkerboard blending. | |
| void | setCustomCheckerboardLocation (std::optional< vec2f > value) |
| Sets the optional custom location in normalized [0..1]^2 space for a basic 2x2 checkerboard blending. | |
| Flags< ObjectRenderMode > | objectRenderMode () const |
| Return how the slice is shown when rendered as GlObject. | |
| void | setObjectRenderMode (Flags< ObjectRenderMode > renderMode) |
| Sets how the slice is shown when rendered as GlObject. | |
| void | setObjectRenderModeFlag (ObjectRenderMode renderModeFlag, bool value) |
| Sets a single flag of how the slice is shown when rendered as GlObject. | |
| Flags< CrosssectionRenderMode > | crosssectionRenderMode () const |
| Returns the what is shown when rendering the cross-section with other MPR views. | |
| void | setCrosssectionRenderMode (Flags< CrosssectionRenderMode > value) |
| Sets the what is shown when rendering the cross-section with other MPR views. | |
| void | setCrosssectionRenderModeFlag (CrosssectionRenderMode crosssectionModeFlag, bool value) |
| Sets a single flag of how the slice is shown when rendered as GlObject. | |
| bool | usesAlphaBlendingToParentFbo () const |
| Returns the flag whether to use alpha blending when rendering the result to the parent FBO, set to false to use existing custom blending configuration. | |
| void | setUseAlphaBlendingToParentFbo (bool value) |
| Sets the flag whether to use alpha blending when rendering the result to the parent FBO, set to false to use existing custom blending configuration. | |
| const std::vector< std::unique_ptr< GlSliceRenderer > > & | renderers () const |
| Return the list of all available renderers. | |
| void | setMatrix (const mat4 &m) override |
| Set the modelview matrix of this object. | |
| Geometry::AlignedBox | bounds () const override |
| Get the axis-aligned bounding box of this GlObject in world space. | |
| std::string | typeName () const override |
| Return unique identifier for this object class used for serialization. | |
| GlSliceRendererImage & | defaultRenderer () const |
| Return reference to the default renderer. | |
| std::vector< GlSliceRenderer * > | activeRenderers () const |
| Return the list of all renderers that are used to render the currently set Data. | |
Public Member Functions inherited from GlObject | |
| virtual Geometry::AlignedBox | boundsSpherical () const |
| Get the spherical bounds of this GlObject in world space. | |
| virtual const mat4 & | matrix () const |
| Return the modelview matrix. | |
| virtual void | setVisible (bool visible) |
| Set object visibility. | |
| virtual bool | visible () const |
| Return object visibility. | |
| virtual void | setAlwaysVisible (bool alwaysVisible) |
| Set if object is always visible. | |
| virtual bool | alwaysVisible () const |
| Return if object is always visible. | |
| RenderingOrderGroup | renderingOrder () const |
| Return current rendering order value for this GlObject. | |
| void | setRenderingOrder (RenderingOrderGroup group) |
| Set rendering order value for this GlObject. | |
| void | setDraw3DIn2DView (bool draw3DIn2DView) |
| void | configure (const Properties *p) override |
| Configure this object instance by de-serializing the given Properties. | |
| void | configuration (Properties *p) const override |
| Serialize the current object configuration into the given Properties object. | |
Public Member Functions inherited from Configurable | |
| 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 | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Public Attributes | |
| Signal< GlSlice * > | signalSliceChanged |
| Signal emitted when the slice configuration has changed. | |
Public Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Protected Member Functions | |
| bool | drawOtherSlice (const GL::ViewState &viewState, const GlSlice *s) const |
| Render the intersection plane of another slice view. | |
| void | renderMprIntersectionCross (const GlView &parentView) const |
Protected Attributes | |
| std::vector< std::unique_ptr< GlSliceRenderer > > | m_renderers |
| List of all slice renderers that can be used for rendering Data. | |
| std::vector< RenderInfo > | m_imagesToRender |
| The list of images to render. | |
| double | m_sx |
| Half width of the slice. | |
| double | m_sy |
| Half height of the slice. | |
| vec3 | m_color |
| Border color of the slice. | |
| bool | m_renderFirstImageWithFullOpacity = false |
| Show the first image always with full opacity independent of its alpha channel. | |
| BlendingMode | m_blendingMode = BlendingMode::Default |
| Blending mode to use. | |
| double | m_blendFactor = 0.5 |
| Blending factor used in alpha blending mode. | |
| double | m_blendDistance = 16.0 |
| Stitching overlap in pixels when using DistToBorder blending mode. | |
| std::pair< vec4, vec4 > | m_blendColors |
| Primary and secondary tint color when using color blending. | |
| int | m_checkerboardFieldSize = 100 |
| Size of the checkerboard fields in pixels when using Checkerboard blending. | |
| std::optional< vec2f > | m_customCheckerboardLocation |
| Optional custom location for a basic 2x2 checkerboard blending. | |
| bool | m_is3d |
| Flag whether this GlSlice is supposed to show 3D data or 2D data. | |
| bool | m_useAlphaBlendingToParentFbo = true |
| By default GlSlice will use alpha compositing when blending the result to the parent FBO, set to false to use existing custom blending configuration. | |
| std::unique_ptr< GL::Program > | m_blendProg |
| Shader used for blending. | |
| std::unique_ptr< GL::Framebuffer > | m_fbo |
| FBO used for sweep blending. | |
| Renderbuffer | m_tex [3] |
| Auxiliary color+depth texture attached to m_fbo used for blending. | |
| std::unique_ptr< GL::VertexBuffer > | m_vbo |
| VBO used for rendering primitives. | |
Protected Attributes inherited from GlObject | |
| mat4 | m_matrix = mat4::Identity() |
| Modelview transformation matrix of this object. | |
| bool | m_visible = true |
| Object visibility. | |
| bool | m_alwaysVisible = false |
| Object always visible. | |
| bool | m_draw3DIn2DView |
| Draw 3D objects in 2D views. This is to render 3D objects in projective 2D views. Property is not serialized. | |
| RenderingOrderGroup | m_renderingOrder = RenderingGroupRest |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
strong |
Enumeration of the blending modes available in GlSlice.
|
strong |
Enumeration for selecting what to render as GlObject.
|
strong |
Enumeration for selecting how to render the cross-section between this MPR and other MPR slice views.
|
virtual |
Sets the data that is to be rendered by this GlSlice.
For each Data to display you have to specify the 2D display options to use.
Reimplemented in GlCurvedViewOrthoSlice.
| SharedImageSet * imageData | ( | ) | const |
Returns the first SharedImageSet that is rendered by this GlSlice.
|
virtual |
Set a custom slice in 3D space.
Reimplemented in GlCurvedViewOrthoSlice.
| int setNextSlice | ( | int | relative | ) |
Jump to one of the next whole voxels before or behind the current slice imageData().
Returns the index of the resulting whole slice number.
| int numSlices | ( | ) | const |
Return the total number of slices of imageData() wrt.
to the current orientation of the view. Will return 0 if imageData() is empty or not a volume.
| vec3 center | ( | const Data * | data = nullptr | ) | const |
Returns the center in world coordinates of the given data.
| data | The data to compute the center for, must be assigned to this slice. If data is nullptr (default), it will use the first shown data. |
| mat4 defaultPose | ( | const Data * | data, |
| Slice::AnatomicalPlane | plane ) const |
Returns the default view matrix to use for showing the given dataset in a slice view of the given anatomical plane.
This function is for instance use by the reset function of ImageView2D/GlSliceView.
|
overridevirtual |
Set the modelview matrix of this object.
Reimplemented from GlObject.
|
overridevirtual |
|
inlineoverridevirtual |
Return unique identifier for this object class used for serialization.
Implements GlObject.
|
protected |
Primary and secondary tint color when using color blending.