Image Component Library (ICL)
Public Member Functions | Private Attributes | List of all members
icl::core::PixelRef< T > Class Template Reference

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

Private Attributes

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

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

◆ PixelRef() [1/3]

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

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

◆ PixelRef() [2/3]

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)

◆ PixelRef() [3/3]

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

◆ asVec()

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

copies image data into a std::vector

◆ getChannels()

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

returns the channel count

◆ isNull()

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

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

◆ operator=() [1/3]

template<class T >
PixelRef& icl::core::PixelRef< T >::operator= ( const PixelRef< T > &  other)
inline

assignment operator which copies the values (most common)

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

◆ operator=() [2/3]

template<class T >
PixelRef& icl::core::PixelRef< T >::operator= ( const std::vector< T > &  vec)
inline

assigns reference pixel values from vector data

◆ operator=() [3/3]

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)
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);

◆ operator[]() [1/2]

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

references a single element (safe)

◆ operator[]() [2/2]

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

references a single element (const) (safe)

◆ set() [1/4]

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

sets up the first index (unsafe)

◆ set() [2/4]

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

sets up the first two indices (unsafe)

◆ set() [3/4]

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)

◆ set() [4/4]

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)

◆ setFromRange()

template<class T >
template<class ForwardIterator >
void icl::core::PixelRef< T >::setFromRange ( ForwardIterator  begin,
ForwardIterator  end 
)
inline

assigns a ranges contents to the pixel data

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

Member Data Documentation

◆ m_data

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: