ITK  4.8.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 >
47 {
48 public:
52  typedef typename Superclass::Baseclass Baseclass;
55 
58 
60  itkNewMacro(Self);
61 
63  typedef typename Superclass::SampleType SampleType;
67 
72  typedef typename Baseclass::SeedType SeedType;
73 
74  typedef unsigned long SearchSizeType;
75  typedef unsigned int RandomIntType;
76 
80  typedef typename Superclass::IndexType IndexType;
82  typedef typename Superclass::SizeType SizeType;
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);
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 
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  UniformRandomSpatialNeighborSubsampler(const Self&); // purposely not implemented
159  void operator=(const Self&); // purposely not implemented
160 
161 }; // end of class UniformRandomSpatialNeighborSubsampler
162 
163 } // end of namespace Statistics
164 } // end of namespace itk
165 
166 #ifndef ITK_MANUAL_INSTANTIATION
167 #include "itkUniformRandomSpatialNeighborSubsampler.hxx"
168 #endif
169 
170 #endif
Light weight base class for most itk classes.
virtual void SetSeed(SeedType _arg)
Superclass::SubsampleConstIterator SubsampleConstIterator
virtual void Search(const InstanceIdentifier &query, SubsamplePointer &results) override
virtual LightObject::Pointer InternalClone() const override
A subsampler that uniformly randomly selects points within the specified radius of the query point...
virtual void SetNumberOfResultsRequested(const SearchSizeType &numberRequested)
virtual void Modified() const
virtual RandomIntType GetIntegerVariate(RandomIntType lowerBound, RandomIntType upperBound, RandomIntType)
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
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::MeasurementVectorType MeasurementVectorType
ImageHelper< itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> ImageHelperType
Superclass::InstanceIdentifierHolder InstanceIdentifierHolder