00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef HISTOGRAM_H
00023 #define HISTOGRAM_H
00024
00025 class Histogram
00029 {
00030 private:
00031 float min_val;
00032 float max_val;
00033 unsigned int bands_per_dim;
00034 unsigned int dim;
00035 unsigned int *frequency_data;
00036 unsigned int no_bins;
00037 unsigned int no_data_items;
00038 float band_size;
00039
00040 float max_prob;
00041 unsigned int max_freq;
00042
00043 protected:
00044 float *probs;
00045
00046 public:
00047 Histogram(float minimum_data_value,
00048 float maximum_data_value,
00049 unsigned int bands_per_dimension,
00050 unsigned int dimensionality);
00051
00052 Histogram(char const* hstFile);
00053
00054 unsigned int numBands (void) { return bands_per_dim; }
00055
00056 void add_new_data_item (int *data);
00057 void add_new_data_item (float *data);
00058
00059 void reset_histogram();
00060 void calculate_probabilities();
00061 void calculate_histogram();
00062
00063 float get_histogram_value (unsigned int *bin);
00064 float get_mapped_value (unsigned int *bin);
00065
00066 float calculate_difference (Histogram *hist);
00067
00069 float get_maximum_prob (void) { return max_prob; }
00070
00072 void get_best_bin(unsigned int *bin) ;
00073
00074 float calculate_proportion_threshold(float proportion) ;
00075
00076 void save_histogram(char const*);
00077 void load_histogram(char const*);
00078 };
00079
00080 #endif
00081