Homepage Demos Overview Downloads Tutorials Reference
Credits

SketchIndices.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_SketchIndices_h
00003 #define INCLUDED_SketchIndices_h
00004 
00005 #include <iosfwd> // forward declaration for ostream
00006 
00007 #include <ext/hash_set>
00008 using namespace __gnu_cxx; // is this safe? seems to be needed for hash_set
00009 
00010 #include "SketchTypes.h"
00011 
00012 namespace DualCoding {
00013 
00014 class SketchSpace;
00015 template<class T> class Sketch;
00016 
00017 //! Table of indices of sketch elements; parent of the Region class
00018 class SketchIndices {
00019  public:
00020   typedef hash_set<usint, hash<usint>, equal_to<usint> > SketchIndicesTable;
00021   typedef SketchIndicesTable::const_iterator CI;
00022 
00023   SketchIndicesTable table;
00024   
00025   //! Constructor
00026   SketchIndices() : table() {};
00027 
00028   //! Destructor
00029   virtual ~SketchIndices() {};
00030   
00031   //! Operator for indirection based on passed in Sketch.
00032   //! Returns a new SketchIndices based on applying the indirection.
00033   const SketchIndices operator[] (const Sketch<usint>& indirection) const;
00034   
00035   //! Returns the result of adding the elements of another SketchIndices
00036   //! to the current SketchIndices
00037   const SketchIndices operator+ (const SketchIndices& other) const;
00038   
00039   //! Returns the result of removing the elements of another SketchIndices
00040   //! from the current SketchIndices.
00041   //! This is much more computationally expensive than addition, so try
00042   //! to minimize usage by distribution law: x-y-z=x-(y+z)
00043   const SketchIndices operator- (const SketchIndices& other) const;
00044 
00045   //! Adds indices of non-zero pixels.
00046   void addIndices(const Sketch<bool>& im);
00047 
00048   //! Removes any indices from SketchIndices which are outside the bounds of the SketchSpace
00049   void trimBounds(const SketchSpace &space);
00050   
00051 private:
00052 };
00053 
00054 //! prints out SketchIndices for debugging
00055 std::ostream& operator<< (std::ostream& out, const SketchIndices &s);
00056 
00057 } // namespace
00058 
00059 #endif

DualCoding 3.0beta
Generated Wed Oct 4 00:01:54 2006 by Doxygen 1.4.7