ITK  6.0.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 * https://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
24namespace itk
25{
115template <typename TImage>
116class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstIteratorWithIndex<TImage>
117{
118public:
122
124 using typename Superclass::IndexType;
125 using typename Superclass::SizeType;
126 using typename Superclass::OffsetType;
127 using typename Superclass::RegionType;
128 using typename Superclass::ImageType;
129 using typename Superclass::PixelContainer;
131 using typename Superclass::InternalPixelType;
132 using typename Superclass::PixelType;
133 using typename Superclass::AccessorType;
134 using typename Superclass::IndexValueType;
135 using typename Superclass::OffsetValueType;
136 using typename Superclass::SizeValueType;
137
146
154 {
156 }
157
159 void
161 {
162 this->RandomJump();
163 m_NumberOfSamplesDone = 0L;
164 }
168 void
170 {
171 this->RandomJump();
172 m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
173 }
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 }
203 Self &
205 {
206 this->RandomJump();
207 --m_NumberOfSamplesDone;
208 return *this;
209 }
213 void
215 {
216 m_NumberOfSamplesRequested = number;
217 }
218
221 {
222 return m_NumberOfSamplesRequested;
223 }
224
226 void
228
229 void
231
232private:
234 void
236
239 SizeValueType m_NumberOfSamplesRequested{};
240 SizeValueType m_NumberOfSamplesDone{};
241 SizeValueType m_NumberOfPixelsInRegion{};
242};
243} // end namespace itk
244
245#ifndef ITK_MANUAL_INSTANTIATION
246# include "itkImageRandomConstIteratorWithIndex.hxx"
247#endif
248
249#endif
Pixel-wise addition of two images.
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
Self & operator=(const Self &it)
typename SizeType::SizeValueType SizeValueType
typename PixelContainer::Pointer PixelContainerPointer
typename TImage::InternalPixelType InternalPixelType
typename TImage::PixelContainer PixelContainer
A multi-dimensional image iterator that visits a random set of pixels within an image region.
~ImageRandomConstIteratorWithIndex() override=default
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
ImageRandomConstIteratorWithIndex(const ImageType *ptr, const RegionType &region)
ImageRandomConstIteratorWithIndex(const ImageConstIteratorWithIndex< TImage > &it)
static Pointer New()
Method for creation through the object factory.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
long IndexValueType
Definition: itkIntTypes.h:93
unsigned long SizeValueType
Definition: itkIntTypes.h:86
long OffsetValueType
Definition: itkIntTypes.h:97