ITK  5.1.0
Insight 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
114  SetSample(TSample * sample);
115 
118  void
119  SetBucketSize(unsigned int size);
120 
124  {
125  return m_Tree;
126  }
127 
129  void
131  {
132  this->GenerateData();
133  }
134 
136  void
137  GenerateData();
138 
141  itkGetConstMacro(MeasurementVectorSize, unsigned int);
142 
143 protected:
145  KdTreeGenerator();
146 
148  ~KdTreeGenerator() override = default;
149 
150  void
151  PrintSelf(std::ostream & os, Indent indent) const override;
152 
154  SubsamplePointer
156  {
157  return m_Subsample;
158  }
159 
161  virtual KdTreeNodeType *
162  GenerateNonterminalNode(unsigned int beginIndex,
163  unsigned int endIndex,
164  MeasurementVectorType & lowerBound,
165  MeasurementVectorType & upperBound,
166  unsigned int level);
167 
169  KdTreeNodeType *
170  GenerateTreeLoop(unsigned int beginIndex,
171  unsigned int endIndex,
172  MeasurementVectorType & lowerBound,
173  MeasurementVectorType & upperBound,
174  unsigned int level);
175 
176 private:
178  TSample * m_SourceSample;
179 
184 
187  unsigned int m_BucketSize;
188 
191 
194 
197 
200 
203 }; // end of class
204 } // end of namespace Statistics
205 } // end of namespace itk
206 
207 #ifndef ITK_MANUAL_INSTANTIATION
208 # include "itkKdTreeGenerator.hxx"
209 #endif
210 
211 #endif
itk::Statistics::KdTreeGenerator::m_MeasurementVectorSize
MeasurementVectorSizeType m_MeasurementVectorSize
Definition: itkKdTreeGenerator.h:202
itk::Statistics::KdTreeGenerator::m_TempLowerBound
MeasurementVectorType m_TempLowerBound
Definition: itkKdTreeGenerator.h:193
itk::Statistics::KdTree
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
Definition: itkKdTree.h:522
itk::Statistics::KdTreeGenerator::KdTreeNodeType
typename KdTreeType::KdTreeNodeType KdTreeNodeType
Definition: itkKdTreeGenerator.h:104
itk::Statistics::KdTreeGenerator::m_Subsample
SubsamplePointer m_Subsample
Definition: itkKdTreeGenerator.h:183
itk::Statistics::KdTreeGenerator::m_SourceSample
TSample * m_SourceSample
Definition: itkKdTreeGenerator.h:178
itk::Statistics::KdTreeGenerator::SubsamplePointer
typename SubsampleType::Pointer SubsamplePointer
Definition: itkKdTreeGenerator.h:110
itkStatisticsAlgorithm.h
itk::Statistics::KdTreeGenerator::GetSubsample
SubsamplePointer GetSubsample()
Definition: itkKdTreeGenerator.h:155
itk::SmartPointer< Self >
itk::Statistics::KdTreeGenerator::m_BucketSize
unsigned int m_BucketSize
Definition: itkKdTreeGenerator.h:187
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::KdTreeGenerator::MeasurementVectorType
typename TSample::MeasurementVectorType MeasurementVectorType
Definition: itkKdTreeGenerator.h:88
itk::Statistics::KdTreeGenerator::m_TempMean
MeasurementVectorType m_TempMean
Definition: itkKdTreeGenerator.h:199
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:41
itk::Statistics::KdTreeGenerator::OutputPointer
typename KdTreeType::Pointer OutputPointer
Definition: itkKdTreeGenerator.h:101
itkKdTree.h
itk::Statistics::KdTreeGenerator::MeasurementType
typename TSample::MeasurementType MeasurementType
Definition: itkKdTreeGenerator.h:89
itk::Statistics::KdTreeGenerator::Update
void Update()
Definition: itkKdTreeGenerator.h:130
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:60
itk::Statistics::KdTreeGenerator::m_TempUpperBound
MeasurementVectorType m_TempUpperBound
Definition: itkKdTreeGenerator.h:196
itk::Statistics::KdTreeGenerator
This class generates a KdTree object without centroid information.
Definition: itkKdTreeGenerator.h:70
itk::Statistics::KdTreeGenerator::GetOutput
OutputPointer GetOutput()
Definition: itkKdTreeGenerator.h:123
itk::Statistics::KdTreeGenerator::m_Tree
OutputPointer m_Tree
Definition: itkKdTreeGenerator.h:190
itk::Statistics::KdTreeNode
This class defines the interface of its derived classes.
Definition: itkKdTree.h:64
itk::Statistics::KdTreeGenerator::MeasurementVectorSizeType
unsigned int MeasurementVectorSizeType
Definition: itkKdTreeGenerator.h:92