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

#include <ImFusion/LiveUS/SweepRecorderController.h>

Controller for recording and visualizing multiple ultrasound sweeps. More...

Inheritance diagram for ImFusion::US::SweepRecorderController:

Detailed Description

Controller for recording and visualizing multiple ultrasound sweeps.

While the algorithm handles the actual recording and only outputs the recorded data upon completion, this controls aims at making the recording process itself more user-friendly. It adds a ring buffer and ultrasound probe visualization to the views so that the user can examine in MPR and 3D views before starting the recording, and understand from screen tinting if tracking was lost.

Classes

struct  SweepsTrackings

Public Slots

void onStartStop ()
 Callback for start/stop button clicks or from InstrumentButtonListener.

Signals

void recorderStartStop (bool active)
 Emitted when the recorder starts (true) or stops recording (false).
void trackingInfoChanged (bool isActive)
 Emitted when tracking availability changes.

Public Member Functions

 SweepRecorderController (SweepRecorderAlgorithm *algorithm)
void init () override
 Initializes the widget in the GUI and prepares the algorithm.
void setLiveFilterMode (int val)
 Sets the spatial filtering mode for the live sweep.
int liveFilterMode () const
 Returns the spatial filtering mode of the live sweep (0=None, 1=Position, 2=Position+Rotation).
void setLiveFilterSize (int val)
 Sets the half-width of the live sweep filter window.
int liveFilterSize () const
 Returns the half-width of the live sweep filter window.
void configure (const Properties *p) override
 Configures properties specific to the controller or live visualization, such as simplifiedMode to reduce UI settings.
void setPatientName (const QString &name)
 Sets the patient name in the UI and algorithm. See StreamRecorderAlgorithm::setPatientName().
void setDescription (const QString &description)
 Sets the description in the UI, which is also used as a patient name suffix in the algorithm.
QString patientName ()
 Returns the patient name.
QStringList descriptions ()
 Returns the currently selected description (patient name suffix).
void setSavePath (const QString &path)
 Sets the base folder for saving sweeps. A separate subfolder is created for each patient.
void setLiveStreamRecording (bool isLive)
 Enables or disables live stream recording.
void setResetViewsAfterRecording (bool flag)
 Sets whether views should be reset after recording.
void setTintOnLowQuality (bool flag)
 Enables or disables red tinting of images and probes when quality is low.
US::ProbeRendererprobeRenderer ()
 Returns the ProbeRenderer used in live visualization (available after calling init()).
UltrasoundSweepRingBufferliveSweep () const
 Returns the ultrasound sweep buffer used for live visualization (available after calling init()).
void setPauseLiveProcessing (bool flag)
 Pauses or resumes live visualization processing.
bool isLastSweepValid ()
 Returns whether the last recording was valid (recording was not canceled).
void setShouldProcessButton (bool shouldProcess)
 Enables or disables InstrumentButtonListener.
bool reconnect ()
 Calls Stream::restart() on all recorded streams.
void lastRecordedSweeps (DataList &dl)
 Adds the last recorded sweeps to the provided data list.
void cancelRecording ()
 Stops recording and discards data.
Public Member Functions inherited from ImFusion::AlgorithmController
 AlgorithmController (Algorithm *algorithm)
 Creates a new AlgorithmController wrapping the given algorithm, which must not be null.
const Algorithmalgorithm () const
 Returns the underlying Algorithm instance.
Algorithmalgorithm ()
void showInputData ()
 Shows the input data in the DisplayWidget.
InputDataVisibility showsInputData ()
 Checks if the input data is currently visible in the DisplayWidget.
void showHelp ()
 Attempts to open the user documentation page for the underlying algorithm.
std::optional< Filesystem::PathhelpPath () const
 Returns the path to the user documentation page if it is available, std::nullopt otherwise.
std::string title () const override
 Returns the original factory name of the underlying Algorithm.
Public Member Functions inherited from ImFusion::Controller
void setMainWindowBase (MainWindowBase *mw)
 Complete the initialization by providing the parent MainWindowBase instance hosting the controller by setting m_main and m_disp and eventually call init().
virtual void onSelectedDataChanged (const DataList &)
 Called by MainWindowBase in the case that the selection in the data model has changed.
virtual void onVisibleDataChanged (const DataList &)
 Called by MainWindowBase in the case that the currently visible data has changed.
virtual std::vector< LocationsupportedLocations () const
 Returns the list of locations in which this controller is allowed to be placed by the parent MainWindowBase.
virtual Location preferredLocation () const
 Returns the preferred location in which the parent MainWindowBase should place this controller.
virtual void onLocationChanged (Location newLocation)
 Callback function called by the parent MainWindowBase/ControllerDecorator whenever the place was changed.
Location location () const
 Convenience function to query the current controller Location from the parent ControllerDecorator.
ControllerDecoratorgetDecorator () const
 Convenience function to return m_main->getControllerDecorator(this) if m_main is set or nullptr otherwise.
template<typename T>
T * getDecorator () const
 Convenience function to dynamic_cast the return value of getDecorator() to a derived type.
Public Member Functions inherited from ImFusion::Configurable
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
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.

Public Attributes

Signal< UltrasoundSweep * > signalNewSweepRecorded
 Emitted after a new sweep is recorded, before it is added to the data model.
Signal< bool > signalTrackingQualityLow
 Emitted when tracking is lost (true) or recovered (false).
Public Attributes inherited from ImFusion::Controller
Signal signalTitleChanged
 Signal emitted when the title() has changed.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.

Protected Member Functions

void onAlgorithmParametersChanged () override
 Callback called when the Algorithm's signalParametersChanged signal was emitted.
void onAlgorithmOutputChanged () override
 Callback called when the Algorithm's signalOutputChanged signal was emitted.
void updateCustomProbeMesh ()
 Loads the probe mesh from the configured mesh, if available.
int mainTrackingIndex ()
void updateRelativeGUI ()
 Updates the relative targets list in the controller based on the current state of the tracking stream.
void updateLowQualityState ()
void setLowQualityState (bool state)
std::string getSweepBasename ()
void onNewImage ()
void onNewTracking (std::vector< TrackingInstrument > instruments)
void onInstrumentsUpdated (const std::vector< TrackingInstrument > &devices)
 Called by the tracking stream when a new tracking device is added or removed.
void initializeInstrumentButtonListener ()
void onProbeButtonPressed ()
bool isTrackingReceived ()
std::optional< int > relativeTrackingIndex ()
void updateRelativeTracking ()
double relativeQuality ()
void updateDataControllers ()
void updateRuler ()
SweepDisplayDataControllersweepDisplayDataController ()
TrackedSharedImageSetDisplayDataControllertsisDisplayDataController ()
void onStreamData (std::shared_ptr< const StreamData > streamData)
 Takes the latest ultrasound image or tracking data and updates the live ultrasound sweep.
Protected Member Functions inherited from ImFusion::AlgorithmController
virtual void closeAlgorithm (bool executed=false)
 Removes the algorithm from the ApplicationController and closes the controller.
virtual void duplicateAlgorithmOnSelectedData () const
 Instantiates a new copy of underlying Algorithm on the currently selected Data in the DataModel and adds it to the ApplicationController.
void addToDataAndAnnotationModels (OwningDataList data)
 Adds the contents of data to the DataModel of the parent MainWindowBase.
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

Protected Attributes

Ui_SweepRecorderController * m_ui
QStringListModel m_calibListModel
CalibrationMatrixWidgetm_calibMatWidget = nullptr
SweepRecorderAlgorithmm_algUS
UltrasoundSweepRingBufferm_usSweep = nullptr
 Ultrasound sweep instance storing the last recorded frames.
std::unique_ptr< LiveSweepRecordingVisualizationAlgorithmm_liveAlg
 Live ultrasound buffer.
std::unique_ptr< LiveSweepRecordingVisualizationRenderer > m_liveRend
 Live ultrasound rendering.
US::ProbeRendererm_probeRenderer = nullptr
 Probe renderer for live ultrasound visualization.
ScreenTintm_screenTint = nullptr
 Screen tinting for low-quality visualization.
std::vector< TrackingInstrumentm_lastTrackings
 Last tracking update added to the live ultrasound sweep.
SweepDisplayDataControllerm_sweepDisplay = nullptr
 Updates visibility and MPRLink flag of the live sweep.
TrackedSharedImageSetDisplayDataControllerm_tsisDisplay = nullptr
 Updates the quality bar of the tracking stream.
std::unique_ptr< ProbeTrackerAssignerm_probeTrackerAssigner
bool m_hasReceivedImage = false
 True if the first image frame has been processed.
bool m_hasReceivedTracking = false
 True if the first tracking frame has been processed.
int m_liveFilterMode = 0
 Spatial filtering mode for the live sweep (0=None, 1=Position, 2=Position+Rotation)), default is 0.
int m_liveFilterSize = 2
 Half-width of the live sweep filter window, default is 2.
std::atomic_bool m_pauseLiveProcessing = {false}
 If true, stream data processing is paused.
std::unique_ptr< InstrumentButtonListenerm_instrumentButtonListener
bool m_qualityLowState = true
bool m_useTinting = true
bool m_beepOnTrackingLost = false
bool m_isLastSweepValid = false
bool m_resetViewsAfterRecording = true
std::deque< SweepsTrackingsm_dataModelSweepsTrackings
std::map< std::vector< Data * >, std::future< void > > m_dataSavingTasks
Protected Attributes inherited from ImFusion::AlgorithmController
Algorithmm_algorithm = nullptr
 The underlying algorithm.
Protected Attributes inherited from ImFusion::Controller
MainWindowBasem_main = nullptr
 The parent MainWindowBase instance hosting this Controller.
DisplayWidgetMultim_disp = nullptr
 The main DisplayWidget instance, convenience shortcut for m_main->display().
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Additional Inherited Members

Public Types inherited from ImFusion::AlgorithmController
enum class  InputDataVisibility { None = 0 , All = 1 , Some = 2 }
 Enumeration of possible return values for showsInputData(). More...
Public Types inherited from ImFusion::Controller
enum class  Location : int {
  Unknown = -1 , Naked = 0 , PrimaryDock = 1 , SecondaryDock = 2 ,
  Detached = 3 , ToolBar = 4 , UserLocation = 100
}
 Enumeration of possible placement/decoration options of a Controller. More...

Member Function Documentation

◆ init()

void ImFusion::US::SweepRecorderController::init ( )
overridevirtual

Initializes the widget in the GUI and prepares the algorithm.

Implements ImFusion::Controller.

◆ setLiveFilterMode()

void ImFusion::US::SweepRecorderController::setLiveFilterMode ( int val)

Sets the spatial filtering mode for the live sweep.

Parameters
valFiltering mode (0=None, 1=Position, 2=Position+Rotation).

◆ configure()

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

Configures properties specific to the controller or live visualization, such as simplifiedMode to reduce UI settings.

Reimplemented from ImFusion::Configurable.

◆ setDescription()

void ImFusion::US::SweepRecorderController::setDescription ( const QString & description)

Sets the description in the UI, which is also used as a patient name suffix in the algorithm.

See StreamRecorderAlgorithm::setPatientNameSuffix().

◆ isLastSweepValid()

bool ImFusion::US::SweepRecorderController::isLastSweepValid ( )
inline

Returns whether the last recording was valid (recording was not canceled).

See cancelRecording().

◆ reconnect()

bool ImFusion::US::SweepRecorderController::reconnect ( )

Calls Stream::restart() on all recorded streams.

Deprecated
"Call SweepRecorderAlgorithm::reconnect() directly on the algorithm instance"

◆ trackingInfoChanged

void ImFusion::US::SweepRecorderController::trackingInfoChanged ( bool isActive)
signal

Emitted when tracking availability changes.

Emits false if there was not any tracking received already upon first frame. Emits true when first tracking data is received.

◆ onStartStop

void ImFusion::US::SweepRecorderController::onStartStop ( )
slot

Callback for start/stop button clicks or from InstrumentButtonListener.

Can be called to start or stop recording, including all updates in the controller UI.

◆ onAlgorithmParametersChanged()

void ImFusion::US::SweepRecorderController::onAlgorithmParametersChanged ( )
overrideprotectedvirtual

Callback called when the Algorithm's signalParametersChanged signal was emitted.

Reimplemented from ImFusion::AlgorithmController.

◆ onAlgorithmOutputChanged()

void ImFusion::US::SweepRecorderController::onAlgorithmOutputChanged ( )
overrideprotectedvirtual

Callback called when the Algorithm's signalOutputChanged signal was emitted.

Reimplemented from ImFusion::AlgorithmController.

◆ mainTrackingIndex()

int ImFusion::US::SweepRecorderController::mainTrackingIndex ( )
protected
Deprecated
"TrackingInstrument identification by index is deprecated." "Query the main instrument directly from the algorithm instance using SweepRecorderAlgorithm::trackingStream()->mainInstrumentId()"

◆ onInstrumentsUpdated()

void ImFusion::US::SweepRecorderController::onInstrumentsUpdated ( const std::vector< TrackingInstrument > & devices)
protected

Called by the tracking stream when a new tracking device is added or removed.

Updates the list of devices in the GUI.


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