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

Numerics/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-03-04 15:23:51 $
00007   Version:   $Revision: 1.16 $
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     { return m_Tree; }
00119 
00121   void Update()
00122     { this->GenerateData(); }
00123 
00125   void GenerateData();
00126 
00128   unsigned int TotalInstance;
00129 
00132   itkGetConstMacro( MeasurementVectorSize, unsigned int );
00133 
00134 protected:
00136   KdTreeGenerator();
00137 
00139   virtual ~KdTreeGenerator() {}
00140 
00141   void PrintSelf(std::ostream& os, Indent indent) const;
00142 
00144   SubsamplePointer GetSubsample()
00145     { return m_Subsample; }
00146 
00148   virtual KdTreeNodeType* GenerateNonterminalNode(unsigned int beginIndex,
00149                                                   unsigned int endIndex,
00150                                                   MeasurementVectorType
00151                                                   &lowerBound,
00152                                                   MeasurementVectorType
00153                                                   &upperBound,
00154                                                   unsigned int level);
00155 
00157   KdTreeNodeType* GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex,
00158                                    MeasurementVectorType &lowerBound,
00159                                    MeasurementVectorType &upperBound,
00160                                    unsigned int level);
00161 
00162 private:
00163   KdTreeGenerator(const Self&); //purposely not implemented
00164   void operator=(const Self&); //purposely not implemented
00165 
00167   TSample* m_SourceSample;
00168 
00172   SubsamplePointer m_Subsample;
00173 
00176   unsigned int m_BucketSize;
00177 
00179   OutputPointer m_Tree;
00180 
00182   MeasurementVectorType m_TempLowerBound;
00183 
00185   MeasurementVectorType m_TempUpperBound;
00186 
00188   MeasurementVectorType m_TempMean;
00189 
00191   MeasurementVectorSizeType m_MeasurementVectorSize;
00192 }; // end of class
00193 
00194 } // end of namespace Statistics
00195 } // end of namespace itk
00196 
00197 #ifndef ITK_MANUAL_INSTANTIATION
00198 #include "itkKdTreeGenerator.txx"
00199 #endif
00200 
00201 #endif
00202 

Generated at Fri Apr 16 18:49:45 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000