imaging::CastAccessor< image_t, DATA_t > Class Template Reference
[Image Module]

Provides casted pixel data type access to images. More...

#include <CastAccessor.hpp>

Inheritance diagram for imaging::CastAccessor< image_t, DATA_t >:

imaging::ImageAccessorInterface< image_t, DATA_t > imaging::ImageInterface< image_t::dimension, DATA_t >

List of all members.

Public Types

typedef DATA_t data_t

Public Member Functions

 CastAccessor (image_t &image)
DATA_t operator[] (const ublas::fixed_vector< size_t, dimension > &index) const
data_reference operator[] (const ublas::fixed_vector< size_t, dimension > &index)

Static Public Attributes

static const size_t dimension = ImageAccessorInterface<image_t, DATA_t>::dimension


Detailed Description

template<class image_t, class DATA_t = float_t>
class imaging::CastAccessor< image_t, DATA_t >

Provides casted pixel data type access to images.

This class provides casted access to objects implementing ImageInterface. Consider e.g. a colour image that you want to use in a functions which makes sense only for scalar, i.e. grayscale images. Instead of converting the whole colour image to grayscale you can construct a CastAccessor<ColorImage2d, GrayValue> from the orginal image, which then behaves as grayscale image. The only prerequisite is that it is possible to explicitely cast the pixel value from the input image to DATA_t (and vice-versa if the user writes to the accessor). In the given example Color can be indeed casted to GrayValue and back again.


Member Typedef Documentation

template<class image_t, class DATA_t = float_t>
typedef DATA_t imaging::CastAccessor< image_t, DATA_t >::data_t

The data type which is stored in the image. Common choices are float_t for grayscale images stored at floating point precision or char for 8-bit data.

Reimplemented from imaging::ImageAccessorInterface< image_t, DATA_t >.


Constructor & Destructor Documentation

template<class image_t, class DATA_t = float_t>
imaging::CastAccessor< image_t, DATA_t >::CastAccessor ( image_t &  image  )  [inline]

Initialize the image accessor with an reference to image which must be an ImageInterface object. This reference will be stored and accessed when the image accessor is utilized. The dimensions of the accessor are the same as those of image.

Note that it must be possible to explicitely cast from image_t::data_t to DATA_t (and from DATA_t to image_t::data_t for write access) to use the accessor.


Member Function Documentation

template<class image_t, class DATA_t = float_t>
DATA_t imaging::CastAccessor< image_t, DATA_t >::operator[] ( const ublas::fixed_vector< size_t, dimension > &  index  )  const [inline]

Returns a constant reference to a pixel.

Reimplemented from imaging::ImageInterface< image_t::dimension, DATA_t >.

template<class image_t, class DATA_t = float_t>
data_reference imaging::CastAccessor< image_t, DATA_t >::operator[] ( const ublas::fixed_vector< size_t, dimension > &  index  )  [inline]

Returns a reference to a pixel. This function might not be implemented for accessor classes to constant data, such as ConstImageAccessorInterface().

Reimplemented from imaging::ImageInterface< image_t::dimension, DATA_t >.


Member Data Documentation

template<class image_t, class DATA_t = float_t>
const size_t imaging::CastAccessor< image_t, DATA_t >::dimension = ImageAccessorInterface<image_t, DATA_t>::dimension [static]

The dimension of the image. It equals 2 for planar images and 3 for voxel-data.

Reimplemented from imaging::ImageAccessorInterface< image_t, DATA_t >.


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

Generated on Tue Feb 10 10:01:31 2009 for imaging2 by  doxygen 1.5.5