ITK  5.2.0
Insight Toolkit
itkImageRandomConstIteratorWithOnlyIndex.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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
163  {
164  this->RandomJump();
165  m_NumberOfSamplesDone = 0L;
166  }
168 
170  void
172  {
173  this->RandomJump();
174  m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
175  }
177 
179  bool
180  IsAtBegin() const
181  {
182  return (m_NumberOfSamplesDone == 0L);
183  }
184 
186  bool
187  IsAtEnd() const
188  {
189  return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested);
190  }
191 
194  Self &
196  {
197  this->RandomJump();
198  m_NumberOfSamplesDone++;
199  return *this;
200  }
202 
205  Self &
207  {
208  this->RandomJump();
209  m_NumberOfSamplesDone--;
210  return *this;
211  }
213 
215  void
216  SetNumberOfSamples(SizeValueType number);
217 
219  GetNumberOfSamples() const;
220 
222  void
223  ReinitializeSeed();
224 
225  void
226  ReinitializeSeed(int);
227 
228 private:
229  void
230  RandomJump();
231 
237 };
238 } // end namespace itk
239 
240 #ifndef ITK_MANUAL_INSTANTIATION
241 # include "itkImageRandomConstIteratorWithOnlyIndex.hxx"
242 #endif
243 
244 #endif
itk::ImageRandomConstIteratorWithOnlyIndex::IsAtBegin
bool IsAtBegin() const
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:180
itk::ImageRandomConstIteratorWithOnlyIndex::ImageRandomConstIteratorWithOnlyIndex
ImageRandomConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex< TImage > &it)
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:155
itk::ImageConstIteratorWithOnlyIndex::SizeType
typename TImage::SizeType SizeType
Definition: itkImageConstIteratorWithOnlyIndex.h:112
itk::ImageConstIteratorWithOnlyIndex::OffsetType
typename TImage::OffsetType OffsetType
Definition: itkImageConstIteratorWithOnlyIndex.h:122
itk::ImageRandomConstIteratorWithOnlyIndex::m_NumberOfSamplesRequested
SizeValueType m_NumberOfSamplesRequested
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:234
itk::ImageRandomConstIteratorWithOnlyIndex::IsAtEnd
bool IsAtEnd() const
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:187
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ImageConstIteratorWithOnlyIndex::RegionType
typename TImage::RegionType RegionType
Definition: itkImageConstIteratorWithOnlyIndex.h:116
itk::ImageConstIteratorWithOnlyIndex::IndexValueType
typename IndexType::IndexValueType IndexValueType
Definition: itkImageConstIteratorWithOnlyIndex.h:109
itk::ImageRandomConstIteratorWithOnlyIndex::m_Generator
GeneratorPointer m_Generator
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:233
itk::ImageRandomConstIteratorWithOnlyIndex::m_NumberOfPixelsInRegion
SizeValueType m_NumberOfPixelsInRegion
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:236
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageRandomConstIteratorWithOnlyIndex::operator--
Self & operator--()
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:206
itk::ImageConstIteratorWithOnlyIndex::ImageType
TImage ImageType
Definition: itkImageConstIteratorWithOnlyIndex.h:119
itk::ImageRandomConstIteratorWithOnlyIndex::GeneratorPointer
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:232
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageConstIteratorWithOnlyIndex::operator=
Self & operator=(const Self &it)
itkImageConstIteratorWithOnlyIndex.h
itk::ImageConstIteratorWithOnlyIndex
A base class for multi-dimensional iterators templated over image type that are designed to provide o...
Definition: itkImageConstIteratorWithOnlyIndex.h:95
itkMersenneTwisterRandomVariateGenerator.h
itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer
SmartPointer< Self > Pointer
Definition: itkMersenneTwisterRandomVariateGenerator.h:133
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageRandomConstIteratorWithOnlyIndex::GoToEnd
void GoToEnd()
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:171
itk::ImageRandomConstIteratorWithOnlyIndex::m_NumberOfSamplesDone
SizeValueType m_NumberOfSamplesDone
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:235
itk::ImageRandomConstIteratorWithOnlyIndex::operator++
Self & operator++()
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:195
itk::OffsetValueType
signed long OffsetValueType
Definition: itkIntTypes.h:94
itk::ImageRandomConstIteratorWithOnlyIndex::GoToBegin
void GoToBegin()
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:162
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itk::ImageConstIteratorWithOnlyIndex::SizeValueType
typename SizeType::SizeValueType SizeValueType
Definition: itkImageConstIteratorWithOnlyIndex.h:113
itk::ImageConstIteratorWithOnlyIndex::IndexType
typename TImage::IndexType IndexType
Definition: itkImageConstIteratorWithOnlyIndex.h:108
itk::ImageConstIteratorWithOnlyIndex::OffsetValueType
typename OffsetType::OffsetValueType OffsetValueType
Definition: itkImageConstIteratorWithOnlyIndex.h:123
itk::ImageRandomConstIteratorWithOnlyIndex
A multi-dimensional image iterator that visits a random set of locations within an image region,...
Definition: itkImageRandomConstIteratorWithOnlyIndex.h:123
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83