![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Stream/TrackingStreamRecorder.h>
Records data from a TrackingStream. More...
Inheritance diagram for TrackingStreamRecorder:Records data from a TrackingStream.
Stores emitted tracking samples into one or more TrackingSequence instances, creating one TrackingSequence per TrackingInstrument.
Can be used independently, or in combination with StreamRecorderAlgorithm to record multiple streams simultaneously and enable advanced features such combining image and tracking data into a TrackedSharedImageSet or saving the recording to an ImFusion .imf file.
Public Member Functions | |
| TrackingStreamRecorder (TrackingStream &stream) | |
| TrackingStream & | stream () const override |
| Returns the associated stream being recorded. | |
| OwningDataList | takeOutput () override |
| Retrieves all TrackingSequence instances recorded for the TrackingInstruments, based on the recordAllInstruments setting. | |
| void | setRecordingDevice (int index) |
| Sets the device index to be recorded. | |
| int | recordingDevice () const |
| Returns the index of the device being recorded. | |
| void | setRecordAllDevices (bool recordAll) |
| Sets whether all tracking devices should be recorded. | |
| bool | recordAllDevices () const |
| Returns true if all tracking devices are recorded. | |
| void | setMaxDevices (int count) |
| Sets the maximum number of tracking devices to record. | |
| int | maxDevices () const |
| Returns the maximum number of tracking devices to record. | |
| void | setRecordingInstrument (const std::string &trackerId) |
| Specifies the instrument to be recorded (only relevant if recordAllInstruments is disabled). | |
| std::string | recordingInstrument () const |
| Returns the ID of the TrackingInstrument being recorded. | |
| void | setRecordAllInstruments (bool recordAll) |
| Enables or disables recording of all instruments. | |
| bool | recordAllInstruments () const |
| Returns true if all instruments are recorded. | |
| void | setMaxInstruments (int count) |
| Sets the maximum number of TrackingInstruments to record. | |
| int | maxInstruments () const |
| Returns the maximum number of TrackingInstruments to record. | |
| void | setQualityThreshold (double t) |
| Sets a quality threshold. Tracking samples below this threshold (or NaN) will be discarded during recording. | |
| double | qualityThreshold () |
| Returns the quality threshold used for filtering poor tracking samples. | |
| std::unique_lock< std::mutex > | currentRecordingSequence (const TrackingSequence **ts, const std::string &trackerId="") const |
| Provides temporary access to the currently recorded TrackingSequence. | |
| std::unique_lock< std::mutex > | currentRecordingStream (const TrackingSequence **ts, int device=0) const |
| Deprecated: Provides temporary access to the recorded tracking sequence using device index. | |
Public Member Functions inherited from StreamRecorder | |
| StreamRecorder (Stream &stream) | |
| Constructs a StreamRecorder for the specified input stream. Recording is not started automatically. | |
| void | start () |
| Starts recording if not already recording. | |
| void | stop () |
| Stops recording if currently recording. | |
| bool | isRecording () const |
| Returns true if a recording is currently in progress. | |
| bool | allStreamsRunning () const |
| Returns true if all streams being recorded are currently active. | |
| void | setTimeLimit (double seconds) |
| Sets the maximum duration of a recording session (in seconds). | |
| void | setSystemMemoryLimit (double maxMemoryFraction) |
| Sets the maximum fraction of available system memory allowed for recording [0.0-1.0]. | |
| void | setSamplesLimit (int maxSamples) |
| Sets the maximum number of samples (frames, tracking data, etc.) to record. | |
| void | setRecordedBytesLimit (size_t maxBytes) |
| Sets the maximum number of recorded bytes. | |
| size_t | recordedBytesLimit () const |
| Returns the configured maximum number of recorded bytes. Zero if no limit is set. | |
| double | passedTime () const |
| Returns the duration of the current or most recent recording session (in seconds). | |
| int | recordedSamples () const |
| Returns the number of samples recorded during the current or most recent session. | |
| bool | hasReachedLimit () const |
| Returns true if any recording limit (time, memory, samples, bytes) was reached. | |
| bool | hasReachedMemoryLimit () const |
| Returns true if the memory limit was specifically reached during recording. | |
| size_t | recordedBytes () const |
| Returns the number of bytes recorded during the current or most recent session. | |
| void | setUseDeviceTimestamp (bool flag) |
| Specifies whether to record the device timestamp or the arrival timestamp. | |
| bool | usesDeviceTimestamps () const |
| Returns true if device timestamps are recorded instead of arrival timestamps. | |
| void | setRecordBothTimestamps (bool flag) |
| Sets whether both device and arrival timestamps should be recorded. | |
| bool | recordBothTimestamps () const |
| Returns true if both timestamp types will be recorded in a TimestampDataComponent. | |
| void | setCaptureMode (CaptureMode captureMode) |
| Sets the desired capture mode. | |
| CaptureMode | captureMode () const |
| Returns the current capture mode. | |
| void | setCaptureNextSample () |
| Requests the recording of the next StreamData emitted by the Stream. | |
Public Member Functions inherited from SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (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< TrackingStreamRecorder * > | signalInstrumentRemoved |
| Signal emitted when one or more TrackingInstruments have been removed. | |
Public Attributes inherited from StreamRecorder | |
| ProtectedSignal< StreamRecorder * > | signalLimitReached |
| Signal emitted when recording has stopped due to a limit being reached. | |
| ProtectedSignal< StreamRecorder *, size_t > | recordedBytesChanged |
| Signal emitted whenever the recorded byte count changes (i.e. a new sample is added). | |
Protected Member Functions | |
| void | init () override |
| Initializes TrackingSequences and prepares the recording session. | |
| void | finalize () override |
| Finalizes the recording: applies registration matrix and instrument calibration matrices from TrackingStream. | |
| size_t | processStreamData (const StreamData &data) override |
| Appends tracking information from incoming TrackingStreamData to the corresponding TrackingSequence instances. | |
| void | onInstrumentsUpdated () |
| Triggered when TrackingInstruments change in TrackingStream. | |
Protected Member Functions inherited from StreamRecorder | |
| double | extractTimestamp (const StreamData *data) |
| Extracts either the device or arrival timestamp from the given StreamData, based on m_useDeviceTimestamp. | |
| virtual void | recordFrameDataComponents (ElementwiseDataComponentList &ewdcl, const StreamData &streamDataWithDCs, int finalContainerSize) |
| Copies the DataComponents from streamDataWithDCs and appends them to the provided ElementwiseDataComponentList (ewdcl), continuing until the container reaches the specified final size (finalContainerSize). | |
| void | resetRecordingStatistics () |
| Resets the recorded samples counter m_samplesRead and recorded byte counter m_recordedBytes to Zero and the m_limitReached flag to false. | |
Protected Member Functions inherited from SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
Additional Inherited Members | |
Public Types inherited from StreamRecorder | |
| enum | CaptureMode { CaptureAll = 0 , OnRequest = 1 } |
|
overridevirtual |
Returns the associated stream being recorded.
Reimplemented from StreamRecorder.
|
overridevirtualthreadsafe |
Retrieves all TrackingSequence instances recorded for the TrackingInstruments, based on the recordAllInstruments setting.
Returns an empty OwningDataList if recording is still in progress.
Can be called concurrently from any thread.
Implements StreamRecorder.
| void setRecordingDevice | ( | int | index | ) |
Sets the device index to be recorded.
| int recordingDevice | ( | ) | const |
Returns the index of the device being recorded.
| void setRecordAllDevices | ( | bool | recordAll | ) |
Sets whether all tracking devices should be recorded.
| bool recordAllDevices | ( | ) | const |
Returns true if all tracking devices are recorded.
| void setMaxDevices | ( | int | count | ) |
Sets the maximum number of tracking devices to record.
| int maxDevices | ( | ) | const |
Returns the maximum number of tracking devices to record.
| void setRecordAllInstruments | ( | bool | recordAll | ) |
Enables or disables recording of all instruments.
If set to true, all instruments are recorded; otherwise, only the specified one.
| void setMaxInstruments | ( | int | count | ) |
Sets the maximum number of TrackingInstruments to record.
If there are more than count instruments in the stream, only the first count instruments are recorded.
| int maxInstruments | ( | ) | const |
Returns the maximum number of TrackingInstruments to record.
If there are more instruments in the stream than this value, only the first instruments are recorded.
|
nodiscardthreadsafe |
Provides temporary access to the currently recorded TrackingSequence.
Writes a pointer to the container into ts. If trackerId is empty, the first available instrument is used. The returned lock must remain in scope during inspection to ensure thread safety.
Can be called concurrently from any thread.
| std::unique_lock< std::mutex > currentRecordingStream | ( | const TrackingSequence ** | ts, |
| int | device = 0 ) const |
Deprecated: Provides temporary access to the recorded tracking sequence using device index.
|
overrideprotectedvirtualthreadsafe |
Initializes TrackingSequences and prepares the recording session.
Can be called concurrently from any thread.
Implements StreamRecorder.
|
overrideprotectedvirtualthreadsafe |
Finalizes the recording: applies registration matrix and instrument calibration matrices from TrackingStream.
Can be called concurrently from any thread.
Implements StreamRecorder.
|
overrideprotectedvirtual |
Appends tracking information from incoming TrackingStreamData to the corresponding TrackingSequence instances.
Discards low-quality samples if the quality threshold is set. Returns the number of bytes recorded.
Implements StreamRecorder.
|
protected |
Triggered when TrackingInstruments change in TrackingStream.
Emits signalInstrumentRemoved if one or multiple currently recorded instruments have been removed.