Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkWatershedOneWayEquivalencyTable.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkWatershedOneWayEquivalencyTable.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/07/11 21:36:07 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkWatershedOneWayEquivalencyTable_h
00018 #define __itkWatershedOneWayEquivalencyTable_h
00019 
00020 #if defined(_MSC_VER)
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include "itkObjectFactory.h"
00025 #include "itkDataObject.h"
00026 #include "itkProcessObject.h"
00027 #include "itk_hash_map.h"
00028 
00029 namespace itk
00030 {
00031 namespace watershed
00032 {
00047 class OneWayEquivalencyTable : public DataObject
00048 {
00049 public:
00051   typedef OneWayEquivalencyTable Self;
00052   typedef DataObject Superclass;
00053   typedef SmartPointer<Self> Pointer;
00054   typedef SmartPointer<const Self> ConstPointer;
00055   itkNewMacro(Self);
00056   itkTypeMacro(OneWayEquivalencyTable, DataObject);
00057 
00059   typedef itk::hash_map<unsigned long, unsigned long,
00060     itk::hash<unsigned long> > HashTableType;
00061   typedef HashTableType::iterator Iterator;
00062   typedef HashTableType::const_iterator ConstIterator;
00063   typedef HashTableType::value_type ValueType;
00064   
00068   void Flatten();
00069 
00076   bool Add(unsigned long a, unsigned long b);
00077 
00081   unsigned long Lookup(const unsigned long a) const
00082     {
00083       ConstIterator result = m_HashMap.find(a);
00084       if ( result == m_HashMap.end() ) return a;
00085       else return (*result).second;
00086     }
00087   
00091   unsigned long RecursiveLookup(const unsigned a) const;
00092 
00095   bool IsEntry(const unsigned long a) const
00096     {
00097       if ( m_HashMap.find(a) == m_HashMap.end() ) return false;
00098       else return true;
00099     }
00100   
00102   void Erase(const unsigned long a)
00103     {  m_HashMap.erase(a); }
00104 
00106   void Clear()
00107     {      m_HashMap.clear();    }
00108 
00110   bool Empty() const
00111     {      return m_HashMap.empty();    }
00112   
00115   Iterator Begin() { return m_HashMap.begin(); }
00116 
00119   Iterator End()   { return m_HashMap.end();   }
00120 
00122   //  void PrintHashTable();
00123   
00124 protected:
00125   OneWayEquivalencyTable()  {}
00126   virtual ~OneWayEquivalencyTable() {}
00127   OneWayEquivalencyTable(const Self&) {}
00128   void operator=(const Self&) {}
00129   void PrintSelf(std::ostream& os, Indent indent) const;
00130 
00131   HashTableType m_HashMap;
00132   
00133   void UpdateOutputInformation();
00134   bool VerifyRequestedRegion() {return true; }
00135   void SetRequestedRegionToLargestPossibleRegion () {}
00136   bool RequestedRegionIsOutsideOfTheBufferedRegion () { return false; }
00137   void SetRequestedRegion (itk::DataObject *) {}
00138 };
00139 }// end namespace watershed
00140 }// end namespace itk
00141 
00142 #endif
00143 

Generated at Wed Mar 12 01:13:14 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000