#include <ScalingAccessor.hpp>
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 |
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;
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.
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 >.
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.
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 >.
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 >.
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 >.