ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSubsamplerBase.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 itkSubsamplerBase_h
19 #define itkSubsamplerBase_h
20 
21 #include "itkObject.h"
22 #include "itkSample.h"
23 #include "itkSubsample.h"
24 
25 namespace itk {
26 namespace Statistics {
45 template < typename TSample >
46 class ITK_TEMPLATE_EXPORT SubsamplerBase : public Object
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(SubsamplerBase);
50 
53  using Superclass = Object;
54  using Baseclass = Self;
57 
59  itkTypeMacro(SubsamplerBase, Object);
60 
62  itkCloneMacro(Self);
63 
65  using SampleType = TSample;
66  using SampleConstPointer = typename SampleType::ConstPointer;
67  using MeasurementVectorType = typename TSample::MeasurementVectorType;
68  using InstanceIdentifier = typename TSample::InstanceIdentifier;
69 
74  using SeedType = unsigned int;
75 
77  itkSetConstObjectMacro(Sample, SampleType);
78  itkGetConstObjectMacro(Sample, SampleType);
80 
84  itkSetMacro(CanSelectQuery, bool);
85  itkGetConstReferenceMacro(CanSelectQuery, bool);
86  itkBooleanMacro(CanSelectQuery);
88 
92  itkSetMacro(Seed, SeedType);
93  itkGetConstReferenceMacro(Seed, SeedType);
95 
96 
100  {
101  if (!this->m_RequestMaximumNumberOfResults)
102  {
103  this->m_RequestMaximumNumberOfResults = true;
104  this->Modified();
105  }
106  }
108 
114  virtual void Search(const InstanceIdentifier& query,
115  SubsamplePointer& results) = 0;
116 
117 protected:
123  typename LightObject::Pointer InternalClone() const override;
124 
125  SubsamplerBase();
126  ~SubsamplerBase() override = default;
127 
128  void PrintSelf(std::ostream& os, Indent indent) const override;
129 
134 }; // end of class SubsamplerBase
135 
136 } // end of namespace Statistics
137 } // end of namespace itk
138 
139 #ifndef ITK_MANUAL_INSTANTIATION
140 #include "itkSubsamplerBase.hxx"
141 #endif
142 
143 #endif
Light weight base class for most itk classes.
typename SubsampleType::InstanceIdentifierHolder InstanceIdentifierHolder
std::vector< InstanceIdentifier > InstanceIdentifierHolder
Definition: itkSubsample.h:76
typename SubsampleType::ConstIterator SubsampleConstIterator
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
Definition: itkSubsample.h:41
typename TSample::InstanceIdentifier InstanceIdentifier
typename TSample::MeasurementVectorType MeasurementVectorType
A collection of measurements for statistical analysis.
Definition: itkSample.h:61
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename SampleType::ConstPointer SampleConstPointer
Base class for most ITK classes.
Definition: itkObject.h:60
virtual void RequestMaximumNumberOfResults()
This is the base subsampler class which defines the subsampler API.
typename SubsampleType::Pointer SubsamplePointer