[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

| VectorComponentAccessor Class Template Reference |
--- | --- | ---

Accessor for one component of a vector. More...

`#include "vigra/accessor.hxx"`

## Public Types

typedef VECTORTYPE::value_type | value_type

## Public Methods

| VectorComponentAccessor (int index)
template<class ITERATOR> value_type const & | operator() (ITERATOR const &i) const
template<class ITERATOR, class DIFFERENCE> value_type const & | operator() (ITERATOR const &i, DIFFERENCE const &diff) const
template<class V, class ITERATOR> void | set (V const &value, ITERATOR const &i) const
template<class V, class ITERATOR, class DIFFERENCE> void | set (V const &value, ITERATOR const &i, DIFFERENCE const &diff) const
void | setIndex (int i)

## Detailed Description

### template<class VECTORTYPE>
class vigra::VectorComponentAccessor< VECTORTYPE >

Accessor for one component of a vector.

This accessor allows to select a single component (a single 'band') of a vector valued pixel type. The pixel type must support `operator[]`. The index of the component to be selected is passed in the constructor. The accessor returns its items by reference. If you want to pass/return items by value, use VectorComponentValueAccessor. If a floating point number is assigned by means of an accessor with integral value_type, the value is rounded and clipped as appropriate.

Usage:

        vigra::BRGBImage image(w,h);

        // init red channel with 255
        initImage(destImageRange(image,
                                 VectorComponentAccessor<vigra::BRGBImage::value_type>(0)),
                  255);

#include "vigra/accessor.hxx"
Namespace: vigra

## Member Typedef Documentation

typedef VECTORTYPE::value_type value_type

| the value_type

## Constructor & Destructor Documentation

VectorComponentAccessor | ( | int | index | ) | `[inline]`

| determine the component to be accessed

## Member Function Documentation

value_type const& operator() | ( | ITERATOR const & | i,
|  | DIFFERENCE const & | diff
| ) | const`[inline]`

| read the data item at an offset (can be 1D or 2D or higher order difference).

value_type const& operator() | ( | ITERATOR const & | i | ) | const`[inline]`

| read the current data item

void set | ( | V const & | value,
|  | ITERATOR const & | i,
|  | DIFFERENCE const & | diff
| ) | const`[inline]`

| Write the data item at an offset (can be 1D or 2D or higher order difference).. The type `V` of the passed in `value` is automatically converted to `value_type`. In case of a conversion floating point -> intergral this includes rounding and clipping.

void set | ( | V const & | value,
|  | ITERATOR const & | i
| ) | const`[inline]`

| Write the current data item. The type `V` of the passed in `value` is automatically converted to `value_type`. In case of a conversion floating point -> intergral this includes rounding and clipping.

void setIndex | ( | int | i | ) | `[inline]`

| Reset the index to the given number.

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

- vigra/accessor.hxx

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.5.0 (7 Dec 2006)