00001
00002
00003 #ifndef _SPAFGRAPH_NODE_DESCRIPTOR_HPP_
00004 #define _SPAFGRAPH_NODE_DESCRIPTOR_HPP_
00005
00006 #include <map>
00007 #include <vector>
00008 #include <iostream>
00009
00010 namespace jafar {
00011 namespace spafgraph {
00012 class Node;
00013 class NodeDescriptor;
00014 std::ostream& operator <<(std::ostream& s, NodeDescriptor const& desc);
00015 class NodeDescriptor {
00016 friend std::ostream& operator <<(std::ostream& s, NodeDescriptor const& desc);
00017 public:
00018 enum HistogramType {
00019 InvalidHistogram = 0,
00020 DistanceHistogram = 1,
00021 AngleHistogram = 1 << 1,
00022 TransformationVectorAngleHistogram = 1 << 2,
00023 OccupancyHistogram = 1 << 4
00024 };
00025 static const int AllHistograms = DistanceHistogram | AngleHistogram | TransformationVectorAngleHistogram;
00026 class Histogram {
00027 friend class std::map< HistogramType, Histogram >;
00028 Histogram();
00029 public:
00030 Histogram( HistogramType _type, const std::vector< double >& _values);
00031 HistogramType type() const { return m_type; }
00032 const std::vector< double >& values() const { return m_values; }
00033 double mean() const { return m_mean; }
00034 double stdDev() const { return m_stdDev; }
00035 private:
00036 HistogramType m_type;
00037 std::vector< double > m_values;
00038 double m_mean, m_stdDev;
00039 };
00040 public:
00041 NodeDescriptor(const Node* _node, int histograms = AllHistograms);
00042 ~NodeDescriptor();
00043
00044 const Histogram* histogram(HistogramType _histo) const;
00045 double comparison(const NodeDescriptor& _nodeDescriptor, int histograms = AllHistograms);
00046
00047 bool haveHistogram(HistogramType type);
00048
00049 static void setDistanceHistogramParameters( int bins, double binLength );
00050 static void setAngleHistogramParameters( int bins );
00051 static void setTransformationVectorAngleHistogram( int bins );
00052 static void setOccupancyHistogramParameters( int bins, double binLength );
00053 private:
00054 const Node* m_node;
00055 std::map< HistogramType, Histogram > m_histos;
00056 int m_histogramTypes;
00057 };
00058 }
00059 }
00060
00061 #endif