ImFusion C++ SDK 4.5.0
ImFusion::US::ProcessUltrasound Class Reference

#include <ImFusion/US/ProcessUltrasound.h>

Processes single ultrasound frames according to a FrameGeometry and ProcessUltrasoundParameters. More...

Inheritance diagram for ImFusion::US::ProcessUltrasound:

Detailed Description

Processes single ultrasound frames according to a FrameGeometry and ProcessUltrasoundParameters.

ProcessUltrasound stores the current probe geometry and applies the common preprocessing steps needed before showing, recording, or converting ultrasound frames: optional depth-based spacing update, cropping to the fan bounds, conversion to grayscale, Doppler color removal, fan masking, optional inpainting during masking, and duplicate-frame suppression. The returned ProcessedFrame contains the processed image together with the geometry that matches the processed image coordinates.

The class is shared by higher-level algorithms such as ProcessUltrasoundClip and ProcessUltrasoundStreamAlgorithm.

Example for updating the processing parameters:

bool enableCropping = true;
auto updater = [&enableCropping](ProcessUltrasoundParameters& p) { p.applyCrop = enableCropping; };
processUltrasound.updateParameters(updater);
Parameters controlling how ProcessUltrasound transforms each ultrasound frame.
Definition ProcessUltrasound.h:36

Before calling processFrame(), initialize the frame geometry with initGeometry(), setGeometryToWholeImage(), or updateGeometry().

See also

Public Member Functions

ProcessUltrasoundParameters parameters () const
 Returns a copy of the current processing parameters.
void setParameters (const ProcessUltrasoundParameters &params)
 Replaces the current processing parameters.
void updateParameters (const std::function< void(ProcessUltrasoundParameters &)> &updater)
 Updates the current processing parameters while holding the internal lock.
void updateGeometry (std::unique_ptr< US::FrameGeometry > newGeometry, double depth=-1)
 Replaces the input frame geometry used for processing.
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.
void initGeometry (const ImageDescriptor &img)
 Initializes the frame geometry for the given image descriptor.
void setGeometryToWholeImage (const ImageDescriptor &img)
 Sets the current frame geometry to cover the full image.
std::unique_ptr< ProcessedFrameprocessFrame (const MemImage &unprocessedMemImage)
 Processes one ultrasound frame.
std::optional< ImageDescriptorlastProcessedImageDescriptor ()
 Returns the descriptor of the most recent processed output image.
std::unique_ptr< US::FrameGeometryframeGeometry ()
 Returns a clone of the frame geometry for unprocessed input images.
std::unique_ptr< US::FrameGeometryframeGeometryProcessed ()
 Returns a clone of the frame geometry for processed output images.
void setRemoveDuplicates (bool activate)
 Enables or disables duplicate-frame suppression.
const RemoveDuplicateFramesgetRemoveDuplicates ()
 Returns the duplicate-frame suppression algorithm, if enabled.
Public Member Functions inherited from ImFusion::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 parametersChanged
 Signal emitted when the processing parameters have changed.
Signal frameGeometryChanged
 Signal emitted when the input frame geometry changes.
Signal frameGeometryProcessedChanged
 Signal emitted when the processed output geometry changes.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.

Additional Inherited Members

Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Member Function Documentation

◆ setParameters()

void ImFusion::US::ProcessUltrasound::setParameters ( const ProcessUltrasoundParameters & params)

Replaces the current processing parameters.

Emits parametersChanged and clears cached masks because changes to cropping, masking, or color removal can invalidate subsequent frame processing.

◆ updateParameters()

void ImFusion::US::ProcessUltrasound::updateParameters ( const std::function< void(ProcessUltrasoundParameters &)> & updater)

Updates the current processing parameters while holding the internal lock.

The callback receives the stored ProcessUltrasoundParameters instance. Do not call other ProcessUltrasound methods from the callback because they may try to lock the same mutex.

◆ updateGeometry()

void ImFusion::US::ProcessUltrasound::updateGeometry ( std::unique_ptr< US::FrameGeometry > newGeometry,
double depth = -1 )

Replaces the input frame geometry used for processing.

Parameters
newGeometryGeometry of the unprocessed input image. Ownership is transferred to ProcessUltrasound.
depthOptional imaging depth in millimeters. Values greater than zero update ProcessUltrasoundParameters::depth.

Emits parametersChanged, frameGeometryChanged, and frameGeometryProcessedChanged.

◆ configure()

void ImFusion::US::ProcessUltrasound::configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ configuration()

void ImFusion::US::ProcessUltrasound::configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ initGeometry()

void ImFusion::US::ProcessUltrasound::initGeometry ( const ImageDescriptor & img)

Initializes the frame geometry for the given image descriptor.

Creates a linear geometry if none exists yet, initializes it from the image bounds, and emits frameGeometryChanged.

◆ setGeometryToWholeImage()

void ImFusion::US::ProcessUltrasound::setGeometryToWholeImage ( const ImageDescriptor & img)

Sets the current frame geometry to cover the full image.

Keeps the current geometry type when possible and adapts its parameters to fit the supplied image descriptor.

◆ processFrame()

std::unique_ptr< ProcessedFrame > ImFusion::US::ProcessUltrasound::processFrame ( const MemImage & unprocessedMemImage)

Processes one ultrasound frame.

A frame geometry must be initialized before processing. If the geometry image descriptor differs from the input image, it is updated to the input descriptor. Depending on ProcessUltrasoundParameters, processing can crop to the geometry bounds, update spacing from depth, convert to grayscale, remove Doppler color pixels, inpaint removed pixels, apply a fan mask, and suppress duplicate frames.

Returns
The processed frame and matching processed geometry, or nullptr if the frame could not be processed or was skipped as a duplicate.

◆ lastProcessedImageDescriptor()

std::optional< ImageDescriptor > ImFusion::US::ProcessUltrasound::lastProcessedImageDescriptor ( )

Returns the descriptor of the most recent processed output image.

Returns
An empty optional before the first successfully processed frame.

◆ frameGeometry()

std::unique_ptr< US::FrameGeometry > ImFusion::US::ProcessUltrasound::frameGeometry ( )

Returns a clone of the frame geometry for unprocessed input images.

Returns
nullptr if no frame geometry has been initialized.

◆ frameGeometryProcessed()

std::unique_ptr< US::FrameGeometry > ImFusion::US::ProcessUltrasound::frameGeometryProcessed ( )

Returns a clone of the frame geometry for processed output images.

After updateGeometry(), this is initialized as a clone of the input geometry. After processFrame(), it reflects cropping and spacing changes applied to the most recent processed frame.

Returns
nullptr before a geometry has been provided or a frame has been processed.

◆ setRemoveDuplicates()

void ImFusion::US::ProcessUltrasound::setRemoveDuplicates ( bool activate)

Enables or disables duplicate-frame suppression.

When enabled, processFrame() forwards each processed image to RemoveDuplicateFrames and returns nullptr for frames that are classified as duplicates.

◆ getRemoveDuplicates()

const RemoveDuplicateFrames * ImFusion::US::ProcessUltrasound::getRemoveDuplicates ( )

Returns the duplicate-frame suppression algorithm, if enabled.

The returned pointer is owned by ProcessUltrasound and stays valid until duplicate-frame suppression is disabled, the object is reconfigured, or ProcessUltrasound is destroyed.


The documentation for this class was generated from the following file:
  • ImFusion/US/ProcessUltrasound.h
Search Tab / S to search, Esc to close