LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::histogram2D Class Reference
[Aggregate Data Types]

two dimensional histogram of type double More...

#include <ltiHistogram.h>

Inheritance diagram for lti::histogram2D:
Inheritance graph
[legend]
Collaboration diagram for lti::histogram2D:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 histogram2D ()
 histogram2D (const int &cells)
 histogram2D (const int &cellsY, const int &cellsX)
 histogram2D (const point &cells)
 histogram2D (const histogram2D &other)
virtual ~histogram2D ()
const char * getTypeName () const
const pointgetFirstCell () const
const pointgetLastCell () const
void resize (const point &cells)
void resize (const int &cellsY, const int &cellsX)
void initialize (const value_type &value=value_type(0))
void fill (const value_type &iniValue, const point &from=point(0, 0), const point &to=point(MaxInt32, MaxInt32))
const value_type & at (const int &y, const int &x) const
value_type & at (const int &y, const int &x)
const value_type & at (const point &p) const
value_type & at (const point &p)
const value_type & put (const int &y, const int &x, const value_type &increment=value_type(1))
const value_type & put (const point &p, const value_type &increment=value_type(1))
value_type getProbability (const point &p) const
value_type getProbability (const int &y, const int &x) const
virtual histogram2Dcopy (const histogram2D &other)
mathObjectclone () const
histogram2Doperator= (const histogram2D &other)
point getIndexOfMaximum () const
point getIndexOfMinimum () const
virtual bool write (ioHandler &handler, const bool complete=true) const
virtual bool read (ioHandler &handler, const bool complete=true)

Protected Attributes

point firstCell
point lastCell
matrix< value_type > theHistoMatrix

Detailed Description

two dimensional histogram of type double

The implementation of the 2D histogram allows an efficient way to create 2D histograms... much faster than using n-dimensional histograms with dimension 2.


Constructor & Destructor Documentation

lti::histogram2D::histogram2D (  ) 

default constructor creates an empty histogram;

lti::histogram2D::histogram2D ( const int &  cells  ) 

create a two dimensional histogram of cells x cells

Parameters:
cells the number of cells per dimension.
lti::histogram2D::histogram2D ( const int &  cellsY,
const int &  cellsX 
)

create a two dimensional histogram of cellsY x cellsX

Please note the use of matrix notation (y,x) and NOT (x,y)

Parameters:
cellsY the number of cells in the first dimension.
cellsX the number of cells in the second dimension.
lti::histogram2D::histogram2D ( const point cells  ) 

create a two dimensional histogram of cells.x x cells.y

Parameters:
cells the number of cells per dimension. (cells.x is the number of columns of the histogram cells.y is the number of rows of the histogram)
lti::histogram2D::histogram2D ( const histogram2D other  ) 

create this histogram as a copy of another histogram

Parameters:
other the histogram to be copied.
virtual lti::histogram2D::~histogram2D (  )  [virtual]

destructor


Member Function Documentation

value_type& lti::histogram2D::at ( const point p  )  [inline]

access element p of the histogram

Parameters:
p index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the number of entries in the given cell
const value_type& lti::histogram2D::at ( const point p  )  const [inline]

read-only access to the element p of the histogram

Parameters:
p index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the number of entries in the given cell
value_type& lti::histogram2D::at ( const int &  y,
const int &  x 
) [inline]

access element x of the histogram

Parameters:
y row of the histogram element to be accessed. It should be between getFirstCell().y and getLastCell().y
x column of the histogram element to be accessed. It should be between getFirstCell().x and getLastCell().x
Returns:
the number of entries in the given cell
const value_type& lti::histogram2D::at ( const int &  y,
const int &  x 
) const [inline]

read-only access to the element (x,y) of the histogram

Note the use of the matrix notation: first row (y) and then column (x)

Parameters:
y row of the histogram element to be accessed. It should be between getFirstCell().y and getLastCell().y
x column of the histogram element to be accessed. It should be between getFirstCell().x and getLastCell().x
Returns:
the number of entries in the given cell
mathObject* lti::histogram2D::clone (  )  const [virtual]

create a clone of this histogram

Returns:
a pointer to a copy of this histogram

Reimplemented from lti::thistogram< T >.

virtual histogram2D& lti::histogram2D::copy ( const histogram2D other  )  [virtual]

assigment operator.

copy the contents of other in this object.

Parameters:
other the source histogram to be copied.
Returns:
a reference to this object

Reimplemented from lti::thistogram< T >.

Referenced by operator=().

void lti::histogram2D::fill ( const value_type &  iniValue,
const point from = point(0, 0),
const point to = point(MaxInt32, MaxInt32) 
)

fills the histogram elements with iniValue between the n-dimensional points from and to.

Parameters:
iniValue the elements will be initialized with this value.
from first element index
to last element index

If from or to are out of bounds, they will be (internaly) adjusted to a correct value.

Example:

   lti::histogram1D hist(10); // 1D-histogram with 10 elements
   hist.clear();
   hist.fill(9,1,3);          // hist=[0,9,9,9,0,0,0,0,0,0]
const point& lti::histogram2D::getFirstCell (  )  const [inline]

returns a vector to the first element of the histogram (usually every element of the vector is 0;

Reimplemented from lti::thistogram< T >.

point lti::histogram2D::getIndexOfMaximum (  )  const [inline]

get the index of the biggest element in the histogram

Reimplemented from lti::thistogram< T >.

point lti::histogram2D::getIndexOfMinimum (  )  const [inline]

get the index of the smallest element in the histogram

Reimplemented from lti::thistogram< T >.

const point& lti::histogram2D::getLastCell (  )  const [inline]

returns a vector to the last element of the histogram

Reimplemented from lti::thistogram< T >.

value_type lti::histogram2D::getProbability ( const int &  y,
const int &  x 
) const [inline]

read-only access to the element of the row y and the column x of the histogram as a discrete probability distribution term.

This is equivalent to $at(x)/n$, where n is the number of entries in the histogram (see getNumberOfEntries()).

Parameters:
y row of the histogram element to be accessed. It should be between getFirstCell().y and getLastCell().y
x column of the histogram element to be accessed. It should be between getFirstCell().x and getLastCell().x
Returns:
the probabilty of the element (y,x), respect to the histogram data.
value_type lti::histogram2D::getProbability ( const point p  )  const [inline]

read-only access to the element p of the histogram as a discrete probability distribution term.

This is equivalent to $at(x)/n$, where n is the number of entries in the histogram (see getNumberOfEntries()).

Parameters:
p index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the probabilty of the element x, respect to the histogram data.
const char* lti::histogram2D::getTypeName ( void   )  const [inline, virtual]

returns the name of this class: "histogram"

Reimplemented from lti::thistogram< T >.

void lti::histogram2D::initialize ( const value_type &  value = value_type(0)  ) 

initialize all cells of the histogram with 0 (or another specified number).

Reimplemented from lti::thistogram< T >.

histogram2D& lti::histogram2D::operator= ( const histogram2D other  )  [inline]

assigment operator (alias for copy(other)).

Parameters:
other the histogram to be copied
Returns:
a reference to the actual histogram

Reimplemented from lti::thistogram< T >.

References copy().

const value_type& lti::histogram2D::put ( const point p,
const value_type &  increment = value_type(1) 
) [inline]

increment the cell at p by the given number of entries (or 1.0 if nothing is explicitly indicated!) and update the total number of entries in the histogram.

Parameters:
p index of the histogram element to be incremented. It should be between getFirstCell() and getLastCell()
increment amount of the incrementation (default: 1)
Returns:
the new number of entries of the incremented cell.
const value_type& lti::histogram2D::put ( const int &  y,
const int &  x,
const value_type &  increment = value_type(1) 
) [inline]

increment the cell at row y and column x by the given number of entries (or 1.0 if nothing is explicitly indicated!) and update the total number of entries in the histogram.

Parameters:
y row of the histogram element to be incremented. It should be between getFirstCell().y and getLastCell().y
x column of the histogram element to be incremented. It should be between getFirstCell().x and getLastCell().x
increment amount of the incrementation (default: 1)
Returns:
the new number of entries of the incremented cell.
virtual bool lti::histogram2D::read ( ioHandler handler,
const bool  complete = true 
) [virtual]

read the object from the given ioHandler

Reimplemented from lti::thistogram< T >.

void lti::histogram2D::resize ( const int &  cellsY,
const int &  cellsX 
)

change cell number of the histogram.

All data will be lost!

Parameters:
cellsY the number of rows
cellsX the number of columns

Reimplemented from lti::thistogram< T >.

void lti::histogram2D::resize ( const point cells  ) 

change cell number of the histogram2D.

All data will be lost!

Parameters:
cells the number of cells
virtual bool lti::histogram2D::write ( ioHandler handler,
const bool  complete = true 
) const [virtual]

write the object in the given ioHandler

Reimplemented from lti::thistogram< T >.


Member Data Documentation

first index ( 0,0 )

Reimplemented from lti::thistogram< T >.

last index (cellsInDimension(0) - 1,cellsInDimension(1) - 1 )

Reimplemented from lti::thistogram< T >.

matrix<value_type> lti::histogram2D::theHistoMatrix [protected]

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

Generated on Sat Apr 10 15:28:24 2010 for LTI-Lib by Doxygen 1.6.1