ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkOctreeNode.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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#include "itkCommonEnums.h"
22
23namespace itk
24{
25
26// Forward reference because of circular dependencies
27class ITK_FORWARD_EXPORT OctreeNodeBranch;
28class ITK_FORWARD_EXPORT OctreeBase;
29
46class ITKCommon_EXPORT OctreeNode
47{
48public:
55
59 virtual ~OctreeNode();
60
62#if !defined(ITK_LEGACY_REMOVE)
63 // We need to expose the enum values at the class level
64 // for backwards compatibility
65 static constexpr LeafIdentifierEnum ZERO = LeafIdentifierEnum::ZERO;
66 static constexpr LeafIdentifierEnum ONE = LeafIdentifierEnum::ONE;
67 static constexpr LeafIdentifierEnum TWO = LeafIdentifierEnum::TWO;
68 static constexpr LeafIdentifierEnum THREE = LeafIdentifierEnum::THREE;
69 static constexpr LeafIdentifierEnum FOUR = LeafIdentifierEnum::FOUR;
70 static constexpr LeafIdentifierEnum FIVE = LeafIdentifierEnum::FIVE;
71 static constexpr LeafIdentifierEnum SIX = LeafIdentifierEnum::SIX;
72 static constexpr LeafIdentifierEnum SEVEN = LeafIdentifierEnum::SEVEN;
73#endif
74
83 GetChild(const LeafIdentifierEnum ChildID) const;
84
88
95 long
96 GetColor() const;
97
104 void
105 SetColor(int color);
106
112 void
114
119 bool
121
122 inline void
124 {
125 m_Parent = parent;
126 }
127
128protected:
129private:
134 void
136
142};
143
144class ITKCommon_EXPORT OctreeNodeBranch
145{
146public:
147 OctreeNodeBranch() = default;
149 {
150 for (auto & leaf : m_Leaves)
151 {
152 leaf.SetParentOctree(parent);
153 }
154 }
155
156 inline OctreeNode *
158 {
159 return &m_Leaves[static_cast<uint8_t>(LeafID)];
160 }
161
162private:
164};
165
166} // namespace itk
167#endif /* itkOctreeNode_h */
Provides non-templated access to templated instances of Octree.
Definition itkOctree.h:41
OctreeNode * GetLeaf(OctreeNode::LeafIdentifierEnum LeafID)
OctreeNodeBranch(OctreeBase *parent)
OctreeNodeBranch()=default
A data structure representing a node in an Octree.
void SetColor(int color)
virtual ~OctreeNode()
OctreeBase * m_Parent
void SetParentOctree(OctreeBase *parent)
void SetBranch(OctreeNodeBranch *NewBranch)
OctreeNodeBranch * m_Branch
void RemoveChildren()
bool IsNodeColored() const
OctreeEnums::LeafIdentifier LeafIdentifierEnum
OctreeNode & GetChild(const LeafIdentifierEnum ChildID) const
long GetColor() const
OctreeNode & GetChild(const LeafIdentifierEnum ChildID)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....