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);
HistogramBlockList histogram_blocks()
Generates a list of histogram blocks attached to the file.
std::list< HistogramBlock * > HistogramBlockList
Convenience typdef for a STL list of pointers to histogram blocks.
~HistogramFile()
Destructor.
uint32_t get_value(hint_t object_type, uint16_t x, uint16_t y, uint16_t z)
Get a value from a certain histogram.
virtual void add_block(FireVisionDataFileBlock *block)
Add a block.
Fawkes library namespace.
hint_t object_type() const
Returns the type of the object the histogram is associated with.
std::list< FireVisionDataFileBlock * > BlockList
List of FireVision data file blocks.
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.
Base class for exceptions in Fawkes.
void add_histogram_block(HistogramBlock *block)
Adds a new histogram block to the file.
FireVision File Format for data files.
This class defines a file block for histograms.
BlockList & blocks()
Get blocks.