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/12/09 16:53:08 $
00007   Version:   $Revision: 1.12 $
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   typedef SmartPointer<const Self> ConstPointer;
00071 
00073   itkTypeMacro(KdTreeGenerator, Object);
00074 
00076   itkNewMacro(Self) ;
00077 
00079   typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00080   typedef typename TSample::MeasurementType MeasurementType ;
00081   
00082   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00083                       TSample::MeasurementVectorSize);
00084 
00086   typedef KdTree< TSample > KdTreeType ;
00087   
00089   typedef KdTreeType OutputType ;
00090   
00092   typedef typename KdTreeType::Pointer OutputPointer ;
00093 
00095   typedef typename KdTreeType::KdTreeNodeType KdTreeNodeType ;
00096 
00098   typedef Subsample< TSample > SubsampleType ;
00099 
00101   typedef typename SubsampleType::Pointer SubsamplePointer ;
00102 
00104   void SetSample(TSample* sample) ;
00105 
00108   void SetBucketSize(int size) ;
00109 
00111   OutputPointer GetOutput()
00112   { return m_Tree ; }
00113 
00115   void Update()
00116   { this->GenerateData() ; }
00117 
00119   void GenerateData() ;
00120 
00122   unsigned int TotalInstance ;
00123 
00124 protected:
00126   KdTreeGenerator() ;
00127 
00129   virtual ~KdTreeGenerator() {}
00130 
00131   void PrintSelf(std::ostream& os, Indent indent) const ;
00132 
00134   SubsamplePointer GetSubsample()
00135   { return m_Subsample ; }
00136 
00138   virtual KdTreeNodeType* GenerateNonterminalNode(int beginIndex,
00139                                                   int endIndex,
00140                                                   MeasurementVectorType 
00141                                                   &lowerBound,
00142                                                   MeasurementVectorType 
00143                                                   &upperBound,
00144                                                   int level) ;
00145 
00147   KdTreeNodeType* GenerateTreeLoop(int beginIndex, int endIndex, 
00148                                    MeasurementVectorType &lowerBound,
00149                                    MeasurementVectorType &upperBound,
00150                                    int level) ;
00151 
00152 private:
00153   KdTreeGenerator(const Self&) ; //purposely not implemented
00154   void operator=(const Self&) ; //purposely not implemented
00155 
00157   TSample* m_SourceSample ;
00158 
00162   SubsamplePointer m_Subsample ;
00163 
00166   int m_BucketSize ;
00167   
00169   OutputPointer m_Tree ;
00170   
00172   MeasurementVectorType m_TempLowerBound ;
00173 
00175   MeasurementVectorType m_TempUpperBound ;
00176 
00178   MeasurementVectorType m_TempMean ;
00179 } ; // end of class
00180 
00181 } // end of namespace Statistics 
00182 } // end of namespace itk
00183 
00184 #ifndef ITK_MANUAL_INSTANTIATION
00185 #include "itkKdTreeGenerator.txx"
00186 #endif
00187 
00188 #endif
00189 
00190 
00191 
00192 

Generated at Wed Mar 30 00:00:29 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000