Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkOctreeNode.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkOctreeNode.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/10/30 18:33:06 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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   //A forward-declaration
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 } //End of itk Namespace
00142 #endif                          /* __itkOctreeNode_h */
00143 

Generated at Wed Nov 5 23:15:37 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000