![]() |
ImFusion SDK 4.3
|
#include <ImFusion/US/SweepProcessingAlgorithm.h>
High-level algorithm for post-processing 3D freehand ultrasound sweeps. More...
Inheritance diagram for SweepProcessingAlgorithm: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:
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. | |
| Progress * | progress () 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 FactoryInfo & | factoryInfo () 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 | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (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< Frames > | p_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 | |
| UltrasoundSweep & | m_sweep |
| The input ultrasound sweep to process. | |
| std::unique_ptr< UltrasoundSweep > | m_outSweep |
| The output sweep in case p_createNew is active. | |
Protected Attributes inherited from Algorithm | |
| std::string | m_name |
| Algorithm name. | |
| Progress * | m_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< Action > | m_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< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
strong |
|
overridevirtual |
Execute the algorithm.
Implements Algorithm.
| 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.
| 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:
target == 1: Uses the given widthOut to compute spacingOut, then updates heightOut.target == 2: Uses the given heightOut to compute spacingOut, then updates widthOut.target == 0: Uses the provided spacingOut (not modified), and computes both widthOut and heightOut.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.
| spacingOut | Output spacing (in mm/pixel). Used as input if target == 0, otherwise set by the function. |
| widthOut | Output width (in pixels). Used as input if target == 1, otherwise set by the function. |
| heightOut | Output height (in pixels). Used as input if target == 2, otherwise set by the function. |
| target | Which parameter to target: 1 = width, 2 = height, 0 = spacing input, other = spacing property. |
widthOut, heightOut, and/or spacingOut. | vec3 averageOutOfPlaneSpacing | ( | ) | const |
Compute the average out-of-plane spacing at the top, center and bottom of the US image.
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.
| void setSweepSelection | ( | const std::vector< int > & | indices | ) |
A method to set a custom selection on the sweep.
| indices | The indices of the frames to select |
|
overridevirtual |
|
protected |
Check whether width or height would change with the provided pixel spacing.
| spacing | The pixel spacing to check |