ImFusion SDK 4.3
GlSweepReconstruction Class Reference

#include <ImFusion/US/GlSweepReconstruction.h>

Reconstruction of pixel data of one or multiple UltrasoundSweep image sets into an arbitrary 2D frame in 3D space. More...

+ Inheritance diagram for GlSweepReconstruction:

Detailed Description

Reconstruction of pixel data of one or multiple UltrasoundSweep image sets into an arbitrary 2D frame in 3D space.

This class tries to sample from all the sweep's 2D frames positioned in space in an optimal way to efficiently reconstruct a single 2D image without streaks. It is needed everywhere in the framework where image information is sampled in 3D space regardless of where the underlying 2D frames of the (freehand) UltrasoundSweep are located. As such, it is - among others - used in the framework to:

This class performs the inverse operation of VolumeReslicingAlgorithm.

Note
Masks and deformations are supported, as long as the same ones are used for each frame. It will use the mask/deformation assigned to the focus image of the sweep.

Fundamentally, there are two GPU-based reconstructions available:

  • The direct reconstruction directly renders fragments between adjacent frames. This approach is fast but requires the frames to be ordered sequentially in space. There are two sub-types: parallel and orthogonal reconstruction, which are tuned to exploit prior knowledge on the main orientation of the sweep's frames. In MPR settings, the axial MPR would typically use the parallel mode, the other two MPRs the orthogonal one. DUAL mode blends between these two.
  • The backward reconstruction builds a binary space partitioning (BSP) tree iterates over the target frame's pixels, and tries to sample from the surrounding frames. It produces qualitatively better reconstructions but is more expensive to compute, limited by the OpenGL texture array size, and may also exhibit reconstruction artifacts when the sweep follows zig-zag motion.

Example for rendering into an MPR view:

MySweepRenderer::MySweepRenderer()
{
m_comp->setMode(GlSweepReconstruction::DUAL);
m_comp->setNearestNeighbor(false);
m_comp->setEncodeAngleInformation(false);
}
void MySweepRenderer::render(const GL::ViewState& viewState,
const Slice& slice,
const Data& data,
const DisplayOptions2d& displayOptions,
bool encodeDistance)
{
auto sweep = dynamic_cast<const UltrasoundSweep*>(&data);
if (!sweep)
return;
m_comp->setEncodeDistToBorder(encodeDistance);
m_comp->setSweep(sweep);
m_comp->renderSlice(viewState, slice, displayOptions);
}
Virtual base class for representing data from which all concrete data class such as images need to de...
Definition Data.h:26
Configures the display options for 2D slice rendering of images.
Definition DisplayOptions2d.h:36
Guard to easily save and restore critical (modern) OpenGL state.
Definition StateGuard.h:40
@ FBO
Save the currently bound FBO.
Definition StateGuard.h:46
@ Program
Save the currently bound shader/program.
Definition StateGuard.h:47
Encapsulates the OpenGL view state defined by the viewport, a projection matrix and a model-view matr...
Definition ViewState.h:22
Represents a planar bounded slice in 3D space.
Definition Slice.h:11
@ DUAL
Blending of both modes for good visual result in any reconstruction plane.
Definition GlSweepReconstruction.h:111
Set of 2D ultrasound images constituting a 3D (freehand) ultrasound sweep, so a clip of 2D ultrasound...
Definition UltrasoundSweep.h:31
T make_unique(T... args)

Classes

struct  FourCorners
 

Public Types

enum  Mode { ORTHOGONAL = 0 , PARALLEL = 1 , DUAL = 2 , BACKWARD_COMPOUNDING = 3 }
 Enumeration of possible reconstruction modes. More...
 

Public Member Functions

 GlSweepReconstruction ()
 Constructor, which does not initialize shaders and working variables yet.
 
void setSweep (const UltrasoundSweep *sweep, const Selection *sel=0)
 Set the freehand sweep data and optional selection.
 
void setSweeps (const std::vector< const UltrasoundSweep * > &sweeps)
 Set multiple sweeps to render.
 
Mode mode () const
 Returns the reconstruction mode.
 
void setMode (Mode mode)
 Set the reconstruction mode.
 
double thickness () const
 Returns the slice thickness (mm) in backward compounding mode; 0 if using automatic setting.
 
void setThickness (double value)
 Sets the slice thickness (mm) in backward compounding mode; set to 0 to use automatic setting.
 
bool nearestNeighbor () const
 Returns the flag whether to use nearest neighbor interpolation.
 
void setNearestNeighbor (bool value)
 Sets the flag whether to use nearest neighbor interpolation.
 
bool encodeDistToBorder () const
 Returns the flag whether to encode the distance to the border into the second FBO attachment.
 
void setEncodeDistToBorder (bool value)
 Sets the flag whether to encode the distance to the border in into the second FBO attachment.
 
bool encodeAngleInformation () const
 Returns the flag whether to write out angle between US frame and render slice into the third FBO attachment.
 
void setEncodeAngleInformation (bool value)
 Sets the flag whether to write out angle between US frame and render slice into the third FBO attachment.
 
void setMaxDistance (double dist)
 Sets the maximum distance between slices to render if dist is positive, otherwise uses automatic setting (10% of max. sweep extent)
 
void renderSlice (const GL::ViewState &viewState, const Slice &slice)
 Render a 2D slice specified by the given matrix using default display options.
 
void renderSlice (const GL::ViewState &viewState, const Slice &slice, const DisplayOptions2d &displayOptions)
 Render a 2D slice specified by the given matrix using the given display options.
 

Protected Member Functions

void updateOrthogonal (const Slice &s)
 Update the orthogonal reconstruction.
 
void updateParallel (const GL::ViewState &viewState, const Slice &s, const DisplayOptions2d &displayOptions)
 Update the parallel reconstruction.
 
void updateParallelDrawSlices (const Slice &slice, int unit=0)
 Auxiliary method used in parallel reconstruction.
 
void drawOrthogonal (const GL::ViewState &viewState, const Slice &slice, const DisplayOptions2d &displayOptions)
 Draw the orthogonal reconstruction.
 
void drawParallel (const DisplayOptions2d &displayOptions)
 Draw the parallel reconstruction.
 
void drawBackward (const GL::ViewState &viewState, const Slice &slice, const DisplayOptions2d &displayOptions)
 Draw the backward reconstruction.
 
void updateMdmc ()
 Updates the MaskDistanceMapComponent if needed.
 

Protected Attributes

Mode m_mode = DUAL
 Reconstruction mode.
 
const UltrasoundSweepm_sweep = nullptr
 Sweep to reconstruct.
 
std::unique_ptr< UltrasoundSweepm_proxySweep
 Optional proxy sweep in case setSweeps was called; owns the data there created.
 
std::vector< int > m_gaps
 Textures who are followed by a gap.
 
std::unique_ptr< GlProgramIncludeManagerm_progOrthogonal
 Shader program for orthogonal reconstruction.
 
std::unique_ptr< GlProgramIncludeManagerm_progParallelDist
 Distance shader program.
 
std::unique_ptr< GL::Programm_progParallelInterp
 Interpolation shader program.
 
std::unique_ptr< GlProgramIncludeManagerm_modernProg
 Shader used for backward compounding.
 
std::unique_ptr< GL::Framebufferm_fbo
 
std::unique_ptr< GL::VertexBufferm_vbo
 
std::unique_ptr< GL::Samplerm_sampler
 Sampler for specifying interpolation.
 
std::vector< std::unique_ptr< GlImage > > m_parTex
 Auxiliary textures.
 
bool m_mdmcDirty = false
 
SweepReconDirectComponent * m_srdc = nullptr
 DataComponent caching per-sweep geometry data.
 
detail::MaskDistanceMapComponent * m_mdmc = nullptr
 DataComponent storing mask-aware distance-to-border image.
 
double m_desiredMaxDist = 0.5
 Desired maximum distance between slices to render, used only if m_autoChooseMaxDist is true.
 
double m_maxDist = 0.0
 Effective maximum distance between slices to render.
 
double m_thickness = 0.0
 Slice thickness (mm) in backward compounding mode.
 
bool m_nearestNeighbor = false
 Use nearest neighbor interpolation instead of linear interpolation.
 
bool m_encodeDistToBorder = false
 Flag whether to encode the distance to the border into the second FBO attachment.
 
bool m_encodeAngleInformation = false
 Flag whether to write out angle between US frame and render slice to the third FBO attachment.
 
bool m_autoChooseMaxDist = true
 Flag whether maximum distance between slices to render should be automatically determined.
 

Member Enumeration Documentation

◆ Mode

enum Mode

Enumeration of possible reconstruction modes.

Enumerator
ORTHOGONAL 

Best mode if reconstruction plane is orthogonal to sweep slices.

PARALLEL 

Best mode if reconstruction plane is approximately parallel to sweep slices.

DUAL 

Blending of both modes for good visual result in any reconstruction plane.

BACKWARD_COMPOUNDING 

On-the-fly backward compounding.

Member Function Documentation

◆ encodeDistToBorder()

bool encodeDistToBorder ( ) const

Returns the flag whether to encode the distance to the border into the second FBO attachment.

See GlSliceRenderer::render for more details.

◆ setEncodeDistToBorder()

void setEncodeDistToBorder ( bool value)

Sets the flag whether to encode the distance to the border in into the second FBO attachment.

See GlSliceRenderer::render for more details.


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