ITK  5.0.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:
73  ITK_DISALLOW_COPY_AND_ASSIGN(KdTreeGenerator);
74 
77  using Superclass = Object;
80 
82  itkTypeMacro(KdTreeGenerator, Object);
83 
85  itkNewMacro(Self);
86 
88  using MeasurementVectorType = typename TSample::MeasurementVectorType;
89  using MeasurementType = typename TSample::MeasurementType;
90 
92  using MeasurementVectorSizeType = unsigned int;
93 
96 
99 
102 
105 
108 
111 
113  void SetSample(TSample *sample);
114 
117  void SetBucketSize(unsigned int size);
118 
121  {
122  return m_Tree;
123  }
124 
126  void Update()
127  {
128  this->GenerateData();
129  }
130 
132  void GenerateData();
133 
136  itkGetConstMacro(MeasurementVectorSize, unsigned int);
137 
138 protected:
140  KdTreeGenerator();
141 
143  ~KdTreeGenerator() override = default;
144 
145  void PrintSelf(std::ostream & os, Indent indent) const override;
146 
149  {
150  return m_Subsample;
151  }
152 
154  virtual KdTreeNodeType * GenerateNonterminalNode(unsigned int beginIndex,
155  unsigned int endIndex,
156  MeasurementVectorType
157  & lowerBound,
158  MeasurementVectorType
159  & upperBound,
160  unsigned int level);
161 
163  KdTreeNodeType * GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex,
164  MeasurementVectorType & lowerBound,
165  MeasurementVectorType & upperBound,
166  unsigned int level);
167 
168 private:
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
typename TSample::MeasurementType MeasurementType
MeasurementVectorSizeType m_MeasurementVectorSize
Light weight base class for most itk classes.
This class defines the interface of its derived classes.
Definition: itkKdTree.h:64
typename SubsampleType::Pointer SubsamplePointer
typename KdTreeType::Pointer OutputPointer
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
Definition: itkSubsample.h:41
typename KdTreeType::KdTreeNodeType KdTreeNodeType
MeasurementVectorType m_TempUpperBound
This class generates a KdTree object without centroid information.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MeasurementVectorType m_TempLowerBound
Base class for most ITK classes.
Definition: itkObject.h:60
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
Definition: itkKdTree.h:483
typename TSample::MeasurementVectorType MeasurementVectorType