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: 2003/09/10 14:29:46 $
00007   Version:   $Revision: 1.11 $
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 __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 
00062 template < class TSample >
00063 class ITK_EXPORT KdTreeGenerator : public Object
00064 {
00065 public:
00067   typedef KdTreeGenerator Self ;
00068   typedef Object Superclass ;
00069   typedef SmartPointer<Self> Pointer;
00070 
00072   itkTypeMacro(KdTreeGenerator, Object);
00073 
00075   itkNewMacro(Self) ;
00076 
00078   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00079   typedef typename TSample::MeasurementType MeasurementType ;
00080   
00081   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00082                       TSample::MeasurementVectorSize);
00083 
00085   typedef KdTree< TSample > KdTreeType ;
00086   
00088   typedef KdTreeType OutputType ;
00089   
00091   typedef typename KdTreeType::Pointer OutputPointer ;
00092 
00094   typedef typename KdTreeType::KdTreeNodeType KdTreeNodeType ;
00095 
00097   typedef Subsample< TSample > SubsampleType ;
00098 
00100   typedef typename SubsampleType::Pointer SubsamplePointer ;
00101 
00103   void SetSample(TSample* sample) ;
00104 
00107   void SetBucketSize(int size) ;
00108 
00110   OutputPointer GetOutput()
00111   { return m_Tree ; }
00112 
00114   void Update()
00115   { this->GenerateData() ; }
00116 
00118   void GenerateData() ;
00119 
00121   unsigned int TotalInstance ;
00122 
00123 protected:
00125   KdTreeGenerator() ;
00126 
00128   virtual ~KdTreeGenerator() {}
00129 
00130   void PrintSelf(std::ostream& os, Indent indent) const ;
00131 
00133   SubsamplePointer GetSubsample()
00134   { return m_Subsample ; }
00135 
00137   virtual KdTreeNodeType* GenerateNonterminalNode(int beginIndex,
00138                                                   int endIndex,
00139                                                   MeasurementVectorType 
00140                                                   &lowerBound,
00141                                                   MeasurementVectorType 
00142                                                   &upperBound,
00143                                                   int level) ;
00144 
00146   KdTreeNodeType* GenerateTreeLoop(int beginIndex, int endIndex, 
00147                                    MeasurementVectorType &lowerBound,
00148                                    MeasurementVectorType &upperBound,
00149                                    int level) ;
00150 
00151 private:
00152   KdTreeGenerator(const Self&) ; //purposely not implemented
00153   void operator=(const Self&) ; //purposely not implemented
00154 
00156   TSample* m_SourceSample ;
00157 
00161   SubsamplePointer m_Subsample ;
00162 
00165   int m_BucketSize ;
00166   
00168   OutputPointer m_Tree ;
00169   
00171   MeasurementVectorType m_TempLowerBound ;
00172 
00174   MeasurementVectorType m_TempUpperBound ;
00175 
00177   MeasurementVectorType m_TempMean ;
00178 } ; // end of class
00179 
00180 } // end of namespace Statistics 
00181 } // end of namespace itk
00182 
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkKdTreeGenerator.txx"
00185 #endif
00186 
00187 #endif
00188 
00189 
00190 
00191 

Generated at Tue Sep 16 11:32:02 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000