imaging::ScalingAccessor< float_accessor_t > Class Template Reference
[Image Module]

Provides access to rescaled floating point images. More...

#include <ScalingAccessor.hpp>

Inheritance diagram for imaging::ScalingAccessor< float_accessor_t >:

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

List of all members.

Public Types

typedef float_t data_t

Public Member Functions

 ScalingAccessor (float_accessor_t &image, float_t factor=1.0, float_t level=0.0)
float_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<float_accessor_t, float_t>::dimension


Detailed Description

template<class float_accessor_t>
class imaging::ScalingAccessor< float_accessor_t >

Provides access to rescaled floating point images.

This class allows you to access values of an image with floating point pixels after an affine transformation of the pixel values. Consider the following code:

  img::ScalingAccessor< img::Image<2, img::float_t> accessor(some_image, 1.0 / 128.0, -128.0);
  ublas::fixed_vector<2, img::size_t> lower_left(0, 0);
  float_t x = some_image[lower_left];
  float_t y = accessor[lower_left];
  accessor[lower_left] = 0.0;
Then $x$ and $y$ are related in the following way:

\[ y = \frac{1}{128} (x - 128) \quad\textrm{and}\quad x = 128 y + 128 \,. \]

I.e. accessor will scale an image with grayscale values in [0, 256[ to an image with values in [-1, 1[. If you assign a value in [-1, 1[ to the accessor it will implicitely convert it back to [0, 255[ and assign this converted value to some_image. In the above example this means that some_image[lower_left] will be set to 128.


Member Typedef Documentation

template<class float_accessor_t>
typedef float_t imaging::ScalingAccessor< float_accessor_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 float_accessor_t>
imaging::ScalingAccessor< float_accessor_t >::ScalingAccessor ( float_accessor_t &  image,
float_t  factor = 1.0,
float_t  level = 0.0 
) [inline]

Initialize the image accessor with an reference to image which must be an ImageInterface object storing floating point. 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. Accessed pixel values in image will be first offset by level and then rescaled by factor.


Member Function Documentation

template<class float_accessor_t>
float_t imaging::ScalingAccessor< float_accessor_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 float_accessor_t>
data_reference imaging::ScalingAccessor< float_accessor_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 float_accessor_t>
const size_t imaging::ScalingAccessor< float_accessor_t >::dimension = ImageAccessorInterface<float_accessor_t, float_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