|
latest version v1.9 - last update 10 Apr 2010 |
|
two dimensional histogram of type double More...
#include <ltiHistogram.h>


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 point & | getFirstCell () const |
| const point & | getLastCell () 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 histogram2D & | copy (const histogram2D &other) |
| mathObject * | clone () const |
| histogram2D & | operator= (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 |
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.
| lti::histogram2D::histogram2D | ( | ) |
default constructor creates an empty histogram;
| lti::histogram2D::histogram2D | ( | const int & | cells | ) |
create a two dimensional histogram of cells x cells
| 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)
| 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
| 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
| other | the histogram to be copied. |
| virtual lti::histogram2D::~histogram2D | ( | ) | [virtual] |
destructor
| value_type& lti::histogram2D::at | ( | const point & | p | ) | [inline] |
access element p of the histogram
| p | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| const value_type& lti::histogram2D::at | ( | const point & | p | ) | const [inline] |
read-only access to the element p of the histogram
| p | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| value_type& lti::histogram2D::at | ( | const int & | y, | |
| const int & | x | |||
| ) | [inline] |
access element x of the histogram
| 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 |
| 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)
| 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 |
| mathObject* lti::histogram2D::clone | ( | ) | const [virtual] |
create a clone 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.
| other | the source histogram to be copied. |
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.
| 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
, where n is the number of entries in the histogram (see getNumberOfEntries()).
| 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 |
| 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
, where n is the number of entries in the histogram (see getNumberOfEntries()).
| p | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| 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)).
| other | the histogram to be copied |
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.
| p | index of the histogram element to be incremented. It should be between getFirstCell() and getLastCell() | |
| increment | amount of the incrementation (default: 1) |
| 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.
| 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) |
| 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!
| cellsY | the number of rows | |
| cellsX | the number of columns |
Reimplemented from lti::thistogram< T >.
| void lti::histogram2D::resize | ( | const point & | 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 >.
point lti::histogram2D::firstCell [protected] |
first index ( 0,0 )
Reimplemented from lti::thistogram< T >.
point lti::histogram2D::lastCell [protected] |
last index (cellsInDimension(0) - 1,cellsInDimension(1) - 1 )
Reimplemented from lti::thistogram< T >.
matrix<value_type> lti::histogram2D::theHistoMatrix [protected] |
wrapper matrix for histogram::theHistogram