ITK  4.9.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 
45 class ITKCommon_EXPORT OctreeNode
46 {
47 public:
48 
54  OctreeNode();
55 
59  virtual ~OctreeNode();
60 
68  OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
69 
70  OctreeNode & GetChild(const enum LeafIdentifier ChildID);
80  long int GetColor() const;
81 
88  void SetColor(int NodeColor);
89 
95  void SetBranch(OctreeNodeBranch *NewBranch);
96 
101  bool IsNodeColored() const;
103  inline void SetParentOctree(OctreeBase *parent)
104  {
105  m_Parent = parent;
106  }
107 
108 protected:
109 
110 private:
115  void RemoveChildren();
116 
120  OctreeNodeBranch *m_Branch;
121  OctreeBase * m_Parent;
122 };
123 
125 {
126 public:
129  {
130  for ( int i = 0; i < 8; i++ )
131  {
132  m_Leaves[i].SetParentOctree(parent);
133  }
134  }
135 
136  inline OctreeNode * GetLeaf(enum LeafIdentifier LeafID)
137  {
138  return &m_Leaves[LeafID];
139  }
140 
141 private:
143 };
144 } //End of itk Namespace
145 #endif /* itkOctreeNode_h */
Provides non-templated access to templated instances of Octree.
Definition: itkOctree.h:54
OctreeNode m_Leaves[8]
LeafIdentifier
Definition: itkOctreeNode.h:23
OctreeNodeBranch(OctreeBase *parent)
A data structure representing a node in an Octree.
Definition: itkOctreeNode.h:45
OctreeNode * GetLeaf(enum LeafIdentifier LeafID)
void SetParentOctree(OctreeBase *parent)