ImFusion SDK 4.3
SweepProcessingAlgorithm Class Reference

#include <ImFusion/US/SweepProcessingAlgorithm.h>

High-level algorithm for post-processing 3D freehand ultrasound sweeps. More...

+ Inheritance diagram for SweepProcessingAlgorithm:

Detailed Description

High-level algorithm for post-processing 3D freehand ultrasound sweeps.

This algorithm provides a flexible set of processing steps for 3D ultrasound sweeps. Depending on its configuration, it either operates directly on the input UltrasoundSweep, or generates a new processed sweep as output.

The available processing steps are:

  • Resampling: Adjusts the sweep data to isotropic pixel spacing, allowing for more uniform downstream analysis or visualization.
  • Duplicate/Oversampled Frame Removal: Detects and removes frames that are spatially redundant or oversampled (too close together), thus reducing size.
  • Masking: Applies a Mask to the sweep frames, with options to suppress regions such as the skin surface using a configurable margin.

Public Types

enum class  Frames { All = 0 , Selection = 1 }
 Enum to specify which frames of the input sweep to use. More...
 
- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 

Public Member Functions

 SweepProcessingAlgorithm (UltrasoundSweep &sweep)
 
void compute () override
 Execute the algorithm.
 
std::string analyze ()
 Analyzes the input ultrasound sweep and configures the algorithm for a default set of applicable and recommended processing options.
 
void resamplingParameters (double &spacingOut, int &widthOut, int &heightOut, int target) const
 Calculates resampling parameters for the sweep image based on the specified target.
 
vec3 averageOutOfPlaneSpacing () const
 Compute the average out-of-plane spacing at the top, center and bottom of the US image.
 
void setSweepSelection (const std::vector< int > &indices)
 A method to set a custom selection on the sweep.
 
void resetSweepSelection ()
 Convenience method to reset the sweep selection to all frames.
 
OwningDataList takeOutput () override
 Return any new Data that was created by the Algorithm during the last call to compute().
 
- Public Member Functions inherited from Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () const
 Returns the progress interface if set.
 
virtual int status () const
 Indicates the status of the last call to compute().
 
virtual bool survivesDataDeletion (const Data *) const
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
 
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
Status runAction (const std::string &id)
 Run the action with name id if it exists.
 
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
 
- 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
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
 
- Static Public Member Functions inherited from Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
 

Public Attributes

Parameter< Framesp_frameMode = {"frameMode", Frames::All, this}
 Specifies which frames of the input sweep to use.
 
Parameter< bool > p_setMask = {"setMask", false, this}
 Set a Mask based on the ultrasound FrameGeometry.
 
Parameter< double > p_maskTopMargin = {"maskTopMargin", 0.0, this}
 Set a top margin (in mm) with the mask, typically to suppress the skin region Has no effect if p_setMask is false.
 
Parameter< bool > p_resample = {"resample", false, this}
 Resample the ultrasound frame data.
 
Parameter< double > p_resampleSpacing = {"resampleSpacing", 0.5, this}
 Set the isotropic pixel spacing (in mm) for resampling.
 
Parameter< bool > p_removeDuplicates = {"removeDuplicates", false, this}
 Remove duplicate frames via RemoveDuplicateFrames.
 
Parameter< bool > p_skipFrames = {"skipFrames", false, this}
 
Parameter< bool > p_createNew = {"createNew", false, this}
 Defines whether compute modifies the input sweep, or creates a new one.
 
- Public Attributes inherited from Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
 
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter 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 isDifferentSpacing (double spacing) const
 Check whether width or height would change with the provided pixel spacing.
 
void skipOversampledFrames (UltrasoundSweep *sweep) const
 
- Protected Member Functions inherited from Algorithm
void loadDefaults ()
 
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
 
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
 
void registerAction (const Action &action)
 Register an action.
 

Protected Attributes

UltrasoundSweepm_sweep
 The input ultrasound sweep to process.
 
std::unique_ptr< UltrasoundSweepm_outSweep
 The output sweep in case p_createNew is active.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
 
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
 
int m_status = Status::Unknown
 Algorithm status after last call to compute()
 
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Enumeration Documentation

◆ Frames

enum class Frames
strong

Enum to specify which frames of the input sweep to use.

Enumerator
All 

Use all frames from input sweep.

Selection 

Use the selection of the sweep.

Member Function Documentation

◆ compute()

void compute ( )
overridevirtual

Execute the algorithm.

Implements Algorithm.

◆ analyze()

std::string analyze ( )

Analyzes the input ultrasound sweep and configures the algorithm for a default set of applicable and recommended processing options.

This can serve as a initialization of the algorithm configuration and then be further modified before application. The function inspects the sweep for properties such as non-isotropic pixel spacing and bounding volumes. If the sweep is not isotropic, it sets the resampling parameters accordingly.

Returns
A summary string describing the sweep's bounding volumes and elevational spacing.

◆ resamplingParameters()

void resamplingParameters ( double & spacingOut,
int & widthOut,
int & heightOut,
int target ) const

Calculates resampling parameters for the sweep image based on the specified target.

This function determines the output spacing, width, and height for resampling the ultrasound sweep image, depending on which parameter is being targeted:

  • If target == 1: Uses the given widthOut to compute spacingOut, then updates heightOut.
  • If target == 2: Uses the given heightOut to compute spacingOut, then updates widthOut.
  • If target == 0: Uses the provided spacingOut (not modified), and computes both widthOut and heightOut.
  • If target != 0 (but not 1 or 2): Uses the property p_resampleSpacing for spacingOut, then updates both dimensions.

The function ensures the output image maintains the correct physical extent.

Parameters
spacingOutOutput spacing (in mm/pixel). Used as input if target == 0, otherwise set by the function.
widthOutOutput width (in pixels). Used as input if target == 1, otherwise set by the function.
heightOutOutput height (in pixels). Used as input if target == 2, otherwise set by the function.
targetWhich parameter to target: 1 = width, 2 = height, 0 = spacing input, other = spacing property.
Note
Depending on the target, the function modifies widthOut, heightOut, and/or spacingOut.

◆ averageOutOfPlaneSpacing()

vec3 averageOutOfPlaneSpacing ( ) const

Compute the average out-of-plane spacing at the top, center and bottom of the US image.

Returns
A 3D vector containing the average out-of-plane spacing between consecutive frames in the sweep, measured at three positions along the imaging depth:
  • [0]: Spacing at the top of the image plane (in mm)
  • [1]: Spacing at the center of the image plane (in mm)
  • [2]: Spacing at the bottom of the image plane (in mm)

These values represent the mean physical distances between corresponding points of adjacent frames, providing insight into the spatial sampling density at different depths of the sweep.

◆ setSweepSelection()

void setSweepSelection ( const std::vector< int > & indices)

A method to set a custom selection on the sweep.

Parameters
indicesThe indices of the frames to select

◆ takeOutput()

OwningDataList takeOutput ( )
overridevirtual

Return any new Data that was created by the Algorithm during the last call to compute().

The default implementation will return an empty list.

Note
Since ownership of the data is transferred, you can call this method only once between calls to compute().

Reimplemented from Algorithm.

◆ isDifferentSpacing()

bool isDifferentSpacing ( double spacing) const
protected

Check whether width or height would change with the provided pixel spacing.

Parameters
spacingThe pixel spacing to check
Returns
True if the spacing is different from the current image descriptor

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