ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkOctreeNode.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkOctreeNode_h
19 #define __itkOctreeNode_h
20 #include "itkMacro.h"
21 namespace itk
22 {
23 enum LeafIdentifier { ZERO = 0, ONE = 1, TWO = 2, THREE = 3, FOUR = 4, FIVE = 5, SIX = 6, SEVEN = 7 };
24 
25 //A forward-declaration
26 class OctreeNodeBranch;
27 class OctreeBase;
28 
43 class ITKCommon_EXPORT OctreeNode
44 {
45 public:
46 
52  OctreeNode(void);
53 
57  virtual ~OctreeNode(void);
58 
66  OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
67 
68  OctreeNode & GetChild(const enum LeafIdentifier ChildID);
69 
78  int GetColor(void) const;
79 
86  void SetColor(int NodeColor);
87 
93  void SetBranch(OctreeNodeBranch *NewBranch);
94 
99  bool IsNodeColored(void) const;
100 
101  inline void SetParentOctree(OctreeBase *parent)
102  {
103  m_Parent = parent;
104  }
105 
106 protected:
107 private:
112  void RemoveChildren(void);
113 
119 };
120 
122 {
123 public:
125  {
126  for ( int i = 0; i < 8; i++ )
127  {
128  m_Leaves[i].SetParentOctree(parent);
129  }
130  }
131 
132  inline OctreeNode * GetLeaf(enum LeafIdentifier LeafID)
133  {
134  return &m_Leaves[LeafID];
135  }
136 
137 private:
139 };
140 } //End of itk Namespace
141 #endif /* __itkOctreeNode_h */
142