HistogramBlock Class Reference

This class defines a file block for histograms. More...

#include <fvutils/statistical/histogram_block.h>

Inheritance diagram for HistogramBlock:

List of all members.


Public Member Functions

 HistogramBlock (histogram_block_type_t type, hint_t object_type, uint16_t width, uint16_t height, uint16_t depth=0)
 Constructor.
 HistogramBlock (FireVisionDataFileBlock *block)
 Copy constructor.
virtual ~HistogramBlock ()
 Destructor.
uint16_t width () const
 Returns the the width of the histogram.
uint16_t height () const
 Returns the the height of the histogram.
uint16_t depth () const
 Returns the the depth of the histogram.
hint_t object_type () const
 Returns the type of the object the histogram is associated with.
void set_object_type (hint_t object_type)
 Set the type of the object the histogram is associated with.
void set_data (uint32_t *data)
 Directly set the histogram data.
void set_value (uint16_t x, uint16_t y, uint32_t val)
 Store a value in a certain cell of a 2-dimensional histogram.
void set_value (uint16_t x, uint16_t y, uint16_t z, uint32_t val)
 Store a value in a certain cell of a 3-dimensional histogram.
uint32_t get_value (uint16_t x, uint16_t y)
 Obtain a certain value from a 2-dimensional histogram.
uint32_t get_value (uint16_t x, uint16_t y, uint16_t z)
 Obtain a certain value from a 3-dimensional histogram.
void reset ()
 Reset the histogram.

Detailed Description

This class defines a file block for histograms.

Additionally, the very basic routines to acccess and manipulate data in the histograms are provided.

Author:
Daniel Beck

Definition at line 50 of file histogram_block.h.


Constructor & Destructor Documentation

HistogramBlock::HistogramBlock ( histogram_block_type_t  type,
hint_t  object_type,
uint16_t  width,
uint16_t  height,
uint16_t  depth = 0 
)

Constructor.

Parameters:
type the type of the histogram block
object_type the object type this histogram is meant for (e.g, ball)
width the width of the histogram
height the height of the histogram
depth the depth of the histogram

Definition at line 44 of file histogram_block.cpp.

References FireVisionDataFileBlock::_data, FireVisionDataFileBlock::_spec_header, _histogram_block_header_t::depth, _histogram_block_header_t::height, _histogram_block_header_t::object_type, and _histogram_block_header_t::width.

HistogramBlock::HistogramBlock ( FireVisionDataFileBlock block  ) 

Copy constructor.

Parameters:
block another block

Definition at line 61 of file histogram_block.cpp.

References FireVisionDataFileBlock::_data, and FireVisionDataFileBlock::_spec_header.

HistogramBlock::~HistogramBlock (  )  [virtual]

Destructor.

Definition at line 69 of file histogram_block.cpp.


Member Function Documentation

uint16_t HistogramBlock::depth (  )  const

Returns the the depth of the histogram.

Returns:
the depth of the histogram

Definition at line 95 of file histogram_block.cpp.

References _histogram_block_header_t::depth.

Referenced by Histogram::Histogram(), and BayesColormapGenerator::load_histograms().

uint32_t HistogramBlock::get_value ( uint16_t  x,
uint16_t  y,
uint16_t  z 
)

Obtain a certain value from a 3-dimensional histogram.

Parameters:
x the x-coordinate
y the y-coordinate
z the z-coordinate
Returns:
the histogram value

Definition at line 217 of file histogram_block.cpp.

References _histogram_block_header_t::depth, _histogram_block_header_t::height, and _histogram_block_header_t::width.

uint32_t HistogramBlock::get_value ( uint16_t  x,
uint16_t  y 
)

Obtain a certain value from a 2-dimensional histogram.

Parameters:
x the x-coordinate
y the y-coordinate
Returns:
the histogram value

Definition at line 190 of file histogram_block.cpp.

References _histogram_block_header_t::depth, _histogram_block_header_t::height, and _histogram_block_header_t::width.

Referenced by Histogram::add(), Histogram::get_average(), Histogram::get_median(), Histogram::get_sum(), Histogram::get_value(), Histogram::inc_value(), Histogram::print_to_stream(), Histogram::set_value(), and Histogram::sub().

uint16_t HistogramBlock::height (  )  const

Returns the the height of the histogram.

Returns:
the height of the histogram

Definition at line 86 of file histogram_block.cpp.

References _histogram_block_header_t::height.

Referenced by Histogram::Histogram(), and BayesColormapGenerator::load_histograms().

hint_t HistogramBlock::object_type (  )  const

Returns the type of the object the histogram is associated with.

Returns:
the object type of the histogram

Definition at line 104 of file histogram_block.cpp.

References _histogram_block_header_t::object_type.

Referenced by HistogramFile::add_histogram_block().

void HistogramBlock::reset (  ) 

Reset the histogram.

Definition at line 242 of file histogram_block.cpp.

References FireVisionDataFileBlock::_data_size.

Referenced by Histogram::reset().

void HistogramBlock::set_data ( uint32_t *  data  ) 

Directly set the histogram data.

Note: You are reponsible that the data has the right size and format!

Parameters:
data pointer to the histogram data

Definition at line 123 of file histogram_block.cpp.

References FireVisionDataFileBlock::_data, and FireVisionDataFileBlock::_data_size.

void HistogramBlock::set_object_type ( hint_t  object_type  ) 

Set the type of the object the histogram is associated with.

Parameters:
object_type the new type of the object

Definition at line 113 of file histogram_block.cpp.

References _histogram_block_header_t::object_type.

Referenced by BayesColormapGenerator::save_histograms().

void HistogramBlock::set_value ( uint16_t  x,
uint16_t  y,
uint16_t  z,
uint32_t  val 
)

Store a value in a certain cell of a 3-dimensional histogram.

Parameters:
x the x-coordinate
y the y-coordinate
z the z-coordinate
val the new value

Definition at line 161 of file histogram_block.cpp.

References _histogram_block_header_t::depth, _histogram_block_header_t::height, and _histogram_block_header_t::width.

void HistogramBlock::set_value ( uint16_t  x,
uint16_t  y,
uint32_t  val 
)

Store a value in a certain cell of a 2-dimensional histogram.

Parameters:
x the x-coordinate
y the y-coordinate
val the new value

Definition at line 134 of file histogram_block.cpp.

References _histogram_block_header_t::depth, _histogram_block_header_t::height, and _histogram_block_header_t::width.

Referenced by Histogram::add(), Histogram::inc_value(), and Histogram::set_value().

uint16_t HistogramBlock::width (  )  const

Returns the the width of the histogram.

Returns:
the width of the histogram

Definition at line 77 of file histogram_block.cpp.

References _histogram_block_header_t::width.

Referenced by Histogram::Histogram(), and BayesColormapGenerator::load_histograms().


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