IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
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.
 
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.
 
virtual void read (const VectorXu64 &index, void *dst)
 Read the data at the given index into a buffer.
 
virtual void readRegion (const RegionXu64 &region, void *dst)
 Read a region of the image into a buffer.
 
ImageInterpretation imageInterpretation ()
 Shortcut to access Image interpretation from image properties.
 
ImageType axesInterpretation ()
 Shortcut to access axes interpretation from image properties.
 
Vector3d spatialOrigin ()
 Shortcut to access spatial origin from image properties.
 
Vector3d spatialSpacing ()
 Shortcut to access spatial spacing from image properties.
 
std::string spatialUnit ()
 Shortcut to access the spatial unit from image properties.
 
const SpatialDirectionsspatialDirections ()
 Shortcut to access spatial directions from image properties.
 
size_t bitDepth ()
 Shortcut to access the sample bitdepth from image properties.
 
bool hasAlpha ()
 Shortcut to access hasAlpha status from image properties.
 
Vector2d valueRange ()
 Shortcut to access the sample value range from image properties.
 
virtual void setProperties (std::shared_ptr< const ImageProperties > properties)
 Update the image's properties.
 
virtual void setMetadata (std::shared_ptr< MetadataNode > metadata)
 Attach a new metadata node to the image.
 
virtual void write (const VectorXu64 &index, const void *src)
 Write value from a buffer at the given index.
 
virtual void writeRegion (const RegionXu64 &region, const void *src)
 Write a input buffer into a given region of the image.
 
void setImageInterpretation (const ImageInterpretation interpretation)
 Shortcut to set Image interpretation into image properties.
 
void setAxesInterpretation (const ImageType type)
 Shortcut to set axes interpretation into image properties.
 
void setSpatialOrigin (const Vector3d &origin)
 Shortcut to set spatial origin into image properties.
 
void setSpatialSpacing (const Vector3d &spacing)
 Shortcut to set spatial spacing into image properties.
 
void setSpatialUnit (const std::string &unit)
 Shortcut to set spatial unit into image properties.
 
void setSpatialDirections (const SpatialDirections &directions)
 Shortcut to set spatial direcitons into image properties.
 
void setBitDepth (size_t bitDepth)
 Shortcut to set sample bitdepth into image properties.
 
void setAlpha (bool value)
 Shortcut to indicate the presence of an alpha channel into image properties.
 
void setValueRange (const Vector2d &range)
 Shortcut to set sample value range into image properties.
 
virtual void reshape (const VectorXu64 &shape, DataType dataType)
 Change the shape and sample data type of the image.
 
virtual const Indexerindexer ()
 Return an Indexer describing the memory layout of the buffer.
 
virtual void * buffer ()
 Return a mutable pointer to the internal CPU memory buffer.
 
virtual const void * bufferReadOnly () const
 Return an immutable pointer to the internal CPU memory buffer.
 
virtual size_t bufferSize ()
 Size in bytes of the internal CPU buffer.
 
std::shared_ptr< TilingInfoExtensiontilingInfo ()
 Shortcut to retrieve TilingInfo extension.
 
std::shared_ptr< ParallelAccessExtensionparallelAccess ()
 Shortcut to retrieve ParallelAccess extension.
 

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

◆ axesInterpretation()

ImageType iolink::ImageView::axesInterpretation ( )

Shortcut to access axes interpretation from image properties.

Returns
axes interpretation of the image

◆ bitDepth()

size_t iolink::ImageView::bitDepth ( )

Shortcut to access the sample bitdepth from image properties.

Returns
bitdepth of the image

◆ buffer()

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

Return a mutable pointer to the internal CPU 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 CPU 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 CPU buffer.

Available when the ImageView has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ hasAlpha()

bool iolink::ImageView::hasAlpha ( )

Shortcut to access hasAlpha status from image properties.

Returns
TRUE if image has an alpha channel, FALSE otherwise

◆ imageInterpretation()

ImageInterpretation iolink::ImageView::imageInterpretation ( )

Shortcut to access Image interpretation from image properties.

Returns
interpretation of the image

◆ 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.

◆ setAlpha()

void iolink::ImageView::setAlpha ( bool  value)

Shortcut to indicate the presence of an alpha channel into image properties.

Parameters
valueTRUE if image has an alpha channel, FALSE otherwise

◆ setAxesInterpretation()

void iolink::ImageView::setAxesInterpretation ( const ImageType  type)

Shortcut to set axes interpretation into image properties.

Parameters
typeAxes interpretation to set

◆ setBitDepth()

void iolink::ImageView::setBitDepth ( size_t  bitDepth)

Shortcut to set sample bitdepth into image properties.

Parameters
bitDepthbitDepth to set

◆ setImageInterpretation()

void iolink::ImageView::setImageInterpretation ( const ImageInterpretation  interpretation)

Shortcut to set Image interpretation into image properties.

Parameters
interpretationImage interpretation to set

◆ 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.

◆ setSpatialDirections()

void iolink::ImageView::setSpatialDirections ( const SpatialDirections directions)

Shortcut to set spatial direcitons into image properties.

Parameters
directionsspatial directions to set

◆ setSpatialOrigin()

void iolink::ImageView::setSpatialOrigin ( const Vector3d origin)

Shortcut to set spatial origin into image properties.

Parameters
originspatial origin to set

◆ setSpatialSpacing()

void iolink::ImageView::setSpatialSpacing ( const Vector3d spacing)

Shortcut to set spatial spacing into image properties.

Parameters
spacingspatial spacing to set

◆ setSpatialUnit()

void iolink::ImageView::setSpatialUnit ( const std::string &  unit)

Shortcut to set spatial unit into image properties.

Parameters
unitspatial unit to set

◆ setValueRange()

void iolink::ImageView::setValueRange ( const Vector2d range)

Shortcut to set sample value range into image properties.

Parameters
rangevalue range to set

◆ 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.

◆ spatialDirections()

const SpatialDirections & iolink::ImageView::spatialDirections ( )

Shortcut to access spatial directions from image properties.

Returns
spatial directions of the image

◆ spatialOrigin()

Vector3d iolink::ImageView::spatialOrigin ( )

Shortcut to access spatial origin from image properties.

Returns
spatial origin of the image

◆ spatialSpacing()

Vector3d iolink::ImageView::spatialSpacing ( )

Shortcut to access spatial spacing from image properties.

Returns
spatial spacing of the image

◆ spatialUnit()

std::string iolink::ImageView::spatialUnit ( )

Shortcut to access the spatial unit from image properties.

Returns
spatial unit of the image

◆ valueRange()

Vector2d iolink::ImageView::valueRange ( )

Shortcut to access the sample value range from image properties.

Returns
value range for the image samples

◆ 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: