Histogram Class Reference

Histogram. More...

#include <fvutils/statistical/histogram.h>

List of all members.


Public Member Functions

 Histogram (unsigned int width, unsigned int height, unsigned int depth=1, unsigned int num_undos=1)
 Constructor.
 Histogram (HistogramBlock *histogram_block)
 Constructor.
 ~Histogram ()
 Destructor.
void operator+= (fawkes::point_t *p)
 Add point.
void operator+= (fawkes::point_t p)
 Add point.
unsigned int * get_histogram ()
 Get histogram data buffer.
HistogramBlockget_histogram_block ()
 Obtain the histogram block of this histogram.
void get_dimensions (unsigned int &width, unsigned int &height, unsigned int &depth)
 Obtain dimensions of the histogram.
unsigned int get_value (unsigned int x, unsigned int y)
 Get value from histogram.
unsigned int get_value (unsigned int x, unsigned int y, unsigned int z)
 Get value from histogram.
void set_value (unsigned int x, unsigned int y, unsigned int value)
 Set value in histogram.
void set_value (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Set value in histogram.
void inc_value (unsigned int x, unsigned int y, unsigned int z=0)
 Increase the value of the histogram at given position.
void add (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Add value to value in histogram at given location.
void sub (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Substract value from value in histogram at given location.
void reset ()
 Reset histogram.
unsigned int get_median ()
 Get median of all values.
unsigned int get_average ()
 Get average of all values.
unsigned int get_sum () const
 Get sum of all values.
void reset_undo ()
 Reset undo.
void undo ()
 Undo.
unsigned int switch_undo (unsigned int undo_id)
 Switch undo to another undo buffer.
unsigned int get_num_undos ()
 Get number of undos.
void print_to_stream (std::ostream &s)
 Print to stream.
void save (const char *filename, bool formatted_output=false)
 Save to file.
bool load (const char *filename)
 Load from file.

Detailed Description

Histogram.

Histrogram with 2D or 3D coordinates for buckets.

Definition at line 32 of file histogram.h.


Constructor & Destructor Documentation

Histogram::Histogram ( unsigned int  width,
unsigned int  height,
unsigned int  depth = 1,
unsigned int  num_undos = 1 
)

Constructor.

Parameters:
width width of histogram plane
height height of histogram plane
depth depth of the histogram
num_undos number of possible undos

Definition at line 53 of file histogram.cpp.

References FireVisionDataFileBlock::data_ptr(), and reset().

Histogram::Histogram ( HistogramBlock block  ) 

Constructor.

Parameters:
block construct a histogram from the given histogram block

Definition at line 92 of file histogram.cpp.

References FireVisionDataFileBlock::data_ptr(), HistogramBlock::depth(), HistogramBlock::height(), and HistogramBlock::width().

Histogram::~Histogram (  ) 

Destructor.

Definition at line 121 of file histogram.cpp.


Member Function Documentation

void Histogram::add ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Add value to value in histogram at given location.

Parameters:
x x coordinate in histogram
y y coordinate in histogram
z z coordinate in histogram
value the value to add

Definition at line 315 of file histogram.cpp.

References HistogramBlock::get_value(), and HistogramBlock::set_value().

unsigned int Histogram::get_average (  ) 

Get average of all values.

Returns:
average

Definition at line 526 of file histogram.cpp.

References HistogramBlock::get_value().

Referenced by BayesHistosToLut::calculateLutValues().

void Histogram::get_dimensions ( unsigned int &  width,
unsigned int &  height,
unsigned int &  depth 
)

Obtain dimensions of the histogram.

Parameters:
width reference to the variable where the width is stored
height reference to the variable where the height is stored
depth reference to the variable where the depth is stored

Definition at line 202 of file histogram.cpp.

unsigned int * Histogram::get_histogram (  ) 

Get histogram data buffer.

Returns:
histogram

Definition at line 180 of file histogram.cpp.

HistogramBlock * Histogram::get_histogram_block (  ) 

Obtain the histogram block of this histogram.

Returns:
pointer to the histogram block

Definition at line 190 of file histogram.cpp.

unsigned int Histogram::get_median (  ) 

Get median of all values.

Returns:
median

Definition at line 499 of file histogram.cpp.

References HistogramBlock::get_value().

Referenced by BayesHistosToLut::calculateLutValues().

unsigned int Histogram::get_num_undos (  ) 

Get number of undos.

Returns:
number of undos

Definition at line 489 of file histogram.cpp.

Referenced by BayesHistosToLut::calculateLutValues().

unsigned int Histogram::get_sum (  )  const

Get sum of all values.

Returns:
sum of values

Definition at line 549 of file histogram.cpp.

References HistogramBlock::get_value().

unsigned int Histogram::get_value ( unsigned int  x,
unsigned int  y,
unsigned int  z 
)

Get value from histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
z z coordinate in the histogram

Definition at line 227 of file histogram.cpp.

References HistogramBlock::get_value().

unsigned int Histogram::get_value ( unsigned int  x,
unsigned int  y 
)

Get value from histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane

Definition at line 215 of file histogram.cpp.

References HistogramBlock::get_value().

Referenced by BayesHistosToLut::calculateLutValues().

void Histogram::inc_value ( unsigned int  x,
unsigned int  y,
unsigned int  z = 0 
)

Increase the value of the histogram at given position.

Parameters:
x x coordinate in the histogram
y y coordinate in the histogram
z z coordinate in the histogram

Definition at line 296 of file histogram.cpp.

References HistogramBlock::get_value(), and HistogramBlock::set_value().

bool Histogram::load ( const char *  filename  ) 

Load from file.

Parameters:
filename file name to read from

Definition at line 411 of file histogram.cpp.

References FireVisionDataFile::blocks(), FireVisionDataFileBlock::data_ptr(), FireVisionDataFile::num_blocks(), and FireVisionDataFile::read().

void Histogram::operator+= ( fawkes::point_t  p  ) 

Add point.

Parameters:
p point

Definition at line 158 of file histogram.cpp.

References fawkes::point_t::x, and fawkes::point_t::y.

void Histogram::operator+= ( fawkes::point_t p  ) 

Add point.

Parameters:
p point

Definition at line 136 of file histogram.cpp.

References fawkes::point_t::x, and fawkes::point_t::y.

void Histogram::print_to_stream ( std::ostream &  s  ) 

Print to stream.

Parameters:
s stream

Definition at line 376 of file histogram.cpp.

References HistogramBlock::get_value().

void Histogram::reset (  ) 

Reset histogram.

Definition at line 359 of file histogram.cpp.

References HistogramBlock::reset(), reset_undo(), and switch_undo().

Referenced by Histogram().

void Histogram::reset_undo (  ) 

Reset undo.

Definition at line 442 of file histogram.cpp.

Referenced by reset(), and undo().

void Histogram::save ( const char *  filename,
bool  formatted_output = false 
)

Save to file.

Parameters:
filename file name to save to
formatted_output one value per line

Definition at line 396 of file histogram.cpp.

References HistogramFile::add_histogram_block(), FireVisionDataFile::set_owns_blocks(), and FireVisionDataFile::write().

void Histogram::set_value ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Set value in histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
z z coordinate in the histogram
value value

Definition at line 268 of file histogram.cpp.

References HistogramBlock::get_value(), and HistogramBlock::set_value().

void Histogram::set_value ( unsigned int  x,
unsigned int  y,
unsigned int  value 
)

Set value in histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
value value

Definition at line 239 of file histogram.cpp.

References HistogramBlock::get_value(), and HistogramBlock::set_value().

Referenced by BayesHistosToLut::calculateLutValues(), and sub().

void Histogram::sub ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Substract value from value in histogram at given location.

Parameters:
x x coordinate in histogram
y y coordinate in histogram
z z coordinate in histogram
value the value to substract

Definition at line 334 of file histogram.cpp.

References HistogramBlock::get_value(), and set_value().

unsigned int Histogram::switch_undo ( unsigned int  undo_id  ) 

Switch undo to another undo buffer.

Parameters:
undo_id switch to buffer with this ID
Returns:
returns current undo buffer ID

Definition at line 471 of file histogram.cpp.

Referenced by BayesHistosToLut::calculateLutValues(), and reset().

void Histogram::undo (  ) 

Undo.

Definition at line 451 of file histogram.cpp.

References reset_undo().

Referenced by BayesHistosToLut::calculateLutValues().


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