KWStyle - itkOctreeNode.h
 
Matrix View
Description

1 DEF #ifndef __ITKOCTREENODE_H__
2 HRD,DEF #define __ITKOCTREENODE_H__
3 LEN /*********************************** MH-CRC IPL *****************************************
4  * Iowa MH-CRC IPL C Header File
5  * Copyright (C) 1998 Nancy C. Andreasen and Vincent A. Magnotta
6  * File Name:        itkOctree.h
7  * \author Hans J. Johnson
8  * \brief Includes the basic class definitions for using Octtrees.
9 LEN  *****************************************************************************************/
10 #include "itkMacro.h"
11 HRD namespace itk {
12 LEN   enum LeafIdentifier { ZERO=0,ONE=1,TWO=2,THREE=3,FOUR=4,FIVE=5,SIX=6,SEVEN=7 };
13
14
15   //A forward-declaration
16   class OctreeNodeBranch;
17   class OctreeBase;
18   /**
19 LEN    * OctreeNode data structure,  OctreeNodes have two states: 1) They are a Colored node and the 
20 LEN,IND **** m_Branch is a sentinal value indicating the color, or 2) they are a branch node, and m_Branch
21 LEN,IND **** is a dynamically allocated array of 8 pointers to OctreeNodes.  In the second state, the 8 child
22 IND **** OctreeNodes are instantiated by the parent node.
23 IND **** \author Hans J. Johnson
24 LEN,IND **** This class is the basic building block of an octree.  It is rarely used by itself, and commonly
25 IND **** used by the Octree class.
26 IND ****/
27 IND **class ITKCommon_EXPORT OctreeNode
28 MCM,IND **{
29 IND **public:
30 IND ****/**
31 IND ****** Default constructor
32 IND ****** \author Hans J. Johnson
33 LEN,IND ****** \post After construction, it is assumed all children of this node are colored
34 IND ****** with values of 0.
35 IND ******/
36 IND ****OctreeNode(void);
37 IND ****/**
38 IND ****** Default destructor
39 IND ****** \author Hans J. Johnson
40 IND ******/
41 IND ****virtual ~OctreeNode(void);
42
43 IND ****/**
44 WCM,IND ****** Returns the value of the specified Child for for this OctreeNode
45 IND ****** \author Hans J. Johnson
46 IND ****** \param ChildID The numerical identifier of the desired child.
47 IND ****** \return A pointer to the Disired child. NOTE: This is always an
48 IND ****** instance of an OctreeNode.
49 IND ****** @{
50      */
51     OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
52     OctreeNode & GetChild(const enum LeafIdentifier ChildID);
53     /** @} */
54 IND ****/**
55 WCM,IND ****** Determines the color value of the specified Child for for this OctreeNode
56 IND ****** \author Hans J. Johnson
57 IND ****** \param ChildID The numerical identifier of the desired child.
58 LEN,IND ****** \return A value between 0 and 255 to indicate the color of the Disired child.
59 LEN,IND ****** \pre Must determine that the specified node is colored (Use IsNodeColored() 
60 IND ****** member function.  Behavior is undefined when the child is another Octree.
61 IND ******/
62 IND ****int GetColor(void) const;
63 IND ****/**
64 WCM,IND ****** Sets the color value of the specified Child for for this OctreeNode
65 IND ****** \author Hans J. Johnson
66 IND ****** \param ChildID The numerical identifier of the desired child.
67 IND ****** \param NodeColor The disired color of this node.
68 LEN,IND ****** \post All children of the specified child are removed, and the child is set to
69 IND ****** the desired value.
70 IND ******/
71 IND ****void SetColor( int NodeColor);
72 IND ****/**
73 WCM,IND ****** Sets the color value of the specified Child for for this OctreeNode
74 IND ****** \author Hans J. Johnson
75 IND ****** \param ChildID The numerical identifier of the desired child.
76 IND ****** \param NodeColor The disired color of this node.
77 LEN,IND ****** \post All children of the specified child are removed, and the child is set to
78 IND ****** the desired value.
79 IND ******/
80 IND ****void SetBranch(OctreeNodeBranch * NewBranch);
81 IND ****/**
82 LEN,IND ****** Determines if the child is a leaf node (colored), or a branch node (uncolored)
83 IND ****** \author Hans J. Johnson
84 IND ****** \param ChildID The numerical identifier of the desired child.
85 IND ****** \return true if it is colored, false if it is not
86 IND ******/
87 IND ****bool IsNodeColored(void) const;
88 IND ****inline void SetParentOctree(OctreeBase *parent)
89     {
90 IND ******m_Parent = parent;
91     }
92 IND **protected:
93 IND **private:
94 IND ****/**
95 IND ****** Removes all children from this node down, and sets the value 
96 IND ****** value of the children to background.
97 IND ****** \author Hans J. Johnson
98 IND ******/
99 IND ****void RemoveChildren(void);
100
101 IND ****/**
102 IND ****** Each element holds COLOR or pointer to another octree node 
103 IND ******/
104 IND ****OctreeNodeBranch * m_Branch; 
105 IND ****OctreeBase *m_Parent;
106 IND **};
107
108 IND **class OctreeNodeBranch
109 IND **{
110 IND **public:
111 IND ****OctreeNodeBranch(OctreeBase *parent)
112     {
113 IND ******for(int i = 0; i < 8; i++)
114 IND ********m_Leaves[i].SetParentOctree(parent);
115     }
116 IND ****inline OctreeNode *GetLeaf(enum LeafIdentifier LeafID)
117     {
118 IND ******return &m_Leaves[LeafID];
119     }
120 IND **private:
121 IND ****OctreeNode m_Leaves[8];
122 IND **};
123 //End of itk Namespace
124 #endif                          /* __ITKOCTREENODE_H__ */
125

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:37PM
© Kitware Inc.