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 #include "itkMacro.h"
00020 namespace itk {
00021
00022 enum LeafIdentifier { ZERO=0,ONE=1,TWO=2,THREE=3,FOUR=4,FIVE=5,SIX=6,SEVEN=7 };
00023
00024
00025
00026 class OctreeNodeBranch;
00027 class OctreeBase;
00037 class ITKCommon_EXPORT OctreeNode
00038 {
00039 public:
00040
00047 OctreeNode(void);
00048
00053 virtual ~OctreeNode(void);
00054
00063 OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
00064 OctreeNode & GetChild(const enum LeafIdentifier ChildID);
00065
00076 int GetColor(void) const;
00077
00086 void SetColor( int NodeColor);
00087
00096 void SetBranch(OctreeNodeBranch * NewBranch);
00097
00104 bool IsNodeColored(void) const;
00105 inline void SetParentOctree(OctreeBase *parent)
00106 {
00107 m_Parent = parent;
00108 }
00109 protected:
00110 private:
00111
00117 void RemoveChildren(void);
00118
00122 OctreeNodeBranch * m_Branch;
00123 OctreeBase *m_Parent;
00124 };
00125
00126 class OctreeNodeBranch
00127 {
00128 public:
00129 OctreeNodeBranch(OctreeBase *parent)
00130 {
00131 for(int i = 0; i < 8; i++)
00132 m_Leaves[i].SetParentOctree(parent);
00133 }
00134 inline OctreeNode *GetLeaf(enum LeafIdentifier LeafID)
00135 {
00136 return &m_Leaves[LeafID];
00137 }
00138 private:
00139 OctreeNode m_Leaves[8];
00140 };
00141 }
00142 #endif
00143