Image Component Library (ICL)
|
Pixel-Type class for copying image pixles to image pixels. More...
#include <PixelRef.h>
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) | |
PixelRef & | operator= (const PixelRef &other) throw (utils::ICLException) |
assignment operator which copies the values (most common) | |
PixelRef & | operator= (const std::vector< T > &vec) throw (utils::ICLException) |
assigns reference pixel values from vector data | |
template<class MT , unsigned int COLS, unsigned int ROWS> | |
PixelRef & | operator= (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. |
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.
icl::core::PixelRef< T >::PixelRef | ( | ) | [inline] |
Empty constructor, create a null pixel ref with 0 length.
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)
icl::core::PixelRef< T >::PixelRef | ( | const PixelRef< T > & | other | ) | [inline] |
PixelRef copy constructor (copies the reference, not the values)
std::vector<T> icl::core::PixelRef< T >::asVec | ( | ) | const [inline] |
copies image data into a std::vector
int icl::core::PixelRef< T >::getChannels | ( | ) | const [inline] |
returns the channel count
bool icl::core::PixelRef< T >::isNull | ( | ) | const [inline] |
returs whether this instance is null (created with the empty constructor)
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);
PixelRef& icl::core::PixelRef< T >::operator= | ( | const std::vector< T > & | vec | ) | throw (utils::ICLException) [inline] |
assigns reference pixel values from vector data
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);
T& icl::core::PixelRef< T >::operator[] | ( | unsigned int | channel | ) | throw (utils::ICLException) [inline] |
references a single element (safe)
const T& icl::core::PixelRef< T >::operator[] | ( | unsigned int | channel | ) | const throw (utils::ICLException) [inline] |
references a single element (const) (safe)
void icl::core::PixelRef< T >::set | ( | const T & | v0 | ) | [inline] |
sets up the first index (unsafe)
void icl::core::PixelRef< T >::set | ( | const T & | v0, |
const T & | v1 | ||
) | [inline] |
sets up the first two indices (unsafe)
void icl::core::PixelRef< T >::set | ( | const T & | v0, |
const T & | v1, | ||
const T & | v2 | ||
) | [inline] |
sets up the first three indices (unsafe)
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)
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
std::vector<T*> icl::core::PixelRef< T >::m_data [private] |
Internal data.