![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Stream/RemoteVideoStream.h>
Creates image stream which receives the Image data via network connection. More...
Creates image stream which receives the Image data via network connection.
Internally, it uses a WebsocketClient to received the image (compressed) data as a ByteBuffer, and then it uses the Decoder
class to decode the image. RemoteVideoStream inherit from VideoCameraStream to be able to call its specific functions, like tryApplySettings however, the server side stream could be a simple ImageStream, in this case this function will have no effect
Public Member Functions | |
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. | |
std::string | describe () const override |
responsible for showing the info about the stream at the bottom of the UI | |
Properties | tryApplySettings (const Properties *p) override |
Takes the given Properties and tries to apply them if it is possible without restarting the stream. | |
Properties | forceApplySettings (const Properties *p) override |
Takes the given Properties and applies them, even if it means restarting the stream. | |
bool | tryConnect (const std::string &host, int videoPort, int controlPort) |
try to connect to a server using the specified host and port, returns false if unsuccessful video and control ports must be between 1025 and 50000, and different to each other | |
std::string | host () const |
int | videoPort () const |
int | controlPort () const |
void | setUseHardwareAcceleration (bool value) |
bool | useHardwareAcceleration () const |
std::string | uuid () override |
Unique identifier for stream. | |
int | width () |
int | height () |
ImageDescriptor | descriptor () |
returns the descriptor of the underlying image of the stream | |
size_t | estimatedBytesPerSeconds () const |
get the average number of Bytes received per second (estimated by the decoder class) | |
double | estimatedFPS () const |
get the estimated frame per second (estimated by the decoder class) | |
std::unique_ptr< Properties > | sendMessageAndWaitForReply (const std::string &message, int timeout=2000) const |
sends a message the server and wait for the response this blocks the UI until we receive a valid response from the server, usually in the form of Properties Json String | |
![]() | |
VideoCameraStream (const std::string &name) | |
const VideoCameraDeviceInfo & | deviceInfo () const |
Currently selected device, will be empty if no device has been set. | |
virtual bool | setFormat (size_t idx) |
Set capture mode as index in deviceInfo().supportedFormats. | |
const VideoStreamFrameFormat & | format () const |
Currently selected format, will use default values if no format has been set. | |
std::string | describe () const override |
Human readable description of the stream type. | |
bool | reset () final |
Returns false, because rewinding a live stream just does not make sense. | |
std::string | uuid () override |
Returns the memory address of this object as unique identifier. | |
double | fps () const |
template<typename T> | |
std::enable_if_t< std::is_base_of_v< VideoStreamSettings::VideoStreamSettingsBase, T >, T > * | settings () |
Gets an accessor for a camera setting. | |
![]() | |
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. | |
![]() | |
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. | |
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 . | |
![]() | |
Data (const std::string &name="") | |
Data (const Data &other) | |
Data & | operator= (const Data &other) |
virtual | ~Data () |
Mandatory virtual destructor. | |
const std::string & | name () 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 DataComponentList & | components () const |
Returns the list of DataComponents for this data. | |
DataComponentList & | components () |
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. | |
![]() | |
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 |
![]() | |
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. | |
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< WorkContinuation > | doWork () 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::any | getSettings (const std::string &name) override |
![]() | |
void | setKind (Kind k) |
Sets the kind (typically IMAGESTREAM or VOLUMESTREAM) and emits signalKindChanged. | |
bool | workerThreadRequiresOpenGl () const override |
Ensure the thread has an GL context before the main loop starts. | |
![]() | |
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) |
![]() | |
void | swapWith (Data &other) |
Swaps the data and emits a matrix and name changed signal for both. | |
![]() | |
NotCopyable (NotCopyable &&) noexcept=default | |
NotCopyable & | operator= (NotCopyable &&) noexcept=default |
NotCopyable (const NotCopyable &)=delete | |
NotCopyable & | operator= (const NotCopyable &)=delete |
Additional Inherited Members | |
![]() | |
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 } |
![]() | |
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 std::vector< VideoCameraDeviceInfo > | enumerateDevices () |
Lists all currently connected compatible cameras. | |
![]() | |
static std::string | stateToString (State state) |
![]() | |
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. | |
![]() | |
Signal< Data::Kind > | signalKindChanged |
Is emitted when the stream changes between IMAGESTREAM and VOLUMESTREAM, before the next ImageStreamData is emitted. | |
![]() | |
ProtectedSignal< StateChange > | signalStateChanged |
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. | |
![]() | |
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::string > | signalNameChanged |
Signal emitted when the name changed. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
ProtectedSignal | signalSelectionChanged |
Signals that the selection or size might have changed. | |
![]() | |
VideoCameraDeviceInfo | m_device |
VideoStreamFrameFormat | m_format |
StreamFps | m_actualFPS |
![]() | |
mat4 | m_matrix |
Transformation matrix. | |
std::recursive_mutex * | m_matrixMutex |
Used to internally synchronize access to the matrix of data. | |
DataComponentList | m_dataComponentList |
The list of DataComponents for this data. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
![]() | |
std::mutex | m_selectionMutex |
Mutex protecting the selection. | |
Selection | m_sel |
|
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 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 Configurable.
|
overridevirtual |
responsible for showing the info about the stream at the bottom of the UI
Reimplemented from ImageStream.
|
overridevirtual |
Takes the given Properties and tries to apply them if it is possible without restarting the stream.
This method is meant to work in connection with a VideoCamerStreamPropertiesInspectorController, which will try to call it when the user changed any setting. It is given as a complement to forceApplySettings(const Properties* p), which will force all options to be applied.
Reimplemented from VideoCameraStream.
|
overridevirtual |
Takes the given Properties and applies them, even if it means restarting the stream.
This method is meant to work in connection with a VideoCamerStreamPropertiesInspectorController, which will try to call it when the user pressed the "apply" button. It is given as a complement to tryApplySettings(const Properties* p), which may opt to only apply those options which can be set immediately without restarting the stream, to apply all settings which do need a stream restart to take effect.
Reimplemented from VideoCameraStream.
|
overridevirtual |
Unique identifier for stream.
Implements Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
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 Stream.
|
overrideprotectedvirtual |
Reimplemented from VideoCameraStream.