IOLink  IOL_v1.1.0_release
iolink::ImageView Class Referenceabstract

Interface representing an N dimensional image. More...

#include <iolink/view/ImageView.h>

Inheritance diagram for iolink::ImageView:
iolink::View

Public Member Functions

size_t dimensionCount ()
 Returns the dimension of the View.
 
bool support (ImageCapabilitySet flags)
 Checks if the ImageView supports the given capabilities.
 
virtual ImageCapabilitySet capabilities () const =0
 Return the capabilities of this image.
 
virtual const VectorXu64shape ()=0
 Return the shape of the image, each component containing the size in this dimension. More...
 
virtual DataType dataType ()=0
 Return the data type of the samples of this image.
 
virtual std::shared_ptr< const ImagePropertiesproperties ()=0
 Return the view's properties.
 
std::string toString () const
 Return a string representation.
 
virtual std::shared_ptr< const MetadataNodemetadata () const
 Return the root node of the metadata attached to this image. More...
 
virtual void read (const VectorXu64 &index, void *dst)
 Read the data at the given index into a buffer. More...
 
virtual void readRegion (const RegionXu64 &region, void *dst)
 Read a region of the image into a buffer. More...
 
virtual void setProperties (std::shared_ptr< const ImageProperties > properties)
 Update the image's properties. More...
 
virtual void setMetadata (std::shared_ptr< MetadataNode > metadata)
 Attach a new metadata node to the image. More...
 
virtual void write (const VectorXu64 &index, const void *src)
 Write value from a buffer at the given index. More...
 
virtual void writeRegion (const RegionXu64 &region, const void *src)
 Write a input buffer into a given region of the image. More...
 
virtual void reshape (const VectorXu64 &shape, DataType dataType)
 Change the shape and sample data type of the image. More...
 
virtual const Indexerindexer ()
 Return an Indexer describing the memory layout of the buffer. More...
 
virtual void * buffer ()
 Return a mutable pointer to the internal memory buffer. More...
 
virtual const void * bufferReadOnly () const
 Return an immutable pointer to the internal memory buffer. More...
 
virtual size_t bufferSize ()
 Size in bytes of the internal buffer. More...
 

Detailed Description

Interface representing an N dimensional image.

This class can handle multidimensional image, for example:

  • A 2D image has 2 dimensions.
  • A 3D Volume has 3 dimensions.
  • A 2D time series has 3 dimensions, where 3rd one represent time.

This interface capabilities are indicated by the ImageCapabilitySet returned by the method ImageView::capabilities. Each capability enable the use of a specific set of methods. When one of those methods is called, if its corresponding capability is not supported, a NotImplemented exception will be thrown.

An ImageView is composed of the following parts:

  • A shape, that describes the size of the dataset along each of its axes.
  • A data type, giving info on what is stored on each element of the dataset.
  • Properties, giving generic info on the image, such as its spatial calibration, the semantic of its dimensions, and detailed information on its elements.
  • Metadata, hierarchical tree of key/value pair, describing arbitrary information.
  • Image's data itself.
See also
ImageCapability

Member Function Documentation

◆ buffer()

virtual void* iolink::ImageView::buffer ( )
virtual

Return a mutable pointer to the internal memory buffer.

Available when the ImageView has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ bufferReadOnly()

virtual const void* iolink::ImageView::bufferReadOnly ( ) const
virtual

Return an immutable pointer to the internal memory buffer.

Available when the ImageView has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ bufferSize()

virtual size_t iolink::ImageView::bufferSize ( )
virtual

Size in bytes of the internal buffer.

Available when the ImageView has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ indexer()

virtual const Indexer& iolink::ImageView::indexer ( )
virtual

Return an Indexer describing the memory layout of the buffer.

Available when the ImageView has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ metadata()

virtual std::shared_ptr<const MetadataNode> iolink::ImageView::metadata ( ) const
virtual

Return the root node of the metadata attached to this image.

Available when the ImageView has the READ capability.

Exceptions
NotImplementedIf the implementation does not support reading.

◆ read()

virtual void iolink::ImageView::read ( const VectorXu64 index,
void *  dst 
)
virtual

Read the data at the given index into a buffer.

Available when the ImageView has the READ capability.

Default implementation will call the readRegion method with a region of one pixel.

Parameters
indexthe index of the sample to read.
dstThe buffer where read data will be copied.

◆ readRegion()

virtual void iolink::ImageView::readRegion ( const RegionXu64 region,
void *  dst 
)
virtual

Read a region of the image into a buffer.

Available when the ImageView has the READ capability.

Parameters
regionThe region of the image to read from.
dstThe buffer where read data will be copied.
Exceptions
NotImplementedIf the implementation does not support reading.

◆ reshape()

virtual void iolink::ImageView::reshape ( const VectorXu64 shape,
DataType  dataType 
)
virtual

Change the shape and sample data type of the image.

Available when the ImageView has the RESHAPE capability.

All the image's data is invalidated after this operation.

Parameters
shapeThe new shape.
dataTypeThe new sample data type.
Exceptions
NotImplementedIf the implementation does not support reshaping.

◆ setMetadata()

virtual void iolink::ImageView::setMetadata ( std::shared_ptr< MetadataNode metadata)
virtual

Attach a new metadata node to the image.

Available when the ImageView has the WRITE capability.

Exceptions
NotImplementedIf the implementation does not support writing.

◆ setProperties()

virtual void iolink::ImageView::setProperties ( std::shared_ptr< const ImageProperties properties)
virtual

Update the image's properties.

Available when the ImageView has the WRITE capability.

Exceptions
NotImplementedIf the implementation does not support writing.

◆ shape()

virtual const VectorXu64& iolink::ImageView::shape ( )
pure virtual

Return the shape of the image, each component containing the size in this dimension.

Example:

  • A 2D image will return a vector with two dimension, the first being the number of columns, and the second being the number of rows.
  • A 3D image will return a vector with two dimension, the first being the number of columns, the second being the number of rows, and the third being the number of slices.

◆ write()

virtual void iolink::ImageView::write ( const VectorXu64 index,
const void *  src 
)
virtual

Write value from a buffer at the given index.

Available when the ImageView has the WRITE capability.

Default implementation will call the writeRegion method with a region of one pixel.

Parameters
indexThe index of the image's sample to write.
srcThe buffer containing the data that will be written.

◆ writeRegion()

virtual void iolink::ImageView::writeRegion ( const RegionXu64 region,
const void *  src 
)
virtual

Write a input buffer into a given region of the image.

Available when the ImageView has the WRITE capability.

Parameters
regionThe region to write.
srcThe buffer containing the data that will be written.
Exceptions
NotImplementedIf the implementation does not support writing.

The documentation for this class was generated from the following file: