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

itkOctree.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkOctree.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:19 $ 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 00018 #ifndef __ITKOCTREE_H__ 00019 #define __ITKOCTREE_H__ 00020 00021 #include "itkOctreeNode.h" 00022 #include "itkImage.h" 00023 /* 00024 * Octree data structure 00025 */ 00026 namespace itk { 00027 00028 enum 00029 { 00030 B2_MASKFILE_BLACK = 0, 00031 B2_MASKFILE_WHITE = 1, 00032 B2_MASKFILE_GRAY = 2 00033 }; 00037 enum OctreePlaneType 00038 { 00039 UNKNOWN_PLANE, 00040 SAGITAL_PLANE, 00041 CORONAL_PLANE, 00042 TRANSVERSE_PLANE 00043 }; 00044 00050 class OctreeBase : public Object 00051 { 00052 public: 00054 typedef OctreeBase Self; 00055 typedef SmartPointer<Self> Pointer; 00056 00061 virtual OctreeNode *GetTree() = 0; 00066 virtual unsigned int GetDepth() = 0; 00072 virtual unsigned int GetWidth() = 0; 00073 00075 virtual void SetDepth(unsigned int depth) = 0; 00076 00078 virtual void SetWidth(unsigned int width) = 0; 00084 virtual void BuildFromBuffer(const void *buffer, 00085 const int xsize,const int ysize,const int zsize) = 0; 00096 virtual const char *GetColorTable() const = 0; 00097 00099 virtual int GetColorTableSize() const = 0; 00100 }; 00101 00109 template <class TPixel,unsigned int ColorTableSize,class MappingFunctionType> 00110 class Octree: public OctreeBase 00111 { 00112 public: 00114 typedef Octree Self; 00115 typedef OctreeBase Superclass; 00116 typedef SmartPointer<Self> Pointer; 00117 typedef Image<TPixel,3> ImageType; 00118 typedef typename ImageType::Pointer ImageTypePointer; 00120 itkNewMacro(Self); 00121 00123 itkTypeMacro(AnalyzeImageIO, Superclass); 00124 00125 ImageTypePointer GetImage(); 00126 virtual void BuildFromBuffer(const void *buffer,const int xsize,const int ysize,const int zsize); 00127 void BuildFromImage(Image<TPixel,3> *fromImage); 00128 00129 Octree(void); 00130 ~Octree(void); 00131 void SetColor(unsigned int color) { m_Tree.SetColor(color); } 00132 void SetTree(OctreeNodeBranch *branch) { m_Tree.SetBranch(branch); } 00133 void SetTrueDims(const unsigned int Dim0, const unsigned int Dim1, 00134 const unsigned int Dim2); 00135 00136 unsigned int GetValue(const unsigned int Dim0, const unsigned int Dim1, 00137 const unsigned int Dim2); 00138 00139 virtual void SetWidth(unsigned int width); 00140 virtual void SetDepth(unsigned int depth); 00141 virtual unsigned int GetWidth(); 00142 virtual unsigned int GetDepth(); 00143 00144 virtual OctreeNode *GetTree(); 00145 virtual const char *GetColorTable() const; 00146 virtual int GetColorTableSize() const; 00147 private: 00148 Octree(const Self&); // purposely not implemented 00149 void operator=(const Self&); // purposely not implemented 00150 00151 OctreeNodeBranch *maskToOctree (const TPixel* Mask, unsigned width, unsigned x, 00152 unsigned y, unsigned z, unsigned xsize, 00153 unsigned ysize, unsigned zsize); 00154 enum OctreePlaneType m_Plane; // The orientation of the plane for this octree 00155 unsigned int m_Width; // The width of the Octree 00156 // ( This is always a power of 2, and large 00157 // enough to contain MAX(DIMS[1,2,3])) 00158 unsigned int m_Depth; // < The depth of the Octree 00159 unsigned int m_TrueDims[3]; // The true dimensions of the image 00160 char m_ColorTable[ColorTableSize]; 00161 OctreeNode m_Tree; 00162 // OctreeColorMapFunction m_ColorMapFunction; 00163 MappingFunctionType m_MappingFunction; 00164 }; 00165 00166 } 00167 00168 #ifndef ITK_MANUAL_INSTANTIATION 00169 #include "itkOctree.txx" 00170 #endif 00171 00172 #endif /* __ITKOCTREE_H__ */

Generated at Sun Apr 1 02:40:03 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000