DD::Image::GenericImagePlane Class Reference

Class to wrap up an image plane of arbitrary type. This is used by the readers to return image data with the minimal amount of conversion needed. More...

Public Member Functions

 GenericImagePlane (const GenericImagePlaneDescriptor &desc)
 ctor, relying on our own allocation
 
 GenericImagePlane (const GenericImagePlaneDescriptor &desc, HandlePtr handle)
 
const GenericImagePlaneDescriptordesc () const
 
ptrdiff_t rowStrideBytes () const
 
ptrdiff_t colStrideBytes () const
 
ptrdiff_t chanStrideBytes () const
 
template<class T >
const T & at (int x, int y, int z) const
 Get a reference to the data at (x, y) with the channel number /z/.
 
template<class T >
T & writableAt (int x, int y, int z)
 Get a reference to the data at (x, y) with the channel number /z/.
 
void clearImage ()
 Clears the image by writing 0 into the entire buffer.
 

Protected Member Functions

void SetStrides ()
 
const char * address (int x, int y, int z) const
 
void CheckType (unsigned char testVariable)
 
void CheckType (unsigned short testVariable)
 
void CheckType (unsigned int testVariable)
 
void CheckType (half testVariable)
 
void CheckType (float testVariable)
 

Protected Attributes

GenericImagePlaneDescriptor _desc
 
HandlePtr _handle
 
char * _data
 base address of our image, kept as a char for address maths
 
ptrdiff_t _rowStrideBytes
 
ptrdiff_t _colStrideBytes
 The stride between columns in bytes.
 
ptrdiff_t _chanStrideBytes
 The stride between channels in bytes.
 

Detailed Description

Class to wrap up an image plane of arbitrary type. This is used by the readers to return image data with the minimal amount of conversion needed.

TODO - refactor ImagePlane and it's floatingpoint refcounted thing to be compatible with this (via assigment and CC both ways, with checks for types being right).

Constructor & Destructor Documentation

DD::Image::GenericImagePlane::GenericImagePlane ( const GenericImagePlaneDescriptor desc,
HandlePtr  handle 
)
inline

Constructor using a specific chunk of memory in which we want the image data stored.

Note
Make sure the specified memory is large enough to hold the image plane described by the specified descriptor (bounds, bit depth and channel count).

References SetStrides().

Member Function Documentation

void DD::Image::GenericImagePlane::SetStrides ( )
inlineprotected

Helper function to calculate the various strides given the information in the GenericImagePlaneDescriptor member _desc, which must have been set before the call to SetStrides().

References _chanStrideBytes, _colStrideBytes, and _rowStrideBytes.

Referenced by GenericImagePlane().

void DD::Image::GenericImagePlane::CheckType ( unsigned char  testVariable)
inlineprotected

The various CheckType() functions are used to assert that the type on which at() or writableAt() have been templatised corresponds to the enumerated type of the descriptor's data info, which is determined at runtime.

Member Data Documentation

ptrdiff_t DD::Image::GenericImagePlane::_rowStrideBytes
protected

The stride between rows in bytes. This depends on the channel data type and the number of channels and/or image width, according to whether the image plane is packed or not (as specified by GenericImagePlaneDescriptor::_packed).

Referenced by SetStrides().



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk