![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/US/ProcessUltrasound.h>
Processes single ultrasound frames according to a FrameGeometry and ProcessUltrasoundParameters. More...
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:
Before calling processFrame(), initialize the frame geometry with initGeometry(), setGeometryToWholeImage(), or updateGeometry().
Public Member Functions | |
| ProcessUltrasoundParameters | parameters () const |
| Returns a copy of the current processing parameters. | |
| void | setParameters (const ProcessUltrasoundParameters ¶ms) |
| 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< ProcessedFrame > | processFrame (const MemImage &unprocessedMemImage) |
| Processes one ultrasound frame. | |
| std::optional< ImageDescriptor > | lastProcessedImageDescriptor () |
| Returns the descriptor of the most recent processed output image. | |
| std::unique_ptr< US::FrameGeometry > | frameGeometry () |
| Returns a clone of the frame geometry for unprocessed input images. | |
| std::unique_ptr< US::FrameGeometry > | frameGeometryProcessed () |
| Returns a clone of the frame geometry for processed output images. | |
| void | setRemoveDuplicates (bool activate) |
| Enables or disables duplicate-frame suppression. | |
| const RemoveDuplicateFrames * | getRemoveDuplicates () |
| 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< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
| 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.
| 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.
| void ImFusion::US::ProcessUltrasound::updateGeometry | ( | std::unique_ptr< US::FrameGeometry > | newGeometry, |
| double | depth = -1 ) |
Replaces the input frame geometry used for processing.
| newGeometry | Geometry of the unprocessed input image. Ownership is transferred to ProcessUltrasound. |
| depth | Optional imaging depth in millimeters. Values greater than zero update ProcessUltrasoundParameters::depth. |
Emits parametersChanged, frameGeometryChanged, and frameGeometryProcessedChanged.
|
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.
Reimplemented from ImFusion::Configurable.
|
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.
Reimplemented from ImFusion::Configurable.
| 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.
| 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.
| 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.
| std::optional< ImageDescriptor > ImFusion::US::ProcessUltrasound::lastProcessedImageDescriptor | ( | ) |
Returns the descriptor of the most recent processed output image.
| std::unique_ptr< US::FrameGeometry > ImFusion::US::ProcessUltrasound::frameGeometry | ( | ) |
Returns a clone of the frame geometry for unprocessed input images.
| 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.
| 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.
| 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.