ITK  5.2.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  * 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 {
70 template <typename TSample>
71 class ITK_TEMPLATE_EXPORT KdTreeGenerator : public Object
72 {
73 public:
74  ITK_DISALLOW_COPY_AND_MOVE(KdTreeGenerator);
75 
78  using Superclass = Object;
81 
83  itkTypeMacro(KdTreeGenerator, Object);
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 
119  void
120  SetBucketSize(unsigned int size);
121 
125  {
126  return m_Tree;
127  }
128 
130  void
132  {
133  this->GenerateData();
134  }
135 
137  void
138  GenerateData();
139 
142  itkGetConstMacro(MeasurementVectorSize, unsigned int);
143 
144 protected:
146  KdTreeGenerator();
147 
149  ~KdTreeGenerator() override = default;
150 
151  void
152  PrintSelf(std::ostream & os, Indent indent) const override;
153 
155  SubsamplePointer
157  {
158  return m_Subsample;
159  }
160 
162  virtual KdTreeNodeType *
163  GenerateNonterminalNode(unsigned int beginIndex,
164  unsigned int endIndex,
165  MeasurementVectorType & lowerBound,
166  MeasurementVectorType & upperBound,
167  unsigned int level);
168 
170  KdTreeNodeType *
171  GenerateTreeLoop(unsigned int beginIndex,
172  unsigned int endIndex,
173  MeasurementVectorType & lowerBound,
174  MeasurementVectorType & upperBound,
175  unsigned int level);
176 
177 private:
179  TSample * m_SourceSample;
180 
185 
188  unsigned int m_BucketSize;
189 
192 
195 
198 
201 
204 }; // end of class
205 } // end of namespace Statistics
206 } // end of namespace itk
207 
208 #ifndef ITK_MANUAL_INSTANTIATION
209 # include "itkKdTreeGenerator.hxx"
210 #endif
211 
212 #endif
itk::Statistics::KdTreeGenerator::m_MeasurementVectorSize
MeasurementVectorSizeType m_MeasurementVectorSize
Definition: itkKdTreeGenerator.h:203
itk::Statistics::KdTreeGenerator::m_TempLowerBound
MeasurementVectorType m_TempLowerBound
Definition: itkKdTreeGenerator.h:194
itk::Statistics::KdTree
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
Definition: itkKdTree.h:527
itk::Statistics::KdTreeGenerator::KdTreeNodeType
typename KdTreeType::KdTreeNodeType KdTreeNodeType
Definition: itkKdTreeGenerator.h:105
itk::Statistics::KdTreeGenerator::m_Subsample
SubsamplePointer m_Subsample
Definition: itkKdTreeGenerator.h:184
itk::Statistics::KdTreeGenerator::m_SourceSample
TSample * m_SourceSample
Definition: itkKdTreeGenerator.h:179
itk::Statistics::KdTreeGenerator::SubsamplePointer
typename SubsampleType::Pointer SubsamplePointer
Definition: itkKdTreeGenerator.h:111
itkStatisticsAlgorithm.h
itk::Statistics::KdTreeGenerator::GetSubsample
SubsamplePointer GetSubsample()
Definition: itkKdTreeGenerator.h:156
itk::SmartPointer< Self >
itk::Statistics::KdTreeGenerator::m_BucketSize
unsigned int m_BucketSize
Definition: itkKdTreeGenerator.h:188
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::KdTreeGenerator::MeasurementVectorType
typename TSample::MeasurementVectorType MeasurementVectorType
Definition: itkKdTreeGenerator.h:89
itk::Statistics::KdTreeGenerator::m_TempMean
MeasurementVectorType m_TempMean
Definition: itkKdTreeGenerator.h:200
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Statistics::Subsample
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
Definition: itkSubsample.h:42
itk::Statistics::KdTreeGenerator::OutputPointer
typename KdTreeType::Pointer OutputPointer
Definition: itkKdTreeGenerator.h:102
itkKdTree.h
itk::Statistics::KdTreeGenerator::MeasurementType
typename TSample::MeasurementType MeasurementType
Definition: itkKdTreeGenerator.h:90
itk::Statistics::KdTreeGenerator::Update
void Update()
Definition: itkKdTreeGenerator.h:131
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::Statistics::KdTreeGenerator::m_TempUpperBound
MeasurementVectorType m_TempUpperBound
Definition: itkKdTreeGenerator.h:197
itk::Statistics::KdTreeGenerator
This class generates a KdTree object without centroid information.
Definition: itkKdTreeGenerator.h:71
itk::Statistics::KdTreeGenerator::GetOutput
OutputPointer GetOutput()
Definition: itkKdTreeGenerator.h:124
itk::Statistics::KdTreeGenerator::m_Tree
OutputPointer m_Tree
Definition: itkKdTreeGenerator.h:191
itk::Statistics::KdTreeNode
This class defines the interface of its derived classes.
Definition: itkKdTree.h:65
itk::Statistics::KdTreeGenerator::MeasurementVectorSizeType
unsigned int MeasurementVectorSizeType
Definition: itkKdTreeGenerator.h:93