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
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&) ;
00153
void operator=(
const Self&) ;
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 } ;
00179
00180 }
00181 }
00182
00183
#ifndef ITK_MANUAL_INSTANTIATION
00184
#include "itkKdTreeGenerator.txx"
00185
#endif
00186
00187
#endif
00188
00189
00190
00191