ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkImageRandomConstIteratorWithIndex.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 __itkImageRandomConstIteratorWithIndex_h
19 #define __itkImageRandomConstIteratorWithIndex_h
20 
23 
24 namespace itk
25 {
115 template< typename TImage >
117 {
118 public:
122 
125  typedef typename Superclass::SizeType SizeType;
137 
141 
144  ImageRandomConstIteratorWithIndex(const ImageType *ptr, const RegionType & region);
145 
153  {
155  }
156 
158  void GoToBegin(void)
159  {
160  this->RandomJump();
161  m_NumberOfSamplesDone = 0L;
162  }
164 
166  void GoToEnd(void)
167  {
168  this->RandomJump();
169  m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
170  }
172 
174  bool IsAtBegin(void) const
175  {
176  return ( m_NumberOfSamplesDone == 0L );
177  }
178 
180  bool IsAtEnd(void) const
181  {
182  return ( m_NumberOfSamplesDone >= m_NumberOfSamplesRequested );
183  }
184 
187  Self & operator++()
188  {
189  this->RandomJump();
190  m_NumberOfSamplesDone++;
191  return *this;
192  }
194 
197  Self & operator--()
198  {
199  this->RandomJump();
200  m_NumberOfSamplesDone--;
201  return *this;
202  }
204 
206  void SetNumberOfSamples(SizeValueType number);
207 
208  SizeValueType GetNumberOfSamples(void) const;
209 
211  void ReinitializeSeed();
212 
213  void ReinitializeSeed(int);
214 
215 private:
216  void RandomJump();
217 
223 };
224 } // end namespace itk
225 
226 #ifndef ITK_MANUAL_INSTANTIATION
227 #include "itkImageRandomConstIteratorWithIndex.hxx"
228 #endif
229 
230 #endif
231