00001 #ifndef __ITKOCTREENODE_H__
00002 #define __ITKOCTREENODE_H__
00003
00004
00005
00006
00007
00008
00009
00010 #include "itkMacro.h"
00011 namespace itk {
00012 enum LeafIdentifier { ZERO=0,ONE=1,TWO=2,THREE=3,FOUR=4,FIVE=5,SIX=6,SEVEN=7 };
00013
00014
00015
00016 class OctreeNodeBranch;
00017 class OctreeBase;
00027 class ITKCommon_EXPORT OctreeNode
00028 {
00029 public:
00036 OctreeNode(void);
00041 virtual ~OctreeNode(void);
00042
00051 OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
00052 OctreeNode & GetChild(const enum LeafIdentifier ChildID);
00062 int GetColor(void) const;
00071 void SetColor( int NodeColor);
00080 void SetBranch(OctreeNodeBranch * NewBranch);
00087 bool IsNodeColored(void) const;
00088 inline void SetParentOctree(OctreeBase *parent)
00089 {
00090 m_Parent = parent;
00091 }
00092 protected:
00093 private:
00099 void RemoveChildren(void);
00100
00104 OctreeNodeBranch * m_Branch;
00105 OctreeBase *m_Parent;
00106 };
00107
00108 class OctreeNodeBranch
00109 {
00110 public:
00111 OctreeNodeBranch(OctreeBase *parent)
00112 {
00113 for(int i = 0; i < 8; i++)
00114 m_Leaves[i].SetParentOctree(parent);
00115 }
00116 inline OctreeNode *GetLeaf(enum LeafIdentifier LeafID)
00117 {
00118 return &m_Leaves[LeafID];
00119 }
00120 private:
00121 OctreeNode m_Leaves[8];
00122 };
00123 }
00124 #endif