ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkKdTreeGenerator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkKdTreeGenerator_h
19 #define __itkKdTreeGenerator_h
20 
21 #include <vector>
22 
23 #include "itkKdTree.h"
24 #include "itkStatisticsAlgorithm.h"
25 
26 namespace itk
27 {
28 namespace Statistics
29 {
69 template< typename TSample >
70 class KdTreeGenerator:public Object
71 {
72 public:
75  typedef Object Superclass;
78 
80  itkTypeMacro(KdTreeGenerator, Object);
81 
83  itkNewMacro(Self);
84 
86  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
87  typedef typename TSample::MeasurementType MeasurementType;
88 
90  typedef unsigned int MeasurementVectorSizeType;
91 
94 
97 
100 
103 
106 
109 
111  void SetSample(TSample *sample);
112 
115  void SetBucketSize(unsigned int size);
116 
119  {
120  return m_Tree;
121  }
122 
124  void Update()
125  {
126  this->GenerateData();
127  }
128 
130  void GenerateData();
131 
134  itkGetConstMacro(MeasurementVectorSize, unsigned int);
135 
136 protected:
138  KdTreeGenerator();
139 
141  virtual ~KdTreeGenerator() {}
142 
143  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
144 
147  {
148  return m_Subsample;
149  }
150 
152  virtual KdTreeNodeType * GenerateNonterminalNode(unsigned int beginIndex,
153  unsigned int endIndex,
155  & lowerBound,
157  & upperBound,
158  unsigned int level);
159 
161  KdTreeNodeType * GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex,
162  MeasurementVectorType & lowerBound,
163  MeasurementVectorType & upperBound,
164  unsigned int level);
165 
166 private:
167  KdTreeGenerator(const Self &); //purposely not implemented
168  void operator=(const Self &); //purposely not implemented
169 
171  TSample *m_SourceSample;
172 
177 
180  unsigned int m_BucketSize;
181 
184 
187 
190 
193 
196 }; // end of class
197 } // end of namespace Statistics
198 } // end of namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 #include "itkKdTreeGenerator.hxx"
202 #endif
203 
204 #endif
void SetBucketSize(unsigned int size)
MeasurementVectorSizeType m_MeasurementVectorSize
Light weight base class for most itk classes.
This class defines the interface of its derived classes.
Definition: itkKdTree.h:64
KdTreeType::KdTreeNodeType KdTreeNodeType
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
Definition: itkSubsample.h:41
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
virtual KdTreeNodeType * GenerateNonterminalNode(unsigned int beginIndex, unsigned int endIndex, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound, unsigned int level)
MeasurementVectorType m_TempUpperBound
TSample::MeasurementType MeasurementType
SmartPointer< const Self > ConstPointer
This class generates a KdTree object without centroid information.
SubsampleType::Pointer SubsamplePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MeasurementVectorType m_TempLowerBound
void SetSample(TSample *sample)
KdTreeNodeType * GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound, unsigned int level)
TSample::MeasurementVectorType MeasurementVectorType
Base class for most ITK classes.
Definition: itkObject.h:57
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
Definition: itkKdTree.h:483