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

itkKdTreeGenerator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkKdTreeGenerator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/27 16:59:30 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkKdTreeGenerator_h
00018 #define __itkKdTreeGenerator_h
00019 
00020 #include <vector>
00021 #include "itkMacro.h"
00022 #include "itkPoint.h"
00023 #include "itkSize.h"
00024 #include "itkObject.h"
00025 
00026 #include "itkSample.h"
00027 #include "itkSubsample.h"
00028 #include "itkKdTree.h"
00029 #include "itkStatisticsAlgorithm.h"
00030 
00031 namespace itk{ 
00032   namespace Statistics{
00033 
00038 template < class TSample >
00039 class ITK_EXPORT KdTreeGenerator : public Object
00040 {
00041 public:
00043   typedef KdTreeGenerator Self ;
00044   typedef Object Superclass ;
00045   typedef SmartPointer<Self> Pointer;
00046 
00048   itkTypeMacro(KdTreeGenerator, Object);
00049 
00051   itkNewMacro(Self) ;
00052 
00054   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00055   typedef typename TSample::MeasurementType MeasurementType ;
00056   
00057   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00058                       TSample::MeasurementVectorSize);
00059 
00060   typedef KdTree< TSample > KdTreeType ;
00061   typedef KdTreeType OutputType ;
00062   typedef typename KdTreeType::Pointer OutputPointer ;
00063   typedef typename KdTreeType::KdTreeNodeType KdTreeNodeType ;
00064 
00065   typedef Subsample< TSample > SubsampleType ;
00066   typedef typename SubsampleType::Pointer SubsamplePointer ;
00067 
00068   void SetSample(TSample* sample) ;
00069 
00070   void SetBucketSize(int size) ;
00071 
00072   OutputType* GetOutput()
00073   { return m_Tree.GetPointer() ; }
00074 
00075   void GenerateData() ;
00076 
00077   unsigned int TotalInstance ;
00078 protected:
00079   KdTreeGenerator() ;
00080   virtual ~KdTreeGenerator() {}
00081   void PrintSelf(std::ostream& os, Indent indent) const ;
00082 
00083   SubsamplePointer GetSubsample()
00084   { return m_Subsample ; }
00085 
00086   virtual KdTreeNodeType* GenerateNonterminalNode(int beginIndex,
00087                                                   int endIndex,
00088                                                   MeasurementVectorType 
00089                                                   &lowerBound,
00090                                                   MeasurementVectorType 
00091                                                   &upperBound,
00092                                                   int level) ;
00093 
00094   KdTreeNodeType* GenerateTreeLoop(int beginIndex, int endIndex, 
00095                                    MeasurementVectorType &lowerBound,
00096                                    MeasurementVectorType &upperBound,
00097                                    int level) ;
00098 
00099   void DumpVector(MeasurementVectorType &vec) ;
00100 
00101 private:
00102   KdTreeGenerator(const Self&) ; //purposely not implemented
00103   void operator=(const Self&) ; //purposely not implemented
00104 
00105   TSample* m_SourceSample ;
00106   SubsamplePointer m_Subsample ;
00107   int m_BucketSize ;
00108   OutputPointer m_Tree ;
00109   MeasurementVectorType m_TempLowerBound ;
00110   MeasurementVectorType m_TempUpperBound ;
00111   MeasurementVectorType m_TempMean ;
00112 } ; // end of class
00113 
00114   } // end of namespace Statistics 
00115 } // end of namespace itk
00116 
00117 #ifndef ITK_MANUAL_INSTANTIATION
00118 #include "itkKdTreeGenerator.txx"
00119 #endif
00120 
00121 #endif
00122 
00123 
00124 
00125 

Generated at Wed Mar 12 01:13:04 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000