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/02/05 20:57:46 $
00007   Version:   $Revision: 1.4 $
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 /*********************************** MH-CRC IPL *****************************************
00020  * Iowa MH-CRC IPL C Header File
00021  * Copyright (C) 1998 Nancy C. Andreasen and Vincent A. Magnotta
00022  * File Name:        itkOctree.h
00023  * \author Hans J. Johnson
00024  * \brief Includes the basic class definitions for using Octtrees.
00025  *****************************************************************************************/
00026 #include "itkMacro.h"
00027 namespace itk {
00028   enum LeafIdentifier { ZERO=0,ONE=1,TWO=2,THREE=3,FOUR=4,FIVE=5,SIX=6,SEVEN=7 };
00029 
00030 
00031   //A forward-declaration
00032   class OctreeNodeBranch;
00033   class OctreeBase;
00043   class ITKCommon_EXPORT OctreeNode
00044   {
00045   public:
00046 
00053     OctreeNode(void);
00054 
00059     virtual ~OctreeNode(void);
00060 
00069     OctreeNode & GetChild(const enum LeafIdentifier ChildID) const;
00070     OctreeNode & GetChild(const enum LeafIdentifier ChildID);
00071 
00082     int GetColor(void) const;
00083 
00092     void SetColor( int NodeColor);
00093 
00102     void SetBranch(OctreeNodeBranch * NewBranch);
00103 
00110     bool IsNodeColored(void) const;
00111     inline void SetParentOctree(OctreeBase *parent)
00112     {
00113       m_Parent = parent;
00114     }
00115   protected:
00116   private:
00117 
00123     void RemoveChildren(void);
00124 
00128     OctreeNodeBranch * m_Branch; 
00129     OctreeBase *m_Parent;
00130   };
00131 
00132   class OctreeNodeBranch
00133   {
00134   public:
00135     OctreeNodeBranch(OctreeBase *parent)
00136     {
00137       for(int i = 0; i < 8; i++)
00138         m_Leaves[i].SetParentOctree(parent);
00139     }
00140     inline OctreeNode *GetLeaf(enum LeafIdentifier LeafID)
00141     {
00142       return &m_Leaves[LeafID];
00143     }
00144   private:
00145     OctreeNode m_Leaves[8];
00146   };
00147 } //End of itk Namespace
00148 #endif                          /* __itkOctreeNode_h */
00149 

Generated at Sat Sep 2 20:57:04 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000