ImFusion SDK 4.3
ImageStreamData Class Reference

#include <ImFusion/Stream/ImageStreamData.h>

Image data streamed from a streaming device. More...

+ Inheritance diagram for ImageStreamData:

Detailed Description

Image data streamed from a streaming device.

Can contain one or more images, each represented by a SharedImage.

If multiple images are present, they are assumed to be from the same acquisition time and represent two different views, e.g. two images from a stereo camera, or a B-Mode and color Doppler image from an ultrasound device.

Public Member Functions

 ImageStreamData (Stream *stream)
 Creates an empty ImageStreamData object with the given stream.
 
 ImageStreamData (Stream *stream, SharedImageSet &&imageSet)
 Moves the images and (possibly per element) components into the newly created object.
 
 ImageStreamData (Stream *stream, std::unique_ptr< SharedImage > &&img)
 Moves the single image into the newly created object.
 
 ImageStreamData (Stream *stream, const std::shared_ptr< SharedImage > &img)
 Shallow-copies the single image into the newly created object.
 
 ImageStreamData (Stream *stream, const std::shared_ptr< const SharedImage > &img)
 Shallow-copies the single image into the newly created object.
 
 ImageStreamData (Stream *stream, MemImage *img)
 Deprecated constructor. Creates an ImageStreamData object with the given stream and image.
 
virtual void setImageSet (const SharedImageSet &imageSet)
 Sets the images and (possibly per element) components into this object, replacing all existing images and components.
 
virtual void setImages (const std::vector< std::shared_ptr< const SharedImage > > &sharedImages)
 Sets the images into this object, replacing all existing images. Does not modify components.
 
virtual std::vector< std::shared_ptr< const SharedImage > > images2 () const
 Return all images contained in sample.
 
std::shared_ptr< SharedImageSetshallowCloneToSharedImageSet () const
 Return all images and (possibly per element) DataComponents contained in sample.
 
std::unique_ptr< StreamDataclone () const override
 
int size () const
 Return the number of images in the stream data.
 
bool containsGlImage () const
 Returns whether any of the images contains an OpenGL image and thus requires synchronization if moved to a thread different from the signaling thread.
 
const DataComponentListcomponents (int i) const
 Returns the DataComponents associated to the element with that index.
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 Returns the list of DataComponents for this data.
 
- Public Member Functions inherited from StreamData
virtual Streamstream () const
 Returns the stream object which updates this data.
 
virtual unsigned long long timestampDevice () const
 Timestamp in milliseconds. Set by the streaming device.
 
virtual void setTimestampDevice (unsigned long long time)
 Set timestamp provided by the streaming device, in milliseconds.
 
virtual unsigned long long timestampArrival () const
 Timestamp in milliseconds. Based on message's arrival time.
 
virtual void setTimestampArrival (std::chrono::system_clock::time_point time)
 Set the system time when this streamData was arrived. It will be stored in milliseconds relative to epoch time.
 
virtual void setTimestampArrival (unsigned long long time)
 Set arrival timestamp manually, in milliseconds.
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 Returns the list of DataComponents for this data.
 
template<typename StreamDataClass>
const StreamDataClass * typed () const
 
- Public Member Functions inherited from ElementwiseDataComponentData
ElementwiseDataComponentListelementwiseComponents ()
 Returns elementwise data component list.
 
const ElementwiseDataComponentListelementwiseComponents () const
 Returns elementwise data component list.
 
DataComponentListmutableComponents (int i)
 Returns the DataComponents associated to the element with that index, creating it if necessary.
 
const DataComponentListcomponents (int i) const
 Returns the DataComponents associated to the element with that index.
 

Protected Attributes

std::vector< std::shared_ptr< const SharedImage > > m_sharedImages
 
- Protected Attributes inherited from StreamData
Streamm_stream
 The stream object which updates this data.
 
unsigned long long m_timestampDevice
 Timestamp of the streaming device, in milliseconds.
 
unsigned long long m_timestampArrival
 Timestamp when the data is received in ImFusion framework, in milliseconds.
 
DataComponentList m_dataComponentList
 The list of DataComponents for this StreamData.
 
- Protected Attributes inherited from ElementwiseDataComponentData
ElementwiseDataComponentList m_elementwiseComponents
 Encodes elementwise data components.
 

Additional Inherited Members

- Protected Member Functions inherited from StreamData
 StreamData (const StreamData &other)=default
 
 StreamData (Stream *stream)
 
 StreamData (Stream *stream, DataComponentList &&components)
 

Constructor & Destructor Documentation

◆ ImageStreamData()

ImageStreamData ( Stream * stream,
MemImage * img )

Deprecated constructor. Creates an ImageStreamData object with the given stream and image.

Deprecated
"Use one of the other overloads instead"

Member Function Documentation

◆ setImageSet()

virtual void setImageSet ( const SharedImageSet & imageSet)
virtual

Sets the images and (possibly per element) components into this object, replacing all existing images and components.

Reimplemented in StereoImageStreamData.

◆ setImages()

virtual void setImages ( const std::vector< std::shared_ptr< const SharedImage > > & sharedImages)
virtual

Sets the images into this object, replacing all existing images. Does not modify components.

Reimplemented in StereoImageStreamData.

◆ clone()

std::unique_ptr< StreamData > clone ( ) const
overridevirtual

Implements StreamData.

◆ containsGlImage()

bool containsGlImage ( ) const

Returns whether any of the images contains an OpenGL image and thus requires synchronization if moved to a thread different from the signaling thread.

Cf. OpenGL Core Spec Chapter 5.3: "Shared Objects and Multiple Contexts > Propagating Changes to Objects".

OpenGl context synchronization example:

// Simplified example without thread safety for `fence` and `imageDataForOtherThread`
// in signal callback
if (GL::ContextManager::hasCurrent() && imageData->containsGlImage())
{
fence = GL::SyncObject();
}
imageDataForOtherThread = imageData;
// in consumer thread
if (fence)
{
fence->wait();
}
// Now it is safe to access the images in imageDataForOtherThread
static bool hasCurrent()
Returns whether the calling thread has a current OpenGL context.
Helper class to synchronize between multiple OpenGL contexts or a context and the application.
Definition SyncObject.h:57
IMFUSION_GL_API void flush()
Calls glFlush() to block until all OpenGL commands have been transferred to the GPU.
See also
GL::SyncObject

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close