ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkUniformRandomSpatialNeighborSubsampler.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 itkUniformRandomSpatialNeighborSubsampler_h
19 #define itkUniformRandomSpatialNeighborSubsampler_h
20 
23 
24 namespace itk {
25 namespace Statistics {
45 template < typename TSample, typename TRegion >
46  class ITK_TEMPLATE_EXPORT UniformRandomSpatialNeighborSubsampler : public SpatialNeighborSubsampler<TSample, TRegion>
47 {
48 public:
52  typedef typename Superclass::Baseclass Baseclass;
55 
58 
60  itkNewMacro(Self);
61 
63  typedef typename Superclass::SampleType SampleType;
64  typedef typename Superclass::SampleConstPointer SampleConstPointer;
65  typedef typename Superclass::MeasurementVectorType MeasurementVectorType;
66  typedef typename Superclass::InstanceIdentifier InstanceIdentifier;
67 
68  typedef typename Superclass::SubsampleType SubsampleType;
69  typedef typename Superclass::SubsamplePointer SubsamplePointer;
70  typedef typename Superclass::SubsampleConstIterator SubsampleConstIterator;
71  typedef typename Superclass::InstanceIdentifierHolder InstanceIdentifierHolder;
72  typedef typename Baseclass::SeedType SeedType;
73 
74  typedef unsigned long SearchSizeType;
75  typedef unsigned int RandomIntType;
76 
78  typedef typename Superclass::RadiusType RadiusType;
79  typedef typename Superclass::RegionType RegionType;
80  typedef typename Superclass::IndexType IndexType;
82  typedef typename Superclass::SizeType SizeType;
83  typedef typename Superclass::ImageHelperType ImageHelperType;
84 
85 
88 
89  virtual void SetSeed(const SeedType seed) ITK_OVERRIDE
90  {
91  Superclass::SetSeed(seed);
92  this->m_RandomNumberGenerator->SetSeed(this->m_Seed);
93  }
94 
95  virtual void SetUseClockForSeed(const bool& useClock)
96  {
97  if (useClock != this->m_UseClockForSeed)
98  {
99  this->m_UseClockForSeed = useClock;
100  if (this->m_UseClockForSeed)
101  {
102  this->m_RandomNumberGenerator->SetSeed();
103  }
104  this->Modified();
105  }
106  }
107 
108  itkBooleanMacro(UseClockForSeed);
109  itkGetConstMacro(UseClockForSeed, bool);
110 
111  virtual void SetNumberOfResultsRequested(const SearchSizeType& numberRequested)
112  {
113  itkDebugMacro("setting NumberOfResultsRequested to " << numberRequested);
114  if (this->m_RequestMaximumNumberOfResults ||
115  this->m_NumberOfResultsRequested != numberRequested)
116  {
117  this->m_NumberOfResultsRequested = numberRequested;
118  this->m_RequestMaximumNumberOfResults = false;
119  this->Modified();
120  }
121  }
122  itkGetConstMacro(NumberOfResultsRequested, SearchSizeType);
123 
129  virtual void Search(const InstanceIdentifier& query,
130  SubsamplePointer& results) ITK_OVERRIDE;
131 
132 protected:
138  virtual typename LightObject::Pointer InternalClone() const ITK_OVERRIDE;
139 
141  virtual ~UniformRandomSpatialNeighborSubsampler() ITK_OVERRIDE {};
142 
143  virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
144 
149  virtual RandomIntType GetIntegerVariate(RandomIntType lowerBound,
150  RandomIntType upperBound,
151  RandomIntType itkNotUsed(mean));
152 
156 
157 private:
158  ITK_DISALLOW_COPY_AND_ASSIGN(UniformRandomSpatialNeighborSubsampler);
159 
160 }; // end of class UniformRandomSpatialNeighborSubsampler
161 
162 } // end of namespace Statistics
163 } // end of namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkUniformRandomSpatialNeighborSubsampler.hxx"
167 #endif
168 
169 #endif
Light weight base class for most itk classes.
signed long IndexValueType
Definition: itkIntTypes.h:150
A subsampler that uniformly randomly selects points within the specified radius of the query point...
virtual void SetNumberOfResultsRequested(const SearchSizeType &numberRequested)
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
UniformRandomSpatialNeighborSubsampler< TSample, TRegion > Self
A subsampler that selects all points within the specified radius of the query point.
Control indentation during Print() invocation.
Definition: itkIndent.h:49