24 #include <core/exception.h>
25 #include <fvutils/statistical/histogram_block.h>
26 #include <fvutils/statistical/histogram_file.h>
30 namespace firevision {
39 HistogramFile::HistogramFile()
42 attached_histograms.clear();
48 attached_histograms.clear();
57 if (attached_histograms.find(block->
object_type()) != attached_histograms.end()) {
72 FireVisionDataFile::BlockList::iterator blit;
76 for (blit = bl.begin(); blit != bl.end(); ++blit) {
77 if ((*blit)->type() == FIREVISION_HISTOGRAM_TYPE_16
78 || (*blit)->type() == FIREVISION_HISTOGRAM_TYPE_32) {
98 if (attached_histograms.find(object_type) == attached_histograms.end()) {
99 throw Exception(
"File contains no histogram for type %d", object_type);
102 return attached_histograms[object_type]->get_value(x, y, z);
115 if (attached_histograms.find(object_type) == attached_histograms.end()) {
116 throw Exception(
"File contains no histogram for type %d", object_type);
119 attached_histograms[object_type]->set_value(x, y, z, val);
Base class for exceptions in Fawkes.
FireVision File Format for data files.
virtual void add_block(FireVisionDataFileBlock *block)
Add a block.
std::list< FireVisionDataFileBlock * > BlockList
List of FireVision data file blocks.
BlockList & blocks()
Get blocks.
This class defines a file block for histograms.
hint_t object_type() const
Returns the type of the object the histogram is associated with.
HistogramBlockList histogram_blocks()
Generates a list of histogram blocks attached to the file.
uint32_t get_value(hint_t object_type, uint16_t x, uint16_t y, uint16_t z)
Get a value from a certain histogram.
~HistogramFile()
Destructor.
void add_histogram_block(HistogramBlock *block)
Adds a new histogram block to the file.
void set_value(hint_t object_type, uint16_t x, uint16_t y, uint16_t z, uint32_t val)
Set a value in a certain histogram.
std::list< HistogramBlock * > HistogramBlockList
Convenience typdef for a STL list of pointers to histogram blocks.
Fawkes library namespace.