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

Review/Statistics/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: 2009-05-02 05:43:56 $
00007   Version:   $Revision: 1.1 $
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 
00068 template < class TSample >
00069 class ITK_EXPORT KdTreeGenerator : public Object
00070 {
00071 public:
00073   typedef KdTreeGenerator             Self;
00074   typedef Object                      Superclass;
00075   typedef SmartPointer<Self>          Pointer;
00076   typedef SmartPointer<const Self>    ConstPointer;
00077 
00079   itkTypeMacro(KdTreeGenerator, Object);
00080 
00082   itkNewMacro(Self);
00083 
00085   typedef typename TSample::MeasurementVectorType MeasurementVectorType;
00086   typedef typename TSample::MeasurementType       MeasurementType;
00087 
00089   typedef unsigned int  MeasurementVectorSizeType;
00090 
00092   typedef KdTree< TSample > KdTreeType;
00093 
00095   typedef KdTreeType OutputType;
00096 
00098   typedef typename KdTreeType::Pointer OutputPointer;
00099 
00101   typedef typename KdTreeType::KdTreeNodeType KdTreeNodeType;
00102 
00104   typedef Subsample< TSample > SubsampleType;
00105 
00107   typedef typename SubsampleType::Pointer SubsamplePointer;
00108 
00110   void SetSample(TSample* sample);
00111 
00114   void SetBucketSize(unsigned int size);
00115 
00117   OutputPointer GetOutput()
00118     { 
00119     return m_Tree;
00120     }
00121 
00123   void Update()
00124     {
00125     this->GenerateData();
00126     }
00127 
00129   void GenerateData();
00130 
00133   itkGetConstMacro( MeasurementVectorSize, unsigned int );
00134 
00135 protected:
00137   KdTreeGenerator();
00138 
00140   virtual ~KdTreeGenerator() {}
00141 
00142   void PrintSelf(std::ostream& os, Indent indent) const;
00143 
00145   SubsamplePointer GetSubsample()
00146     { 
00147     return m_Subsample;
00148     }
00149 
00151   virtual KdTreeNodeType* GenerateNonterminalNode(unsigned int beginIndex,
00152                                                   unsigned int endIndex,
00153                                                   MeasurementVectorType
00154                                                   &lowerBound,
00155                                                   MeasurementVectorType
00156                                                   &upperBound,
00157                                                   unsigned int level);
00158 
00160   KdTreeNodeType* GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex,
00161                                    MeasurementVectorType &lowerBound,
00162                                    MeasurementVectorType &upperBound,
00163                                    unsigned int level);
00164 
00165 private:
00166   KdTreeGenerator(const Self&); //purposely not implemented
00167   void operator=(const Self&); //purposely not implemented
00168 
00170   TSample* m_SourceSample;
00171 
00175   SubsamplePointer m_Subsample;
00176 
00179   unsigned int m_BucketSize;
00180 
00182   OutputPointer m_Tree;
00183 
00185   MeasurementVectorType m_TempLowerBound;
00186 
00188   MeasurementVectorType m_TempUpperBound;
00189 
00191   MeasurementVectorType m_TempMean;
00192 
00194   MeasurementVectorSizeType m_MeasurementVectorSize;
00195 }; // end of class
00196 
00197 } // end of namespace Statistics
00198 } // end of namespace itk
00199 
00200 #ifndef ITK_MANUAL_INSTANTIATION
00201 #include "itkKdTreeGenerator.txx"
00202 #endif
00203 
00204 #endif
00205 

Generated at Mon Jul 12 2010 18:54:41 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000