ITK  4.13.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 ITK_TEMPLATE_EXPORT 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() ITK_OVERRIDE {}
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,
154  MeasurementVectorType
155  & lowerBound,
156  MeasurementVectorType
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  ITK_DISALLOW_COPY_AND_ASSIGN(KdTreeGenerator);
168 
170  TSample *m_SourceSample;
171 
176 
179  unsigned int m_BucketSize;
180 
183 
186 
189 
192 
195 }; // end of class
196 } // end of namespace Statistics
197 } // end of namespace itk
198 
199 #ifndef ITK_MANUAL_INSTANTIATION
200 #include "itkKdTreeGenerator.hxx"
201 #endif
202 
203 #endif
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
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
TSample::MeasurementVectorType MeasurementVectorType
Base class for most ITK classes.
Definition: itkObject.h:59
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
Definition: itkKdTree.h:483