ITK  6.0.0
Insight Toolkit
itkKdTreeGenerator.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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"
25
26namespace itk
27{
28namespace Statistics
29{
70template <typename TSample>
71class ITK_TEMPLATE_EXPORT KdTreeGenerator : public Object
72{
73public:
74 ITK_DISALLOW_COPY_AND_MOVE(KdTreeGenerator);
75
81
83 itkOverrideGetNameOfClassMacro(KdTreeGenerator);
84
86 itkNewMacro(Self);
87
89 using MeasurementVectorType = typename TSample::MeasurementVectorType;
90 using MeasurementType = typename TSample::MeasurementType;
91
93 using MeasurementVectorSizeType = unsigned int;
94
97
100
103
106
109
112
114 void
115 SetSample(TSample * sample);
116 itkGetConstMacro(SourceSample, TSample *);
121 void
122 SetBucketSize(unsigned int size);
123 itkGetConstMacro(BucketSize, unsigned int);
129 {
130 return m_Tree;
131 }
132
134 void
136 {
137 this->GenerateData();
138 }
139
141 void
143
146 itkGetConstMacro(MeasurementVectorSize, unsigned int);
147
148protected:
151
153 ~KdTreeGenerator() override = default;
154
155 void
156 PrintSelf(std::ostream & os, Indent indent) const override;
157
161 {
162 return m_Subsample;
163 }
164
166 virtual KdTreeNodeType *
167 GenerateNonterminalNode(unsigned int beginIndex,
168 unsigned int endIndex,
169 MeasurementVectorType & lowerBound,
170 MeasurementVectorType & upperBound,
171 unsigned int level);
172
175 GenerateTreeLoop(unsigned int beginIndex,
176 unsigned int endIndex,
177 MeasurementVectorType & lowerBound,
178 MeasurementVectorType & upperBound,
179 unsigned int level);
180
181private:
183 TSample * m_SourceSample{};
184
188 SubsamplePointer m_Subsample{};
189
192 unsigned int m_BucketSize{};
193
196
198 MeasurementVectorType m_TempLowerBound{};
199
201 MeasurementVectorType m_TempUpperBound{};
202
205
207 MeasurementVectorSizeType m_MeasurementVectorSize{};
208}; // end of class
209} // end of namespace Statistics
210} // end of namespace itk
211
212#ifndef ITK_MANUAL_INSTANTIATION
213# include "itkKdTreeGenerator.hxx"
214#endif
215
216#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
This class generates a KdTree object without centroid information.
typename TSample::MeasurementType MeasurementType
typename KdTreeType::KdTreeNodeType KdTreeNodeType
virtual KdTreeNodeType * GenerateNonterminalNode(unsigned int beginIndex, unsigned int endIndex, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound, unsigned int level)
typename SubsampleType::Pointer SubsamplePointer
void SetBucketSize(unsigned int size)
KdTreeNodeType * GenerateTreeLoop(unsigned int beginIndex, unsigned int endIndex, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound, unsigned int level)
typename TSample::MeasurementVectorType MeasurementVectorType
typename KdTreeType::Pointer OutputPointer
void SetSample(TSample *sample)
void PrintSelf(std::ostream &os, Indent indent) const override
~KdTreeGenerator() override=default
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
Definition: itkKdTree.h:528
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
Definition: itkSubsample.h:43
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
This class defines the interface of its derived classes.
Definition: itkKdTree.h:66