Fawkes API  Fawkes Development Version
firevision::Histogram Class Reference

Histogram. More...

#include <>>

Public Member Functions

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

Detailed Description

Histogram.

Histrogram with 2D or 3D coordinates for buckets.

Definition at line 37 of file histogram.h.

Constructor & Destructor Documentation

◆ Histogram() [1/2]

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

Constructor.

Parameters
widthwidth of histogram plane
heightheight of histogram plane
depthdepth of the histogram
num_undosnumber of possible undos

Definition at line 58 of file histogram.cpp.

◆ Histogram() [2/2]

firevision::Histogram::Histogram ( HistogramBlock block)

Constructor.

Parameters
blockconstruct a histogram from the given histogram block

Definition at line 97 of file histogram.cpp.

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

◆ ~Histogram()

firevision::Histogram::~Histogram ( )

Destructor.

Definition at line 126 of file histogram.cpp.

Member Function Documentation

◆ add()

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

Add value to value in histogram at given location.

Parameters
xx coordinate in histogram
yy coordinate in histogram
zz coordinate in histogram
valuethe value to add

Definition at line 322 of file histogram.cpp.

Referenced by firevision::BayesColormapGenerator::save_histograms().

◆ get_average()

unsigned int firevision::Histogram::get_average ( )

Get average of all values.

Returns
average

Definition at line 534 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().

◆ get_dimensions()

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

Obtain dimensions of the histogram.

Parameters
widthreference to the variable where the width is stored
heightreference to the variable where the height is stored
depthreference to the variable where the depth is stored

Definition at line 207 of file histogram.cpp.

◆ get_histogram()

unsigned int * firevision::Histogram::get_histogram ( )

Get histogram data buffer.

Returns
histogram

Definition at line 185 of file histogram.cpp.

◆ get_histogram_block()

HistogramBlock * firevision::Histogram::get_histogram_block ( )

Obtain the histogram block of this histogram.

Returns
pointer to the histogram block

Definition at line 195 of file histogram.cpp.

◆ get_median()

unsigned int firevision::Histogram::get_median ( )

Get median of all values.

Returns
median

Definition at line 507 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().

◆ get_num_undos()

unsigned int firevision::Histogram::get_num_undos ( )

Get number of undos.

Returns
number of undos

Definition at line 497 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().

◆ get_sum()

unsigned int firevision::Histogram::get_sum ( ) const

Get sum of all values.

Returns
sum of values

Definition at line 557 of file histogram.cpp.

Referenced by firevision::BayesColormapGenerator::save_histograms().

◆ get_value() [1/2]

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

Get value from histogram.

Parameters
xx coordinate in histogram plane
yy coordinate in histogram plane
Returns
value

Definition at line 221 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

Referenced by firevision::BayesHistosToLut::calculateLutValues(), and firevision::BayesColormapGenerator::save_histograms().

◆ get_value() [2/2]

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

Get value from histogram.

Parameters
xx coordinate in histogram plane
yy coordinate in histogram plane
zz coordinate in the histogram
Returns
value

Definition at line 234 of file histogram.cpp.

◆ inc_value()

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

Increase the value of the histogram at given position.

Parameters
xx coordinate in the histogram
yy coordinate in the histogram
zz coordinate in the histogram

Definition at line 303 of file histogram.cpp.

◆ load()

bool firevision::Histogram::load ( const char *  filename)

Load from file.

Parameters
filenamefile name to read from
Returns
true on success, false otherwise

Definition at line 419 of file histogram.cpp.

References firevision::FireVisionDataFile::blocks(), firevision::FireVisionDataFile::num_blocks(), and firevision::FireVisionDataFile::read().

◆ operator+=() [1/2]

void firevision::Histogram::operator+= ( fawkes::upoint_t p)

Add point.

Parameters
ppoint

Definition at line 141 of file histogram.cpp.

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

◆ operator+=() [2/2]

void firevision::Histogram::operator+= ( fawkes::upoint_t  p)

Add point.

Parameters
ppoint

Definition at line 163 of file histogram.cpp.

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

◆ print_to_stream()

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

Print to stream.

Parameters
sstream

Definition at line 383 of file histogram.cpp.

◆ reset()

void firevision::Histogram::reset ( void  )

Reset histogram.

Definition at line 366 of file histogram.cpp.

◆ reset_undo()

void firevision::Histogram::reset_undo ( )

Reset undo.

Definition at line 450 of file histogram.cpp.

◆ save()

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

Save to file.

Parameters
filenamefile name to save to
formatted_outputone value per line

Definition at line 403 of file histogram.cpp.

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

◆ set_value() [1/2]

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

Set value in histogram.

Parameters
xx coordinate in histogram plane
yy coordinate in histogram plane
valuevalue

Definition at line 246 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues(), and firevision::BayesColormapGenerator::save_histograms().

◆ set_value() [2/2]

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

Set value in histogram.

Parameters
xx coordinate in histogram plane
yy coordinate in histogram plane
zz coordinate in the histogram
valuevalue

Definition at line 275 of file histogram.cpp.

◆ sub()

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

Substract value from value in histogram at given location.

Parameters
xx coordinate in histogram
yy coordinate in histogram
zz coordinate in histogram
valuethe value to substract

Definition at line 341 of file histogram.cpp.

Referenced by firevision::BayesColormapGenerator::save_histograms().

◆ switch_undo()

unsigned int firevision::Histogram::switch_undo ( unsigned int  undo_id)

Switch undo to another undo buffer.

Parameters
undo_idswitch to buffer with this ID
Returns
returns current undo buffer ID

Definition at line 479 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().

◆ undo()

void firevision::Histogram::undo ( )

Undo.

Definition at line 459 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().


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