ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageRandomConstIteratorWithOnlyIndex.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 itkImageRandomConstIteratorWithOnlyIndex_h
19 #define itkImageRandomConstIteratorWithOnlyIndex_h
20 
23 
24 namespace itk
25 {
122 template< typename TImage >
124 {
125 public:
129 
132  using SizeType = typename Superclass::SizeType;
139 
142  ~ImageRandomConstIteratorWithOnlyIndex() override = default;
144 
147  ImageRandomConstIteratorWithOnlyIndex(const ImageType *ptr, const RegionType & region);
148 
156  {
158  }
159 
161  void GoToBegin()
162  {
163  this->RandomJump();
164  m_NumberOfSamplesDone = 0L;
165  }
167 
169  void GoToEnd()
170  {
171  this->RandomJump();
172  m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
173  }
175 
177  bool IsAtBegin() const
178  {
179  return ( m_NumberOfSamplesDone == 0L );
180  }
181 
183  bool IsAtEnd() const
184  {
185  return ( m_NumberOfSamplesDone >= m_NumberOfSamplesRequested );
186  }
187 
191  {
192  this->RandomJump();
193  m_NumberOfSamplesDone++;
194  return *this;
195  }
197 
201  {
202  this->RandomJump();
203  m_NumberOfSamplesDone--;
204  return *this;
205  }
207 
209  void SetNumberOfSamples(SizeValueType number);
210 
211  SizeValueType GetNumberOfSamples() const;
212 
214  void ReinitializeSeed();
215 
216  void ReinitializeSeed(int);
217 
218 private:
219  void RandomJump();
220 
226 };
227 } // end namespace itk
228 
229 #ifndef ITK_MANUAL_INSTANTIATION
230 #include "itkImageRandomConstIteratorWithOnlyIndex.hxx"
231 #endif
232 
233 #endif
Self & operator=(const Self &it)
unsigned long SizeValueType
Definition: itkIntTypes.h:83
A multi-dimensional image iterator that visits a random set of locations within an image region...
typename OffsetType::OffsetValueType OffsetValueType
A base class for multi-dimensional iterators templated over image type that are designed to provide o...
signed long IndexValueType
Definition: itkIntTypes.h:90
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
ImageRandomConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex< TImage > &it)
signed long OffsetValueType
Definition: itkIntTypes.h:94