Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
SketchIndices.ccGo to the documentation of this file.00001 #include <algorithm> 00002 #include <iostream> 00003 00004 #include "SketchIndices.h" 00005 #include "Sketch.h" 00006 #include "SketchSpace.h" 00007 00008 namespace DualCoding { 00009 00010 const SketchIndices SketchIndices::operator[] (const Sketch<uint>& indirection) const { 00011 SketchIndices redir; 00012 for (CI it = table.begin(); it != table.end(); ++it) 00013 redir.table.insert(indirection[*it]); 00014 return redir; 00015 } 00016 00017 const SketchIndices 00018 SketchIndices::operator+ (const SketchIndices& other) const { 00019 SketchIndices result(*this); 00020 for (CI it = other.table.begin(); it != other.table.end(); ++it) 00021 result.table.insert(*it); 00022 return result; 00023 } 00024 00025 const SketchIndices SketchIndices::operator- (const SketchIndices& other) const { 00026 SketchIndices result(*this); 00027 for (CI o = other.table.begin(); o != other.table.end(); ++o) 00028 result.table.erase(*o); 00029 return result; 00030 } 00031 00032 std::ostream& operator<< (std::ostream& out, const SketchIndices &s) { 00033 typedef std::ostream_iterator<SketchIndices::SketchIndicesTable::value_type, char, 00034 std::char_traits<char> > ositer; 00035 std::copy(s.table.begin(), s.table.end(), ositer(std::cout," ")); 00036 return out; 00037 } 00038 00039 void SketchIndices::addIndices(const Sketch<bool>& im) 00040 { 00041 size_t length = im->getNumPixels(); 00042 for (size_t i = 0; i < length; i++) 00043 if ( im[i] ) 00044 table.insert(i); 00045 } 00046 00047 void SketchIndices::trimBounds(const SketchSpace &space) { 00048 SketchIndices result; 00049 for (SketchIndices::CI it = table.begin(); it != table.end(); ++it) 00050 if ( *it < space.getNumPixels() ) 00051 result.table.insert(*it); 00052 table = result.table; 00053 } 00054 00055 00056 00057 00058 } // namespace |
DualCoding 4.0 |
Generated Thu Nov 22 00:52:36 2007 by Doxygen 1.5.4 |