ITK  5.2.0
Insight Toolkit
itkImageRandomConstIteratorWithIndex.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 itkImageRandomConstIteratorWithIndex_h
19 #define itkImageRandomConstIteratorWithIndex_h
20 
23 
24 namespace itk
25 {
115 template <typename TImage>
116 class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstIteratorWithIndex<TImage>
117 {
118 public:
122 
125  using SizeType = typename Superclass::SizeType;
137 
140  ~ImageRandomConstIteratorWithIndex() override = default;
142 
145  ImageRandomConstIteratorWithIndex(const ImageType * ptr, const RegionType & region);
146 
154  {
156  }
157 
159  void
161  {
162  this->RandomJump();
163  m_NumberOfSamplesDone = 0L;
164  }
166 
168  void
170  {
171  this->RandomJump();
172  m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
173  }
175 
177  bool
178  IsAtBegin() const
179  {
180  return (m_NumberOfSamplesDone == 0L);
181  }
182 
184  bool
185  IsAtEnd() const
186  {
187  return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested);
188  }
189 
192  Self &
194  {
195  this->RandomJump();
196  m_NumberOfSamplesDone++;
197  return *this;
198  }
200 
203  Self &
205  {
206  this->RandomJump();
207  m_NumberOfSamplesDone--;
208  return *this;
209  }
211 
213  void
214  SetNumberOfSamples(SizeValueType number);
215 
217  GetNumberOfSamples() const;
218 
220  void
221  ReinitializeSeed();
222 
223  void
224  ReinitializeSeed(int);
225 
226 private:
227  void
228  RandomJump();
229 
235 };
236 } // end namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 # include "itkImageRandomConstIteratorWithIndex.hxx"
240 #endif
241 
242 #endif
itk::ImageConstIteratorWithIndex::IndexValueType
typename IndexType::IndexValueType IndexValueType
Definition: itkImageConstIteratorWithIndex.h:106
itk::ImageConstIteratorWithIndex::SizeType
typename TImage::SizeType SizeType
Definition: itkImageConstIteratorWithIndex.h:109
itk::ImageConstIteratorWithIndex::PixelContainerPointer
typename PixelContainer::Pointer PixelContainerPointer
Definition: itkImageConstIteratorWithIndex.h:122
itk::ImageRandomConstIteratorWithIndex::m_NumberOfPixelsInRegion
SizeValueType m_NumberOfPixelsInRegion
Definition: itkImageRandomConstIteratorWithIndex.h:234
itk::ImageConstIteratorWithIndex::OffsetValueType
typename OffsetType::OffsetValueType OffsetValueType
Definition: itkImageConstIteratorWithIndex.h:137
itkImageConstIteratorWithIndex.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ImageRandomConstIteratorWithIndex::ImageRandomConstIteratorWithIndex
ImageRandomConstIteratorWithIndex(const ImageConstIteratorWithIndex< TImage > &it)
Definition: itkImageRandomConstIteratorWithIndex.h:153
itk::ImageConstIteratorWithIndex::PixelType
typename TImage::PixelType PixelType
Definition: itkImageConstIteratorWithIndex.h:128
itk::ImageRandomConstIteratorWithIndex::IsAtEnd
bool IsAtEnd() const
Definition: itkImageRandomConstIteratorWithIndex.h:185
itk::ImageConstIteratorWithIndex::IndexType
typename TImage::IndexType IndexType
Definition: itkImageConstIteratorWithIndex.h:105
itk::ImageConstIteratorWithIndex::InternalPixelType
typename TImage::InternalPixelType InternalPixelType
Definition: itkImageConstIteratorWithIndex.h:125
itk::ImageRandomConstIteratorWithIndex::operator++
Self & operator++()
Definition: itkImageRandomConstIteratorWithIndex.h:193
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageRandomConstIteratorWithIndex::operator--
Self & operator--()
Definition: itkImageRandomConstIteratorWithIndex.h:204
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageRandomConstIteratorWithIndex::IsAtBegin
bool IsAtBegin() const
Definition: itkImageRandomConstIteratorWithIndex.h:178
itk::ImageConstIteratorWithIndex::AccessorType
typename TImage::AccessorType AccessorType
Definition: itkImageConstIteratorWithIndex.h:132
itk::ImageRandomConstIteratorWithIndex::m_NumberOfSamplesRequested
SizeValueType m_NumberOfSamplesRequested
Definition: itkImageRandomConstIteratorWithIndex.h:232
itk::ImageRandomConstIteratorWithIndex::GoToEnd
void GoToEnd()
Definition: itkImageRandomConstIteratorWithIndex.h:169
itk::ImageConstIteratorWithIndex
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
Definition: itkImageConstIteratorWithIndex.h:92
itkMersenneTwisterRandomVariateGenerator.h
itk::ImageRandomConstIteratorWithIndex::m_NumberOfSamplesDone
SizeValueType m_NumberOfSamplesDone
Definition: itkImageRandomConstIteratorWithIndex.h:233
itk::ImageRandomConstIteratorWithIndex::GoToBegin
void GoToBegin()
Definition: itkImageRandomConstIteratorWithIndex.h:160
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::OffsetValueType
signed long OffsetValueType
Definition: itkIntTypes.h:94
itk::ImageConstIteratorWithIndex::RegionType
typename TImage::RegionType RegionType
Definition: itkImageConstIteratorWithIndex.h:113
itk::ImageRandomConstIteratorWithIndex::GeneratorPointer
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
Definition: itkImageRandomConstIteratorWithIndex.h:230
itk::ImageRandomConstIteratorWithIndex::m_Generator
GeneratorPointer m_Generator
Definition: itkImageRandomConstIteratorWithIndex.h:231
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itk::ImageConstIteratorWithIndex::ImageType
TImage ImageType
Definition: itkImageConstIteratorWithIndex.h:116
itk::ImageConstIteratorWithIndex::PixelContainer
typename TImage::PixelContainer PixelContainer
Definition: itkImageConstIteratorWithIndex.h:121
itk::ImageConstIteratorWithIndex::SizeValueType
typename SizeType::SizeValueType SizeValueType
Definition: itkImageConstIteratorWithIndex.h:110
itk::ImageConstIteratorWithIndex::operator=
Self & operator=(const Self &it)
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageRandomConstIteratorWithIndex
A multi-dimensional image iterator that visits a random set of pixels within an image region.
Definition: itkImageRandomConstIteratorWithIndex.h:116
itk::ImageConstIteratorWithIndex::OffsetType
typename TImage::OffsetType OffsetType
Definition: itkImageConstIteratorWithIndex.h:136