Wavelet and Image class library  1.3.2
Public Member Functions | Protected Member Functions | Protected Attributes
ImageArray< T > Class Template Reference

#include <ImageArray.hh>

Inheritance diagram for ImageArray< T >:
Inheritance graph
[legend]
Collaboration diagram for ImageArray< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImageArray (void)
 ImageArray (int rows, int cols)
virtual ~ImageArray (void)
int rows (void) const
int cols (void) const
int size (void) const
at (int y, int x) const
virtual T at (int abs) const
void to (int y, int x, T val)
virtual void to (int abs, T val)
virtual int abs (int y, int x) const
smax (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
smin (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
amax (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
amin (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
saverage (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
aaverage (int fromY=0, int fromX=0, int toY=-1, int toX=-1) const
virtual void resize (int rows, int cols)
virtual void import (int rows, int cols, T *array)
virtual ImageArray< T > * clone (void) const
virtual void copy (ImageArray< T > &ia)
void copy (ImageArray< T > *ia)
virtual bool epsilons (ImageArray< T > &ia, T epsilon) const
bool epsilons (ImageArray< T > *ia, T epsilon) const
bool equals (ImageArray< T > &ia) const
bool equals (ImageArray< T > *ia) const
T *& array (void)

Protected Member Functions

virtual void updateRowsArray (void)

Protected Attributes

int m_xsize
int m_ysize
int m_xysize
T * m_ar
int * m_rows

Detailed Description

template<class T>
class ImageArray< T >

A two-dimensional array wrapper. This allows us to access the image's pixels or coefficients and provides some utility methods. It is the main working horse for the Image framework.

Definition at line 23 of file ImageArray.hh.


Constructor & Destructor Documentation

template<class T>
ImageArray< T >::ImageArray ( void  )

Constructor. Sets the dimension to zero.

template<class T>
ImageArray< T >::ImageArray ( int  rows,
int  cols 
)

Constructor. Sets the dimension and allocates space. A size of zero is allowed, negative values not.

Parameters:
rowsthe vertical size
colsthe horizontal size
template<class T>
virtual ImageArray< T >::~ImageArray ( void  ) [virtual]

Destructor. Releases allocated memory.


Member Function Documentation

template<class T>
T ImageArray< T >::aaverage ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Return the average color for a rectangular region inside the image drawn from one point within and the second point just outside the region. The coefficients' signedness will be discarded.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the average color

Referenced by StillImage::aaverage().

template<class T>
virtual int ImageArray< T >::abs ( int  y,
int  x 
) const [inline, virtual]

Return the absolute offset of a position.

Parameters:
ythe position's row
xthe position's col
Returns:
the absolute offset

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Definition at line 89 of file ImageArray.hh.

Referenced by StillImage::abs(), ImageArray< coeff >::at(), and ImageArray< coeff >::to().

template<class T>
T ImageArray< T >::amax ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Returns the maximum absolute value in a region. Signs will be discarded.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the maximum

Referenced by StillImage::amax().

template<class T>
T ImageArray< T >::amin ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Returns the minimum absolute value in a region. Signs will be discarded.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the minimum

Referenced by StillImage::amin().

template<class T>
T*& ImageArray< T >::array ( void  ) [inline]

Physical access to the array. This is dangerous but necessary for performance reasons because we sometimes need to fill the array with more than one value at a time.

Returns:
a reference to the array

Definition at line 212 of file ImageArray.hh.

template<class T>
T ImageArray< T >::at ( int  y,
int  x 
) const [inline]

Returns the value at (x,y).

Parameters:
ythe row
xthe col
Returns:
the value

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Definition at line 59 of file ImageArray.hh.

Referenced by StillImage::at().

template<class T>
virtual T ImageArray< T >::at ( int  abs) const [inline, virtual]

Returns the array's {n}th value.

Parameters:
absthe offset from the array start
Returns:
the value

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Definition at line 66 of file ImageArray.hh.

template<class T>
virtual ImageArray<T>* ImageArray< T >::clone ( void  ) const [virtual]

Create a copy. All values will be duplicated rather than the references.

Returns:
the new object

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

template<class T>
int ImageArray< T >::cols ( void  ) const [inline]

Returns the horizontal size.

Returns:
the horizontal size

Definition at line 47 of file ImageArray.hh.

template<class T>
virtual void ImageArray< T >::copy ( ImageArray< T > &  ia) [virtual]

Copy from a different array.

Parameters:
iathe other array

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

template<class T>
void ImageArray< T >::copy ( ImageArray< T > *  ia) [inline]

Copy from a different array.

Parameters:
iathe other array

Definition at line 173 of file ImageArray.hh.

Referenced by ImageArray< coeff >::copy().

template<class T>
virtual bool ImageArray< T >::epsilons ( ImageArray< T > &  ia,
epsilon 
) const [virtual]

Rough comparison. See if two arrays are similar according to a given {epsilon} (important for floating-point comparisons).

Parameters:
iathe other {ImageArray} object
epsilonthe epsilon
Returns:
if both are identical: {true}, else {false}

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Referenced by ImageArray< coeff >::equals().

template<class T>
bool ImageArray< T >::epsilons ( ImageArray< T > *  ia,
epsilon 
) const [inline]

Rough comparison. See if two arrays are similar according to a given {epsilon} (important for floating-point comparisons).

Parameters:
iathe other {ImageArray} object
epsilonthe epsilon
Returns:
if both are identical: {true}, else {false}

Definition at line 191 of file ImageArray.hh.

Referenced by ImageArray< coeff >::epsilons().

template<class T>
bool ImageArray< T >::equals ( ImageArray< T > &  ia) const [inline]

Exact comparison. See if two arrays are similar.

Parameters:
iathe other {ImageArray} object
Returns:
if both are identical: {true}, else {false}

Definition at line 198 of file ImageArray.hh.

template<class T>
bool ImageArray< T >::equals ( ImageArray< T > *  ia) const [inline]

Exact comparison. See if two arrays are similar.

Parameters:
iathe other {ImageArray} object
Returns:
if both are identical: {true}, else {false}

Definition at line 205 of file ImageArray.hh.

Referenced by ImageArray< coeff >::equals().

template<class T>
virtual void ImageArray< T >::import ( int  rows,
int  cols,
T *  array 
) [virtual]

Import a raw array. The new dimensions and the new array will be stored discarding the old ones.

Parameters:
rowsthe new number of rows
colsthe new number of cols
arraythe new array

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

template<class T>
virtual void ImageArray< T >::resize ( int  rows,
int  cols 
) [virtual]

Resize the array. The old values will be copied to the new dimension as far as they fit in. The new dimensions must all be greater than zero.

Exceptions:
invalid_argumentone or both dimensions are either negative or zero
Parameters:
rowsthe new number of rows
colsthe new number of cols

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

template<class T>
int ImageArray< T >::rows ( void  ) const [inline]

Returns the vertical size.

Returns:
the vertical size

Definition at line 43 of file ImageArray.hh.

template<class T>
T ImageArray< T >::saverage ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Return the average color for a rectangular region inside the image drawn from one point within and the second point just outside the region. The coefficients' signedness will be considered.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the average color

Referenced by StillImage::saverage().

template<class T>
int ImageArray< T >::size ( void  ) const [inline]

Returns the overall size (x*y).

Returns:
the overall size

Definition at line 51 of file ImageArray.hh.

template<class T>
T ImageArray< T >::smax ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Returns the maximum value in a region. Signs will be considered.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the maximum

Referenced by StillImage::smax().

template<class T>
T ImageArray< T >::smin ( int  fromY = 0,
int  fromX = 0,
int  toY = -1,
int  toX = -1 
) const

Returns the minimum value in a region. Signs will be considered.

Parameters:
fromYthe first point's row
fromXthe first point's col
toYthe second point's row (-1 if lower image border)
toXthe second point's col (-1 if right image border)
Returns:
the minimum

Referenced by StillImage::smin().

template<class T>
void ImageArray< T >::to ( int  y,
int  x,
val 
) [inline]

Sets the value at (x,y).

Parameters:
ythe row
xthe col
valthe value

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Definition at line 74 of file ImageArray.hh.

Referenced by StillImage::to().

template<class T>
virtual void ImageArray< T >::to ( int  abs,
val 
) [inline, virtual]

Sets the array's {n}th value.

Parameters:
absthe offset from the array start
valthe value

Reimplemented in VideoArray< T >, and VideoArray< coeff >.

Definition at line 80 of file ImageArray.hh.

template<class T>
virtual void ImageArray< T >::updateRowsArray ( void  ) [protected, virtual]

Allocates and sets the `m_rows' member (e.g. after a resize or in the constructor). If `m_rows' is not NULL it will be deleted first


Member Data Documentation

template<class T>
T* ImageArray< T >::m_ar [protected]
template<class T>
int* ImageArray< T >::m_rows [protected]

An array holding all rows' offsets (optimizes addressing)

Definition at line 224 of file ImageArray.hh.

Referenced by ImageArray< coeff >::abs(), and VideoArray< coeff >::abs().

template<class T>
int ImageArray< T >::m_xsize [protected]

The array's horizontal size.

Definition at line 216 of file ImageArray.hh.

Referenced by ImageArray< coeff >::cols().

template<class T>
int ImageArray< T >::m_xysize [protected]

The array's overall size (x*y).

Definition at line 220 of file ImageArray.hh.

Referenced by ImageArray< coeff >::size().

template<class T>
int ImageArray< T >::m_ysize [protected]

The array's vertical size.

Definition at line 218 of file ImageArray.hh.

Referenced by ImageArray< coeff >::rows().


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