ITK  6.0.0
Insight Toolkit
itkUniformRandomSpatialNeighborSubsampler.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 itkUniformRandomSpatialNeighborSubsampler_h
19#define itkUniformRandomSpatialNeighborSubsampler_h
20
23
24namespace itk
25{
26namespace Statistics
27{
48template <typename TSample, typename TRegion>
49class ITK_TEMPLATE_EXPORT UniformRandomSpatialNeighborSubsampler : public SpatialNeighborSubsampler<TSample, TRegion>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(UniformRandomSpatialNeighborSubsampler);
53
57 using Baseclass = typename Superclass::Baseclass;
60
62 itkOverrideGetNameOfClassMacro(UniformRandomSpatialNeighborSubsampler);
63
65 itkNewMacro(Self);
66
68 using typename Superclass::SampleType;
69 using typename Superclass::SampleConstPointer;
70 using typename Superclass::MeasurementVectorType;
71 using typename Superclass::InstanceIdentifier;
72
73 using typename Superclass::SubsampleType;
74 using typename Superclass::SubsamplePointer;
75 using typename Superclass::SubsampleConstIterator;
76 using typename Superclass::InstanceIdentifierHolder;
77 using SeedType = typename Baseclass::SeedType;
78
79 using SearchSizeType = unsigned long;
80 using RandomIntType = unsigned int;
81
83 using typename Superclass::RadiusType;
84 using typename Superclass::RegionType;
85 using typename Superclass::IndexType;
86 using typename Superclass::IndexValueType;
87 using typename Superclass::SizeType;
88 using typename Superclass::ImageHelperType;
89
90
93
94 void
95 SetSeed(const SeedType seed) override
96 {
97 Superclass::SetSeed(seed);
98 this->m_RandomNumberGenerator->SetSeed(this->m_Seed);
99 }
100
101 virtual void
102 SetUseClockForSeed(const bool & useClock)
103 {
104 if (useClock != this->m_UseClockForSeed)
105 {
106 this->m_UseClockForSeed = useClock;
107 if (this->m_UseClockForSeed)
108 {
109 this->m_RandomNumberGenerator->SetSeed();
110 }
111 this->Modified();
112 }
113 }
114
115 itkBooleanMacro(UseClockForSeed);
116 itkGetConstMacro(UseClockForSeed, bool);
117
118 virtual void
120 {
121 itkDebugMacro("setting NumberOfResultsRequested to " << numberRequested);
122 if (this->m_RequestMaximumNumberOfResults || this->m_NumberOfResultsRequested != numberRequested)
123 {
124 this->m_NumberOfResultsRequested = numberRequested;
125 this->m_RequestMaximumNumberOfResults = false;
126 this->Modified();
127 }
128 }
129 itkGetConstMacro(NumberOfResultsRequested, SearchSizeType);
130
136 void
137 Search(const InstanceIdentifier & query, SubsamplePointer & results) override;
138
139protected:
145 typename LightObject::Pointer
146 InternalClone() const override;
147
150
151 void
152 PrintSelf(std::ostream & os, Indent indent) const override;
153
158 virtual RandomIntType
159 GetIntegerVariate(RandomIntType lowerBound, RandomIntType upperBound, RandomIntType itkNotUsed(mean));
160
161 SearchSizeType m_NumberOfResultsRequested{};
162 RandomGeneratorType::Pointer m_RandomNumberGenerator{};
163 bool m_UseClockForSeed{};
164}; // end of class UniformRandomSpatialNeighborSubsampler
165
166} // end of namespace Statistics
167} // end of namespace itk
168
169#ifndef ITK_MANUAL_INSTANTIATION
170# include "itkUniformRandomSpatialNeighborSubsampler.hxx"
171#endif
172
173#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
typename TSample::InstanceIdentifier InstanceIdentifier
A subsampler that selects all points within the specified radius of the query point.
A subsampler that uniformly randomly selects points within the specified radius of the query point.
virtual RandomIntType GetIntegerVariate(RandomIntType lowerBound, RandomIntType upperBound, RandomIntType)
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetNumberOfResultsRequested(const SearchSizeType &numberRequested)
LightObject::Pointer InternalClone() const override
void Search(const InstanceIdentifier &query, SubsamplePointer &results) override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
long IndexValueType
Definition: itkIntTypes.h:93