00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkOneWayEquivalencyTable_h
00018
#define __itkOneWayEquivalencyTable_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 {
00047 class ITKCommon_EXPORT 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
00077
bool Add(
unsigned long a,
unsigned long b);
00078
00082
unsigned long Lookup(
const unsigned long a)
const
00083 {
00084
ConstIterator result = m_HashMap.find(a);
00085
if ( result == m_HashMap.end() )
return a;
00086
else return (*result).second;
00087 }
00088
00093
unsigned long RecursiveLookup(
const unsigned a)
const;
00094
00097
bool IsEntry(
const unsigned long a)
const
00098
{
00099 if ( m_HashMap.find(a) == m_HashMap.end() )
return false;
00100
else return true;
00101 }
00102
00104
void Erase(
const unsigned long a)
00105 { m_HashMap.erase(a); }
00106
00108
void Clear()
00109 { m_HashMap.clear(); }
00110
00112
bool Empty()
const
00113
{
return m_HashMap.empty(); }
00114
00117 Iterator Begin() {
return m_HashMap.begin(); }
00118
00121 Iterator End() {
return m_HashMap.end(); }
00122
00124
00125
00126
protected:
00127 OneWayEquivalencyTable() {}
00128
virtual ~OneWayEquivalencyTable() {}
00129 OneWayEquivalencyTable(
const Self&);
00130 void operator=(
const Self&);
00131 void PrintSelf(std::ostream& os,
Indent indent)
const;
00132
00133
HashTableType m_HashMap;
00134
00135
void UpdateOutputInformation();
00136 bool VerifyRequestedRegion() {
return true; }
00137
void SetRequestedRegionToLargestPossibleRegion () {}
00138
bool RequestedRegionIsOutsideOfTheBufferedRegion () {
return false; }
00139 void SetRequestedRegion (
itk::DataObject *) {}
00140 };
00141
00142 }
00143
00144
#endif
00145