ImFusion C++ SDK 4.4.0
ImFusion::PlaybackStereoImageStream Class Reference

#include <ImFusion/Vision/PlaybackStereoImageStream.h>

StereoImage-based stream created from the playback of a stereo image set. More...

Inheritance diagram for ImFusion::PlaybackStereoImageStream:

Detailed Description

StereoImage-based stream created from the playback of a stereo image set.

Note
It only supports Stereo image set as input This stream can be used for any stereo-stream based algorithm
If the input stream has timestamps, playback speed can be set through speed factor.
If input stream has no timestamps or timestamps have no difference, the default fps is then set to 30 and the playback speed is affact by both fps and speed factor

Public Member Functions

 PlaybackStereoImageStream (StereoSharedImageSet &ssis)
bool reset () override
 Resets the current frame index to 0.
bool hasTimeStamp () const
ImageStreamleftStream () const override
 override functions from StereoImageStream
ImageStreamrightStream () const override
void setSyncMode (SyncMode mode) override
 Set the synchronization mode.
SyncMode syncMode () const override
void setSyncThreshold (double thresholdMs) override
 Set the threshold for synchronizing the streams in milliseconds. Only images with timestamp difference within the specified threshold are emitted.
double syncThreshold () const override
void setSyncBlocking (bool blocking) override
 Sets whether the stream should block the input streams until the current stereo frame has been processed.
bool isSyncBlocking () const override
bool workerThreadRequiresOpenGl () const override
 We don't need an OpenGL context in the default worker thread, since our work happens in the m_playbackTimer callback.
Public Member Functions inherited from ImFusion::StereoImageStream
 StereoImageStream (const std::string &name="")
bool openImpl () override
 Open stream.
bool closeImpl () override
 Close stream.
bool startImpl () override
 Start stream.
bool stopImpl () override
 Stop stream.
bool pauseImpl () override
 Pause stream (not required to be supported).
bool resumeImpl () override
 Resume stream from pause (only required to be supported when pauseImpl() is supported).
bool supportsPausing () const override
 Override and return true if this stream implements the pausing and resume operations.
std::optional< WorkContinuationdoWork () override
 Create one StreamData and publish it (this function will be called at the desired frame rate) If this is not desired, you can do the following: return std::nullopt;.
std::string describe () const override
 Short description of the stream including latest state and update rate information.
Public Member Functions inherited from ImFusion::ImageStream
 ImageStream (const std::string &name="")
Data::Kind kind () const override final
 Returns the kind (typically IMAGESTREAM or VOLUMESTREAM).
void setModality (Modality m)
 Set the modality descriptor of this stream.
Modality modality () const override final
 Return the modality of this stream.
virtual bool topDown () const
 Specify whether the first line of the image data is to be displayed on top.
int size () const override
 Returns the number of images of the image stream per emission.
Public Member Functions inherited from ImFusion::Stream
 Stream (const std::string &name="")
 Constructor with the name for this stream.
virtual ThreadingMode threadingMode () const
 Configures threading mode of stream.
virtual bool supportsAsyncOperation ()
 Returns true if xxxAsync() methods support execution in a background thread.
std::shared_future< bool > openAsync ()
 Open stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
std::shared_future< bool > closeAsync ()
 Close stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
std::shared_future< bool > startAsync ()
 Start stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
std::shared_future< bool > stopAsync ()
 Stop stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
std::shared_future< bool > pauseAsync ()
 Pause stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
std::shared_future< bool > resumeAsync ()
 Resume stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
bool open ()
 Open stream and wait for the operation to complete. Returns whether the operation was successful.
bool close ()
 Close stream and wait for the operation to complete. Returns whether the operation was successful.
bool start ()
 Start stream and wait for the operation to complete. Returns whether the operation was successful.
bool stop ()
 Stop stream and wait for the operation to complete. Returns whether the operation was successful.
bool pause ()
 Pause stream and wait for the operation to complete. Returns whether the operation was successful.
bool resume ()
 Resume stream and wait for the operation to complete. Returns whether the operation was successful.
bool restart ()
 Stops, closes, opens and starts the stream. Returns whether the operation was successful.
virtual bool isRunning () const
 Return whether stream is currently running.
virtual std::string uuid ()
 Unique identifier for stream.
State currentState () const
bool isStateOneOf (const std::vector< State > &states) const
Geometry::AlignedBox bounds () const override
 Per default a Stream has empty/invalid bounds.
Pose::TransformationConvention matrixConvention () const override
 Matrices of streams by default map to the world coordinate system.
virtual bool createDefaultStreamController ()
 Indicates whether a StreamController should be created for the stream (by default returns true).
double updateRate () const
 Average update rate in Hz of the signalStreamData.
std::string describe () const override
 Short description of the stream including latest state and update rate information.
Public Member Functions inherited from ImFusion::Data
 Data (const std::string &name="")
 Data (const Data &other)
Data & operator= (const Data &other)
virtual ~Data ()
 Mandatory virtual destructor.
const std::stringname () const
 Return the name of this data.
void setName (const std::string &name)
 Sets the name of this data.
virtual bool isAnnotationType () const
 Return whether this data type is visualized through an annotation (e.g. mesh).
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
DataComponentListcomponents ()
virtual void setMatrixFromWorld (const mat4 &m)
 Set matrix mapping from the world coordinate system to the data coordinate system.
virtual void setMatrixToWorld (const mat4 &m)
 Set matrix mapping from the data coordinate system to the world coordinate system.
virtual mat4 matrixFromWorld () const
 Get matrix mapping from the world coordinate system to the data coordinate system.
virtual mat4 matrixToWorld () const
 Get matrix mapping from the data coordinate system to the world coordinate system.
virtual mat4 matrix () const
 Return the transformation matrix.
virtual void setMatrix (const mat4 &m)
 Set the transformation matrix.
Public Member Functions inherited from ImFusion::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
Public Member Functions inherited from ImFusion::Selectable
 Selectable (const Selectable &)
 Selectable (Selectable &&)
Selectable & operator= (const Selectable &)
Selectable & operator= (Selectable &&)
virtual Selection selection () const
virtual int focus () const
virtual void setSelection (const Selection &sel)
 Set the underlying selection.
virtual void setFocus (int index)
 Set focus of the selection.
Public Member Functions inherited from ImFusion::StreamGroup< StereoImageStream >
StreamGroup & operator= (StreamGroup &&other) noexcept
StreamproxyStream () override
 Returns the non-owning pointer to the proxy stream, valid for the lifetime of the stream group.
DataList children () const override
 Returns substreams as a non-owning list for the CompoundData interface.
std::vector< Stream * > substreams () const override
 Returns all substreams in this stream group.
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 Member Functions inherited from ImFusion::PlaybackStreamBase< PlaybackStereoImageStream >
 PlaybackStreamBase (Stream *parentStream=nullptr)
void setLoop (bool loop)
bool loop () const
virtual void setSpeedFactor (double factor)
double speedFactor () const
void jumpToFocus (int focusFrame)
int playbackFocus () const
void setSkipDelayedFrames (bool value)
 Set whether to skip frames in case their subsequent frame is already due.
bool isSkippingDelayedFrames () const
 Return whether to skip frames in case their subsequent frame is already due.
void setUseAbsoluteTimesteps (bool value)
 If set to true, the current time is not taken into account, and the timer will wait for amount of time equal to difference between consecutive timestamps In this case all the frames will be played.
bool useAbsoluteTimesteps () const

Protected Member Functions

bool openImpl () override
 Open stream.
bool closeImpl () override
 Close stream.
bool startImpl () override
 Start stream.
bool stopImpl () override
 Stop stream.
bool pauseImpl () override
 Pause stream (not required to be supported).
bool resumeImpl () override
 Resume stream from pause (only required to be supported when pauseImpl() is supported).
bool supportsPausing () const override
 Override and return true if this stream implements the pausing and resume operations.
std::optional< WorkContinuationdoWork () override
 Create one StreamData and publish it (this function will be called at the desired frame rate) If this is not desired, you can do the following: return std::nullopt;.
Protected Member Functions inherited from ImFusion::ImageStream
void setKind (Kind k)
 Sets the kind (typically IMAGESTREAM or VOLUMESTREAM) and emits signalKindChanged.
Protected Member Functions inherited from ImFusion::Stream
virtual bool worksWhilePaused () const
 Override if doWork() should be called also in the Paused state.
void changeState (State newState)
std::shared_future< bool > attemptStateChange (std::function< bool()> work, State stateWorking, State stateSuccess, State stateError)
Protected Member Functions inherited from ImFusion::Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
Protected Member Functions inherited from ImFusion::StreamGroup< StereoImageStream >
bool addSubstream (std::unique_ptr< SubstreamBase > substream) override
 Adds a substream to the stream group.
bool removeSubstream (Stream *substream) override
 Removes a substream from the stream group.
void emitMainAndSubSignals (std::shared_ptr< const CompoundStreamData > tuple, bool emitSubstreamSignals=true)
 Emits stream data via both compound and individual signals.
Protected Member Functions inherited from ImFusion::StreamGroupBase
void reassignSubstream (SubstreamBase *substream)
 Reassigns a substream to this stream group.
Protected Member Functions inherited from ImFusion::Utils::NotCopyable
 NotCopyable (NotCopyable &&) noexcept=default
NotCopyable & operator= (NotCopyable &&) noexcept=default
 NotCopyable (const NotCopyable &)=delete
NotCopyable & operator= (const NotCopyable &)=delete
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

Additional Inherited Members

Public Types inherited from ImFusion::StereoImageStream
enum class  SyncMode { None = 0 , ArrivalTimestamps , DeviceTimestamps }
Public Types inherited from ImFusion::Stream
enum class  ThreadingMode { BaseClassRunsWorkerThread , DerivedClassHandlesThreading }
 This flag represents the two supported threading modes of a Stream. More...
enum class  State {
  Closed , Opening , Open , Starting ,
  Running , Pausing , Paused , Resuming ,
  Stopping , Closing
}
Public Types inherited from ImFusion::Data
enum  Kind {
  UNKNOWN = 0 , IMAGE = 1 , VOLUME = 2 , IMAGESET = 3 ,
  VOLUMESET = 4 , IMAGESTREAM = 5 , VOLUMESTREAM = 6 , POINTSET = 7 ,
  SURFACE = 8 , TRACKINGSTREAM = 9 , LIVETRACKINGSTREAM = TRACKINGSTREAM , TRACKINGDATA = 10 ,
  TREE = 11 , TENSOR = 12 , POLYDATASTREAM = 13 , STEREOIMAGESET = 14 ,
  STEREOIMAGESTREAM = 15 , VOLUMETRICMESH = 16
}
 Kind of data. More...
enum  Modality {
  NA = 0 , XRAY = 1 , CT = 2 , MRI = 3 ,
  ULTRASOUND = 4 , VIDEO = 5 , NM = 6 , OCT = 7 ,
  LABEL = 8 , DISTANCE = 9
}
 Image modality of the data. More...
Static Public Member Functions inherited from ImFusion::Stream
static std::string stateToString (State state)
Static Public Member Functions inherited from ImFusion::Data
static std::string modalityString (Data::Modality m)
 Return the name of an image modality.
static Data::Modality stringToModality (const std::string &s)
 Returns the modality corresponding to a modality string or NA if nothing matches.
Public Attributes inherited from ImFusion::ImageStream
Signal< Data::KindsignalKindChanged
 Is emitted when the stream changes between IMAGESTREAM and VOLUMESTREAM, before the next ImageStreamData is emitted.
Public Attributes inherited from ImFusion::Stream
ProtectedSignal< StateChangesignalStateChanged
 Emitted after a state change has been completed with the old and new state.
ProtectedSignal signalEnded
 Indicates that the stream reached the end of its data, e.g. when a video stream has played to the end.
ProtectedSignal< std::shared_ptr< const StreamData > > signalStreamData
 Signal that is emitted by the stream when a new StreamData is available.
DeprecatedSignal< ProtectedSignal< std::shared_ptr< const StreamData > >, const StreamData & > signalNewData
 Signal that is emitted by the stream when a new StreamData is available.
Public Attributes inherited from ImFusion::Data
Signal< const Data * > signalDeleted
 Signal emitted when this instance is deleted.
Signal< const Data * > signalMatrixChanged
 Signal emitted when the transformation of this Data has changed.
Signal< std::stringsignalNameChanged
 Signal emitted when the name changed.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
Public Attributes inherited from ImFusion::Selectable
ProtectedSignal signalSelectionChanged
 Signals that the selection or size might have changed.
Public Attributes inherited from ImFusion::StreamGroupBase
ProtectedSignal< std::shared_ptr< const CompoundStreamData > > signalNewStreamGroupData
 Signal emitted when new stream data is available from the stream group.
Public Attributes inherited from ImFusion::CompoundData
Signal< Data * > signalChildAdded
 Signal emitted when a new Data instance has been added to children().
Signal< Data * > signalChildMoved
 Signal emitted when a Data instance has changed its position in children().
Signal< Data * > signalChildAboutToBeRemoved
 Signal emitted when a Data instance is about to be removed or taken from children().
Protected Attributes inherited from ImFusion::Data
mat4 m_matrix
 Transformation matrix.
std::recursive_mutexm_matrixMutex
 Used to internally synchronize access to the matrix of data.
DataComponentList m_dataComponentList
 The list of DataComponents for this data.
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
Protected Attributes inherited from ImFusion::Selectable
std::mutex m_selectionMutex
 Mutex protecting the selection.
Selection m_sel
Protected Attributes inherited from ImFusion::PlaybackStreamBase< PlaybackStereoImageStream >
Streamm_parentStream
 If optional parent stream is set, stream data emission is triggered by parent stream.
std::unique_ptr< Threading::PlaybackTimerm_playbackTimer
 Core time controller for the playback stream.
int m_frame
 Save the current forcus frame index.
double m_speedFactor
 Decides the speed of a stream.

Member Function Documentation

◆ reset()

bool ImFusion::PlaybackStereoImageStream::reset ( )
overridevirtual

Resets the current frame index to 0.

Reimplemented from ImFusion::Stream.

◆ leftStream()

ImageStream * ImFusion::PlaybackStereoImageStream::leftStream ( ) const
overridevirtual

override functions from StereoImageStream

Implements ImFusion::StereoImageStream.

◆ rightStream()

ImageStream * ImFusion::PlaybackStereoImageStream::rightStream ( ) const
overridevirtual

◆ setSyncMode()

void ImFusion::PlaybackStereoImageStream::setSyncMode ( SyncMode mode)
inlineoverridevirtual

Set the synchronization mode.

Implements ImFusion::StereoImageStream.

◆ syncMode()

SyncMode ImFusion::PlaybackStereoImageStream::syncMode ( ) const
inlineoverridevirtual

◆ setSyncThreshold()

void ImFusion::PlaybackStereoImageStream::setSyncThreshold ( double thresholdMs)
inlineoverridevirtual

Set the threshold for synchronizing the streams in milliseconds. Only images with timestamp difference within the specified threshold are emitted.

Implements ImFusion::StereoImageStream.

◆ syncThreshold()

double ImFusion::PlaybackStereoImageStream::syncThreshold ( ) const
inlineoverridevirtual

◆ setSyncBlocking()

void ImFusion::PlaybackStereoImageStream::setSyncBlocking ( bool blocking)
overridevirtual

Sets whether the stream should block the input streams until the current stereo frame has been processed.

Implements ImFusion::StereoImageStream.

◆ isSyncBlocking()

bool ImFusion::PlaybackStereoImageStream::isSyncBlocking ( ) const
overridevirtual

◆ workerThreadRequiresOpenGl()

bool ImFusion::PlaybackStereoImageStream::workerThreadRequiresOpenGl ( ) const
inlineoverridevirtual

We don't need an OpenGL context in the default worker thread, since our work happens in the m_playbackTimer callback.

Reimplemented from ImFusion::ImageStream.

◆ openImpl()

bool ImFusion::PlaybackStereoImageStream::openImpl ( )
overrideprotectedvirtual

Open stream.

Returns whether the operation was successful. This method is responsible for allocating necessary resources, initializing device handles, and establishing connections to devices. Implementers should ensure that all one-time setup tasks are completed here.

Implements ImFusion::Stream.

◆ closeImpl()

bool ImFusion::PlaybackStereoImageStream::closeImpl ( )
overrideprotectedvirtual

Close stream.

Returns whether the operation was successful. This method should be used to free any resources that were allocated during the openImpl() call and to disconnect from any devices. Implementers must ensure that all resources are properly released to avoid memory leaks.

Implements ImFusion::Stream.

◆ startImpl()

bool ImFusion::PlaybackStereoImageStream::startImpl ( )
overrideprotectedvirtual

Start stream.

Returns whether the operation was successful. This method is intended to initiate the actual data readout process or to connect a callback function for data handling. Implementers should ensure that the stream is ready and producing data after this call.

Implements ImFusion::Stream.

◆ stopImpl()

bool ImFusion::PlaybackStereoImageStream::stopImpl ( )
overrideprotectedvirtual

Stop stream.

Returns whether the operation was successful. This method should halt any ongoing data readouts or callbacks, effectively pausing the data flow to reduce CPU load. Implementers should ensure that the stream can be restarted after this call.

Implements ImFusion::Stream.

◆ pauseImpl()

bool ImFusion::PlaybackStereoImageStream::pauseImpl ( )
overrideprotectedvirtual

Pause stream (not required to be supported).

Returns whether the operation was successful. This method is intended to temporarily pause data acquisition.

Reimplemented from ImFusion::Stream.

◆ resumeImpl()

bool ImFusion::PlaybackStereoImageStream::resumeImpl ( )
overrideprotectedvirtual

Resume stream from pause (only required to be supported when pauseImpl() is supported).

Returns whether the operation was successful. This method should resume data acquisition after a pause.

Reimplemented from ImFusion::Stream.

◆ supportsPausing()

bool ImFusion::PlaybackStereoImageStream::supportsPausing ( ) const
overrideprotectedvirtual

Override and return true if this stream implements the pausing and resume operations.

Overridden method must be constexpr-essible and thread-safe.

Reimplemented from ImFusion::Stream.

◆ doWork()

std::optional< WorkContinuation > ImFusion::PlaybackStereoImageStream::doWork ( )
overrideprotectedvirtual

Create one StreamData and publish it (this function will be called at the desired frame rate) If this is not desired, you can do the following: return std::nullopt;.

Implements ImFusion::Stream.


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