Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
icl::core::PixelRef< T > Class Template Reference

Pixel-Type class for copying image pixles to image pixels. More...

#include <PixelRef.h>

List of all members.

Public Member Functions

 PixelRef ()
 Empty constructor, create a null pixel ref with 0 length.
bool isNull () const
 returs whether this instance is null (created with the empty constructor)
 PixelRef (int x, int y, int width, std::vector< utils::SmartArray< T > > &data)
 single constructor to create a pixelref instance
 PixelRef (const PixelRef &other)
 PixelRef copy constructor (copies the reference, not the values)
PixelRefoperator= (const PixelRef &other) throw (utils::ICLException)
 assignment operator which copies the values (most common)
PixelRefoperator= (const std::vector< T > &vec) throw (utils::ICLException)
 assigns reference pixel values from vector data
template<class MT , unsigned int COLS, unsigned int ROWS>
PixelRefoperator= (const math::FixedMatrix< MT, COLS, ROWS > &mat) throw (utils::ICLException)
 assigns reference pixel values from FixedMatrix data
std::vector< T > asVec () const
 copies image data into a std::vector
void set (const T &v0)
 sets up the first index (unsafe)
void set (const T &v0, const T &v1)
 sets up the first two indices (unsafe)
void set (const T &v0, const T &v1, const T &v2)
 sets up the first three indices (unsafe)
void set (const T &v0, const T &v1, const T &v2, const T &v3)
 sets up the first four indices (unsafe)
template<class ForwardIterator >
void setFromRange (ForwardIterator begin, ForwardIterator end) throw (utils::ICLException)
 assigns a ranges contents to the pixel data
T & operator[] (unsigned int channel) throw (utils::ICLException)
 references a single element (safe)
const T & operator[] (unsigned int channel) const throw (utils::ICLException)
 references a single element (const) (safe)
int getChannels () const
 returns the channel count

Private Attributes

std::vector< T * > m_data
 Internal data.

Detailed Description

template<class T>
class icl::core::PixelRef< T >

Pixel-Type class for copying image pixles to image pixels.

PixelRef instances are returned by an images operator()(int x, int y) It allows to write: Img8u a = ...; Img8u b = ...;

a(5,6) = b(3,2); Furthermore it provides a list of setter functions, which allow to set up image pixels form other data types like vectors, ranges (iterator based) and even icl::FixedMatrix.

Most of the functions are channel count save, i.e. they throw an ICLException if source channel count is not compatible.


Constructor & Destructor Documentation

template<class T>
icl::core::PixelRef< T >::PixelRef ( ) [inline]

Empty constructor, create a null pixel ref with 0 length.

template<class T>
icl::core::PixelRef< T >::PixelRef ( int  x,
int  y,
int  width,
std::vector< utils::SmartArray< T > > &  data 
) [inline]

single constructor to create a pixelref instance

This should not be used manually. Rather you should use Img<T>'s operator()(int x, int y)

template<class T>
icl::core::PixelRef< T >::PixelRef ( const PixelRef< T > &  other) [inline]

PixelRef copy constructor (copies the reference, not the values)


Member Function Documentation

template<class T>
std::vector<T> icl::core::PixelRef< T >::asVec ( ) const [inline]

copies image data into a std::vector

template<class T>
int icl::core::PixelRef< T >::getChannels ( ) const [inline]

returns the channel count

template<class T>
bool icl::core::PixelRef< T >::isNull ( ) const [inline]

returs whether this instance is null (created with the empty constructor)

template<class T>
PixelRef& icl::core::PixelRef< T >::operator= ( const PixelRef< T > &  other) throw (utils::ICLException) [inline]

assignment operator which copies the values (most common)

This operator allows to write imageA(x,y) = imageB(a,b);

template<class T>
PixelRef& icl::core::PixelRef< T >::operator= ( const std::vector< T > &  vec) throw (utils::ICLException) [inline]

assigns reference pixel values from vector data

template<class T>
template<class MT , unsigned int COLS, unsigned int ROWS>
PixelRef& icl::core::PixelRef< T >::operator= ( const math::FixedMatrix< MT, COLS, ROWS > &  mat) throw (utils::ICLException) [inline]

assigns reference pixel values from FixedMatrix data

This can e.g. be used to assign an icl::Color value to an image pixel (Color is a part of the ICLCore package, and it is typedef'ed to some FixedMatrix type)

imageA(x,y) = Color(2,3,4);

template<class T>
T& icl::core::PixelRef< T >::operator[] ( unsigned int  channel) throw (utils::ICLException) [inline]

references a single element (safe)

template<class T>
const T& icl::core::PixelRef< T >::operator[] ( unsigned int  channel) const throw (utils::ICLException) [inline]

references a single element (const) (safe)

template<class T>
void icl::core::PixelRef< T >::set ( const T &  v0) [inline]

sets up the first index (unsafe)

template<class T>
void icl::core::PixelRef< T >::set ( const T &  v0,
const T &  v1 
) [inline]

sets up the first two indices (unsafe)

template<class T>
void icl::core::PixelRef< T >::set ( const T &  v0,
const T &  v1,
const T &  v2 
) [inline]

sets up the first three indices (unsafe)

template<class T>
void icl::core::PixelRef< T >::set ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3 
) [inline]

sets up the first four indices (unsafe)

template<class T>
template<class ForwardIterator >
void icl::core::PixelRef< T >::setFromRange ( ForwardIterator  begin,
ForwardIterator  end 
) throw (utils::ICLException) [inline]

assigns a ranges contents to the pixel data

An exception is only thrown of the given range is too short


Member Data Documentation

template<class T>
std::vector<T*> icl::core::PixelRef< T >::m_data [private]

Internal data.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines