ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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::Statistics
27{
67
68template <typename TSample>
69class ITK_TEMPLATE_EXPORT KdTreeGenerator : public Object
70{
71public:
72 ITK_DISALLOW_COPY_AND_MOVE(KdTreeGenerator);
73
79
81 itkOverrideGetNameOfClassMacro(KdTreeGenerator);
82
84 itkNewMacro(Self);
87 using MeasurementVectorType = typename TSample::MeasurementVectorType;
88 using MeasurementType = typename TSample::MeasurementType;
89
91 using MeasurementVectorSizeType = unsigned int;
92
95
98
101
104
107
110
113 void
114 SetSample(TSample * sample);
115 itkGetConstMacro(SourceSample, TSample *);
120 void
121 SetBucketSize(unsigned int size);
122 itkGetConstMacro(BucketSize, unsigned int);
127 {
128 return m_Tree;
129 }
130
132 void
134 {
135 this->GenerateData();
136 }
137
139 void
141
144 itkGetConstMacro(MeasurementVectorSize, unsigned int);
145
146protected:
149
151 ~KdTreeGenerator() override = default;
152
153 void
154 PrintSelf(std::ostream & os, Indent indent) const override;
155
159 {
160 return m_Subsample;
161 }
162
164 virtual KdTreeNodeType *
165 GenerateNonterminalNode(unsigned int beginIndex,
166 unsigned int endIndex,
167 MeasurementVectorType & lowerBound,
168 MeasurementVectorType & upperBound,
169 unsigned int level);
170
173 GenerateTreeLoop(unsigned int beginIndex,
174 unsigned int endIndex,
175 MeasurementVectorType & lowerBound,
176 MeasurementVectorType & upperBound,
177 unsigned int level);
178
179private:
181 TSample * m_SourceSample{};
182
187
190 unsigned int m_BucketSize{};
191
194
197
200
203
206}; // end of class
207} // namespace itk::Statistics
208
209#ifndef ITK_MANUAL_INSTANTIATION
210# include "itkKdTreeGenerator.hxx"
211#endif
212
213#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
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 SampleAdaptorType::MeasurementVectorType MeasurementVectorType
typename KdTreeType::Pointer OutputPointer
SmartPointer< const Self > ConstPointer
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:534
SmartPointer< Self > Pointer
Definition itkKdTree.h:541
KdTreeNode< TSample > KdTreeNodeType
Definition itkKdTree.h:567
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
SmartPointer< Self > Pointer
typename AdaptorType::MeasurementVectorType MeasurementVectorType