ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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::Statistics
25{
45
46template <typename TSample, typename TRegion>
47class ITK_TEMPLATE_EXPORT UniformRandomSpatialNeighborSubsampler : public SpatialNeighborSubsampler<TSample, TRegion>
48{
49public:
50 ITK_DISALLOW_COPY_AND_MOVE(UniformRandomSpatialNeighborSubsampler);
51
58
60 itkOverrideGetNameOfClassMacro(UniformRandomSpatialNeighborSubsampler);
61
63 itkNewMacro(Self);
64
66 using typename Superclass::SampleType;
67 using typename Superclass::SampleConstPointer;
69 using typename Superclass::InstanceIdentifier;
70
71 using typename Superclass::SubsampleType;
72 using typename Superclass::SubsamplePointer;
75 using SeedType = typename Baseclass::SeedType;
76
77 using SearchSizeType = unsigned long;
78 using RandomIntType = unsigned int;
79
81 using typename Superclass::RadiusType;
82 using typename Superclass::RegionType;
83 using typename Superclass::IndexType;
84 using typename Superclass::IndexValueType;
85 using typename Superclass::SizeType;
86 using typename Superclass::ImageHelperType;
87
88
91
92 void
93 SetSeed(const SeedType seed) override
94 {
96 this->m_RandomNumberGenerator->SetSeed(this->m_Seed);
97 }
98
99 virtual void
100 SetUseClockForSeed(const bool & useClock)
101 {
102 if (useClock != this->m_UseClockForSeed)
103 {
104 this->m_UseClockForSeed = useClock;
105 if (this->m_UseClockForSeed)
106 {
107 this->m_RandomNumberGenerator->SetSeed();
108 }
109 this->Modified();
110 }
111 }
112
113 itkBooleanMacro(UseClockForSeed);
114 itkGetConstMacro(UseClockForSeed, bool);
115
116 virtual void
118 {
119 itkDebugMacro("setting NumberOfResultsRequested to " << numberRequested);
120 if (this->m_RequestMaximumNumberOfResults || this->m_NumberOfResultsRequested != numberRequested)
121 {
122 this->m_NumberOfResultsRequested = numberRequested;
124 this->Modified();
125 }
126 }
127 itkGetConstMacro(NumberOfResultsRequested, SearchSizeType);
128
134 void
135 Search(const InstanceIdentifier & query, SubsamplePointer & results) override;
136
137protected:
143 [[nodiscard]] typename LightObject::Pointer
144 InternalClone() const override;
145
148
149 void
150 PrintSelf(std::ostream & os, Indent indent) const override;
151
156 virtual RandomIntType
157 GetIntegerVariate(RandomIntType lowerBound, RandomIntType upperBound, RandomIntType itkNotUsed(mean));
158
162}; // end of class UniformRandomSpatialNeighborSubsampler
163
164} // namespace itk::Statistics
165
166#ifndef ITK_MANUAL_INSTANTIATION
167# include "itkUniformRandomSpatialNeighborSubsampler.hxx"
168#endif
169
170#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
SmartPointer< Self > Pointer
virtual void Modified() const
Implements transparent reference counting.
ImageHelper< Self::ImageDimension, Self::ImageDimension > ImageHelperType
typename TSample::MeasurementVectorType MeasurementVectorType
typename TSample::InstanceIdentifier InstanceIdentifier
typename SubsampleType::ConstIterator SubsampleConstIterator
typename SubsampleType::InstanceIdentifierHolder InstanceIdentifierHolder
virtual void SetSeed(SeedType _arg)
UniformRandomSpatialNeighborSubsampler< TSample, TRegion > Self
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetNumberOfResultsRequested(const SearchSizeType &numberRequested)
LightObject::Pointer InternalClone() const override
virtual RandomIntType GetIntegerVariate(RandomIntType lowerBound, RandomIntType upperBound, RandomIntType mean)
void Search(const InstanceIdentifier &query, SubsamplePointer &results) override