ITK  4.13.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  typedef typename Superclass::SizeType SizeType;
139 
143 
146  ImageRandomConstIteratorWithOnlyIndex(const ImageType *ptr, const RegionType & region);
147 
155  {
157  }
158 
160  void GoToBegin(void)
161  {
162  this->RandomJump();
163  m_NumberOfSamplesDone = 0L;
164  }
166 
168  void GoToEnd(void)
169  {
170  this->RandomJump();
171  m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
172  }
174 
176  bool IsAtBegin(void) const
177  {
178  return ( m_NumberOfSamplesDone == 0L );
179  }
180 
182  bool IsAtEnd(void) const
183  {
184  return ( m_NumberOfSamplesDone >= m_NumberOfSamplesRequested );
185  }
186 
190  {
191  this->RandomJump();
192  m_NumberOfSamplesDone++;
193  return *this;
194  }
196 
200  {
201  this->RandomJump();
202  m_NumberOfSamplesDone--;
203  return *this;
204  }
206 
208  void SetNumberOfSamples(SizeValueType number);
209 
210  SizeValueType GetNumberOfSamples() const;
211 
213  void ReinitializeSeed();
214 
215  void ReinitializeSeed(int);
216 
217 private:
218  void RandomJump();
219 
225 };
226 } // end namespace itk
227 
228 #ifndef ITK_MANUAL_INSTANTIATION
229 #include "itkImageRandomConstIteratorWithOnlyIndex.hxx"
230 #endif
231 
232 #endif
Self & operator=(const Self &it)
A multi-dimensional image iterator that visits a random set of locations within an image region...
unsigned long SizeValueType
Definition: itkIntTypes.h:143
A base class for multi-dimensional iterators templated over image type that are designed to provide o...
Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
ImageRandomConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex< TImage > &it)