Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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&);
00164 void operator=(const Self&);
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 };
00193
00194 }
00195 }
00196
00197 #ifndef ITK_MANUAL_INSTANTIATION
00198 #include "itkKdTreeGenerator.txx"
00199 #endif
00200
00201 #endif
00202