IOLink IOL_v1.8.0_release
|
Interface representing an N dimensional image. More...
#include <iolink/view/ImageView.h>
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 VectorXu64 & | shape ()=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 ImageProperties > | properties ()=0 |
Return the view's properties. | |
std::string | toString () const |
Return a string representation. | |
virtual std::shared_ptr< const MetadataNode > | metadata () 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 ®ion, 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 SpatialDirections & | spatialDirections () |
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 ®ion, 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 Indexer & | indexer () |
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< TilingInfoExtension > | tilingInfo () |
Shortcut to retrieve TilingInfo extension. | |
std::shared_ptr< ParallelAccessExtension > | parallelAccess () |
Shortcut to retrieve ParallelAccess extension. | |
Public Member Functions inherited from iolink::View | |
virtual std::shared_ptr< Extension > | extension (size_t id) |
Get an extension of the view, corresponding to the given identifier. | |
std::shared_ptr< ViewOriginExtension > | viewOrigin () |
Shortcut to access to ViewOrigin extension. | |
Interface representing an N dimensional image.
This class can handle multidimensional image, for example:
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:
ImageType iolink::ImageView::axesInterpretation | ( | ) |
Shortcut to access axes interpretation from image properties.
size_t iolink::ImageView::bitDepth | ( | ) |
Shortcut to access the sample bitdepth from image properties.
|
virtual |
Return a mutable pointer to the internal CPU memory buffer.
Available when the ImageView has the MEMORY_ACCESS capability.
NotImplemented | If the implementation does not support memory access. |
|
virtual |
Return an immutable pointer to the internal CPU memory buffer.
Available when the ImageView has the MEMORY_ACCESS capability.
NotImplemented | If the implementation does not support memory access. |
|
virtual |
Size in bytes of the internal CPU buffer.
Available when the ImageView has the MEMORY_ACCESS capability.
NotImplemented | If the implementation does not support memory access. |
bool iolink::ImageView::hasAlpha | ( | ) |
Shortcut to access hasAlpha status from image properties.
ImageInterpretation iolink::ImageView::imageInterpretation | ( | ) |
Shortcut to access Image interpretation from image properties.
|
virtual |
Return an Indexer describing the memory layout of the buffer.
Available when the ImageView has the MEMORY_ACCESS capability.
NotImplemented | If the implementation does not support memory access. |
|
virtual |
Return the root node of the metadata attached to this image.
Available when the ImageView has the READ capability.
NotImplemented | If the implementation does not support reading. |
|
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.
index | the index of the sample to read. |
dst | The buffer where read data will be copied. |
|
virtual |
Read a region of the image into a buffer.
Available when the ImageView has the READ capability.
region | The region of the image to read from. |
dst | The buffer where read data will be copied. |
NotImplemented | If the implementation does not support reading. |
|
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.
shape | The new shape. |
dataType | The new sample data type. |
NotImplemented | If the implementation does not support reshaping. |
void iolink::ImageView::setAlpha | ( | bool | value | ) |
Shortcut to indicate the presence of an alpha channel into image properties.
value | TRUE if image has an alpha channel, FALSE otherwise |
void iolink::ImageView::setAxesInterpretation | ( | const ImageType | type | ) |
Shortcut to set axes interpretation into image properties.
type | Axes interpretation to set |
void iolink::ImageView::setBitDepth | ( | size_t | bitDepth | ) |
Shortcut to set sample bitdepth into image properties.
bitDepth | bitDepth to set |
void iolink::ImageView::setImageInterpretation | ( | const ImageInterpretation | interpretation | ) |
Shortcut to set Image interpretation into image properties.
interpretation | Image interpretation to set |
|
virtual |
Attach a new metadata node to the image.
Available when the ImageView has the WRITE capability.
NotImplemented | If the implementation does not support writing. |
|
virtual |
Update the image's properties.
Available when the ImageView has the WRITE capability.
NotImplemented | If the implementation does not support writing. |
void iolink::ImageView::setSpatialDirections | ( | const SpatialDirections & | directions | ) |
Shortcut to set spatial direcitons into image properties.
directions | spatial directions to set |
void iolink::ImageView::setSpatialOrigin | ( | const Vector3d & | origin | ) |
Shortcut to set spatial origin into image properties.
origin | spatial origin to set |
void iolink::ImageView::setSpatialSpacing | ( | const Vector3d & | spacing | ) |
Shortcut to set spatial spacing into image properties.
spacing | spatial spacing to set |
void iolink::ImageView::setSpatialUnit | ( | const std::string & | unit | ) |
Shortcut to set spatial unit into image properties.
unit | spatial unit to set |
void iolink::ImageView::setValueRange | ( | const Vector2d & | range | ) |
Shortcut to set sample value range into image properties.
range | value range to set |
|
pure virtual |
Return the shape of the image, each component containing the size in this dimension.
Example:
const SpatialDirections & iolink::ImageView::spatialDirections | ( | ) |
Shortcut to access spatial directions from image properties.
Vector3d iolink::ImageView::spatialOrigin | ( | ) |
Shortcut to access spatial origin from image properties.
Vector3d iolink::ImageView::spatialSpacing | ( | ) |
Shortcut to access spatial spacing from image properties.
std::string iolink::ImageView::spatialUnit | ( | ) |
Shortcut to access the spatial unit from image properties.
Vector2d iolink::ImageView::valueRange | ( | ) |
Shortcut to access the sample value range from image properties.
|
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.
index | The index of the image's sample to write. |
src | The buffer containing the data that will be written. |
|
virtual |
Write a input buffer into a given region of the image.
Available when the ImageView has the WRITE capability.
region | The region to write. |
src | The buffer containing the data that will be written. |
NotImplemented | If the implementation does not support writing. |