ImFusion SDK 4.3
ImageData Class Reference

#include <ImFusion/Stream/IGTL/ImageData.h>

Class to send/receive a single Image over an OpenIGTLink connection. More...

+ Inheritance diagram for ImageData:

Detailed Description

Class to send/receive a single Image over an OpenIGTLink connection.

Public Member Functions

 ImageData (Connection &con, const std::string &deviceName, bool cloneData=false)
 Constructor.
 
 ImageData (const ImageData &other)=delete
 
ImageDataoperator= (const ImageData &other)=delete
 
 ImageData (ImageData &&other) noexcept=delete
 
ImageDataoperator= (ImageData &&other) noexcept=delete
 
bool sendData (Data *inputData) const override
 
- Public Member Functions inherited from SharedImageSet
 SharedImageSet (std::shared_ptr< Image > img)
 Construct from a single Image.
 
 SharedImageSet (std::shared_ptr< SharedImage > img)
 Construct from a single SharedImage.
 
 SharedImageSet ()
 Construct an empty SharedImageSet.
 
SharedImageSetoperator= (const SharedImageSet &)=delete
 
std::unique_ptr< SharedImageSetclone (Flags< CloneOptions > cloneOptions=Everything) const
 Create a copy of this SharedImageSet instance.
 
void add (std::shared_ptr< Image > img)
 Add a single image to the data set.
 
void add (std::shared_ptr< Image > img, const mat4 &m)
 Add a single image with its transformation matrix.
 
virtual void add (std::shared_ptr< SharedImage > img)
 Add a shared image to the data set.
 
void add (const std::vector< std::shared_ptr< SharedImage > > &images)
 Add a list of shared images.
 
bool replace (int pos, std::shared_ptr< SharedImage > img)
 Replace a particular shared image entry, will not do anything if no image of that index exist yet.
 
virtual void remove (int pos, int count=1)
 Removes images at the specified locations and deletes them if owned.
 
void remove (const SharedImage *img)
 Removes a specific image and deletes it if owned.
 
virtual void clear ()
 Clear all data and delete it if owned.
 
std::string describe () const override
 Short description of the image set.
 
void setModalityOverride (std::optional< Data::Modality > modalityOverride)
 Set a modalityOverride.
 
virtual void setModality (Modality m)
 Set image modality for all frames.
 
Modality modality () const override
 Return the modality of this data.
 
virtual bool isMultiModal () const
 Return true if set contains images of different modalities, false otherwise.
 
virtual void prepare (bool shiftOnly=false)
 Prepare the image in memory for most common scenarios Integral types are converted to unsigned representation if applicable, double-precision will be converted to single-precision float.
 
void uploadGl () const
 Upload all images as OpenGL textures.
 
bool hasMem (int which=-1) const
 Query whether an up-to-date memory image is present. If not, a sync is required.
 
bool hasGl (int which=-1) const
 Query whether an up-to-date OpenGL image is present. If not, a sync is required.
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 
const DataComponentListcomponents (int i) const
 Returns the DataComponents associated to the element with that index.
 
virtual SharedImageget (int which=-1)
 Get specific or selected shared image.
 
std::shared_ptr< SharedImagegetShared (int which=-1)
 Get specific or selected shared image.
 
MemImagemem (int which=-1)
 Get specific or selected image in memory If required image will be synchronized.
 
GlImagegl (int which=-1)
 Get specific or selected OpenGL image If required image will be synchronized.
 
const std::vector< std::shared_ptr< SharedImage > > & images ()
 Return entire vector of images.
 
std::vector< std::shared_ptr< SharedImage > > selectedImages (Selection::NonePolicy noneSelectionHandling)
 Return vector of all selected images.
 
virtual const SharedImageget (int which=-1) const
 Get specific or selected shared image.
 
std::shared_ptr< const SharedImagegetShared (int which=-1) const
 Get specific or selected shared image.
 
const Imageimg (int which=-1) const
 Get specific or selected image descriptor.
 
const MemImagemem (int which=-1) const
 Get specific or selected image in memory If required image will be synchronized.
 
const GlImagegl (int which=-1) const
 Get specific or selected OpenGL image If required image will be synchronized.
 
std::vector< std::shared_ptr< const SharedImage > > images () const
 Return entire vector of images.
 
std::vector< std::shared_ptr< const SharedImage > > selectedImages (Selection::NonePolicy noneSelectionHandling) const
 Return vector of all selected images.
 
Pose::TransformationConvention matrixConvention () const override
 Matrices of images map from the world coordinate system.
 
virtual void setMatrix (const mat4 &m, int which, bool updateAll=false)
 Set specific (which >=0) or focused (which ==-1) image matrix.
 
virtual mat4 matrix (int which) const
 Get specific (which >=0) or focused (which ==-1) image matrix.
 
void setMatrix (const mat4 &m) override
 Set focused image matrix.
 
mat4 matrix () const override
 Get focused image matrix.
 
virtual void setMatrixFromWorld (const mat4 &m, int which, bool updateAll=false)
 Set specific (which >=0) or focused (which ==-1) image matrix mapping from the world coordinate system.
 
virtual void setMatrixToWorld (const mat4 &m, int which, bool updateAll=false)
 Set specific (which >=0) or focused (which ==-1) image matrix mapping to the world coordinate system.
 
virtual mat4 matrixFromWorld (int which) const
 Get specific (which >=0) or focused (which ==-1) image matrix mapping from the world coordinate system.
 
virtual mat4 matrixToWorld (int which) const
 Get specific (which >=0) or focused (which ==-1) image matrix mapping to the world coordinate system.
 
virtual bool hasTransformations () const
 Return true if at least one image in the set has a matrix transformation unequal identity.
 
virtual void setDeformation (std::shared_ptr< Deformation > def, int which=-1)
 Sets a deformation for specified or focus image.
 
virtual std::shared_ptr< Deformationdeformation (int which=-1) const
 Returns the deformation for the specified or focused image, or 0 if not deformation is set.
 
virtual void setMask (std::shared_ptr< Mask > mask, int which=-1)
 Sets a mask for specified or focus image.
 
virtual std::shared_ptr< Maskmask (int which=-1) const
 Returns the mask for the specified or focused image, or 0 if not mask is set.
 
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 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 void setTimestamp (double time, int which=-1)
 Set specific or focused timestamp in seconds.
 
double timestamp (int which=-1) const
 Get specific or focused timestamp in seconds.
 
const std::vector< double > timestamps () const
 Get the timestamps sequence.
 
bool hasTimestamps () const
 Return if all image frames have timestamps.
 
int size () const override
 Return the size of the image set.
 
bool allEqual () const
 Return if all image descriptors are the same.
 
Kind kind () const override
 Return the kind of data contained here.
 
Geometry::AlignedBox bounds () const override
 Returns the axis-aligned bounding box of all images in world space.
 
Propertiesproperties ()
 Return auxiliary data structures stored in Properties.
 
const Propertiesproperties () const
 Return auxiliary data structures stored in Properties.
 
- Public Member Functions inherited from Data
 Data (const std::string &name="")
 
 Data (const Data &other)
 
Dataoperator= (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 ()
 
- 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.
 
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 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.
 
- Public Member Functions inherited from Selectable
 Selectable (const Selectable &)
 
 Selectable (Selectable &&)
 
Selectableoperator= (const Selectable &)
 
Selectableoperator= (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 DataDevice
 DataDevice (IGTL::Connection &con, const std::string &deviceName, const Type &iglType, const std::vector< Type > &compatibleIgtlTypes, bool cloneData=false)
 Constructor.
 
- Public Member Functions inherited from Device
 Device (Connection *connection, std::string name, Type igtlType, const std::vector< Type > &compatibleIgtlTypes={})
 
 Device (const Device &other)
 
Deviceoperator= (const Device &other)
 
 Device (Device &&other) noexcept
 
Deviceoperator= (Device &&other) noexcept
 
Type deviceIgtlType () const
 Gets the device type.
 
std::string deviceName () const
 Gets the device Name.
 
std::vector< TypecompatibleIgtlTypes () const
 Returns the IgtlTypes compatible with the device.
 
bool isCompatible (const Type &type) const
 returns true if the device is compatible (i.e. can parse/process) the passed Type
 
bool isConnected () const
 returns true if the connection associated to the device is valid.
 
void resetConnection ()
 Reset the connection to nullptr. The method can be called e.g. before the connection data is deleted.
 

Static Public Member Functions

static std::vector< TypesupportedIgtlTypes ()
 
- Static Public Member Functions inherited from 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.
 
- Static Public Member Functions inherited from Device
static IO ioConfiguration ()
 Returns the IO configuration of the device (whether the device can handle input, output or both input and output operations)
 

Protected Member Functions

bool sendImageData (const MemImage &img, const mat4 &matrix, unsigned long long timestamp_ms) const
 
- Protected Member Functions inherited from SharedImageSet
virtual SharedImageSetcreateCloneContainer () const
 Internal method for creating the container object holding the clone.
 
virtual void cloneInternal (SharedImageSet &other, Flags< CloneOptions > cloneOptions) const
 Internal method for cloning which should be called from derived container classes.
 
virtual void swapWith (SharedImageSet &other)
 Internal method for swapping the contents of this container with other.
 
- Protected Member Functions inherited from Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 

Protected Attributes

std::unique_ptr< MemImagem_streamBuffer
 
bool m_updateSpacing
 
vec3 m_spacing
 
bool m_cloneData
 
- Protected Attributes inherited from SharedImageSet
std::vector< std::shared_ptr< SharedImage > > m_images
 Vector of shared image pointers.
 
std::vector< double > m_timestamps
 Optional timestamps of the image frames.
 
Properties m_properties
 Auxiliary information properties.
 
Geometry::AlignedBox m_bounds
 Axis-aligned bounding box of all images in world space.
 
bool m_updateBounds = true
 Flag specifying whether the bounds should be re-computed.
 
std::optional< Data::Modalitym_modalityOverride
 Overrides the modality of the containing SharedImages. This is used e.g. for the ConeBeamData concept in CT.
 
- Protected Attributes inherited from 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 ElementwiseDataComponentData
ElementwiseDataComponentList m_elementwiseComponents
 Encodes elementwise data components.
 
- Protected Attributes inherited from Selectable
std::mutex m_selectionMutex
 Mutex protecting the selection.
 
Selection m_sel
 
- Protected Attributes inherited from DataDevice
bool m_cloneData
 
- Protected Attributes inherited from Device
std::vector< Typem_compatibleIgtlTypes
 
Type m_iglType
 The igl types that are supported by this device for conversion from/to ImFusion data.
 
std::string m_deviceName
 Data type of the device.
 
Connectionm_iglConnection
 Device name assigned to this device.
 
std::unique_ptr< DeviceImplm_impl
 Igl Connection Object.
 

Additional Inherited Members

- Public Types inherited from SharedImageSet
enum  CloneOptions {
  Everything = 0 , NoImageData = 1 << 0 , NoDataComponents = 1 << 1 , ShallowImageCopy = 1 << 2 ,
  NoSelection = 1 << 3 , NoTracking = 1 << 4
}
 Bitset enumeration to configure which aspects of a SharedImageSet to copy. More...
 
- Public Types inherited from 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...
 
- Public Types inherited from Device
enum  IO { INPUT , OUTPUT , INPUT_OUTPUT , UNKNOWN }
 
- Public Attributes inherited from 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 Selectable
ProtectedSignal signalSelectionChanged
 Signals that the selection or size might have changed.
 
- Public Attributes inherited from DataDevice
Signal< bool > signalDataReceived
 

Member Function Documentation

◆ sendData()

bool sendData ( Data * inputData) const
overridevirtual

Implements DataDevice.


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