00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOctreeNode_h
00018 #define __itkOctreeNode_h
00019
00020
00021
00022
00023
00024
00025
00026 #include "itkMacro.h"
00027 namespace itk {
00028 enum LeafIdentifier { ZERO=0,ONE=1,TWO=2,THREE=3,FOUR=4,FIVE=5,SIX=6,SEVEN=7 };
00029
00030
00031
00032 class OctreeNodeBranch;
00033 class OctreeBase;
00043 class ITKCommon_EXPORT OctreeNode
00044 {
00045 public:
00046
00053 OctreeNode(void);
00054
00059 virtual ~OctreeNode(void);
00060
00069 OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
00070 OctreeNode & GetChild(const enum LeafIdentifier ChildID);
00071
00082 int GetColor(void) const;
00083
00092 void SetColor( int NodeColor);
00093
00102 void SetBranch(OctreeNodeBranch * NewBranch);
00103
00110 bool IsNodeColored(void) const;
00111 inline void SetParentOctree(OctreeBase *parent)
00112 {
00113 m_Parent = parent;
00114 }
00115 protected:
00116 private:
00117
00123 void RemoveChildren(void);
00124
00128 OctreeNodeBranch * m_Branch;
00129 OctreeBase *m_Parent;
00130 };
00131
00132 class OctreeNodeBranch
00133 {
00134 public:
00135 OctreeNodeBranch(OctreeBase *parent)
00136 {
00137 for(int i = 0; i < 8; i++)
00138 m_Leaves[i].SetParentOctree(parent);
00139 }
00140 inline OctreeNode *GetLeaf(enum LeafIdentifier LeafID)
00141 {
00142 return &m_Leaves[LeafID];
00143 }
00144 private:
00145 OctreeNode m_Leaves[8];
00146 };
00147 }
00148 #endif
00149