24 #include <fvutils/statistical/histogram_file.h>
25 #include <fvutils/statistical/histogram_block.h>
26 #include <core/exception.h>
28 using namespace fawkes;
30 namespace firevision {
42 HistogramFile::HistogramFile()
45 attached_histograms.clear();
52 attached_histograms.clear();
62 if ( attached_histograms.find( block->
object_type() ) != attached_histograms.end() )
63 {
throw Exception(
"Cannot add another histogram of type %d to the file", block->
object_type()); }
65 attached_histograms[ block->
object_type() ] = block;
77 FireVisionDataFile::BlockList::iterator blit;
81 for (blit = bl.begin(); blit != bl.end(); ++blit)
83 if ((*blit)->type() == FIREVISION_HISTOGRAM_TYPE_16 ||
84 (*blit)->type() == FIREVISION_HISTOGRAM_TYPE_32 )
105 uint16_t x, uint16_t y, uint16_t z)
107 if ( attached_histograms.find(object_type) == attached_histograms.end() )
108 {
throw Exception(
"File contains no histogram for type %d", object_type); }
110 return attached_histograms[object_type]->get_value(x, y, z);
123 uint16_t x, uint16_t y, uint16_t z,
126 if ( attached_histograms.find(object_type) == attached_histograms.end() )
127 {
throw Exception(
"File contains no histogram for type %d", object_type); }
129 attached_histograms[object_type]->set_value(x, y, z, val);