ITK  6.0.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 * 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 itkImageRandomConstIteratorWithOnlyIndex_h
19#define itkImageRandomConstIteratorWithOnlyIndex_h
20
23
24namespace itk
25{
122template <typename TImage>
124{
125public:
129
131 using typename Superclass::IndexType;
132 using typename Superclass::SizeType;
133 using typename Superclass::OffsetType;
134 using typename Superclass::RegionType;
135 using typename Superclass::ImageType;
136 using typename Superclass::IndexValueType;
137 using typename Superclass::OffsetValueType;
138 using typename Superclass::SizeValueType;
139
148
156 {
158 }
159
161 void
163 {
164 this->RandomJump();
165 m_NumberOfSamplesDone = 0L;
166 }
170 void
172 {
173 this->RandomJump();
174 m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
175 }
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 }
205 Self &
207 {
208 this->RandomJump();
209 --m_NumberOfSamplesDone;
210 return *this;
211 }
215 void
217 {
218 m_NumberOfSamplesRequested = number;
219 }
220
223 {
224 return m_NumberOfSamplesRequested;
225 }
226
228 void
230
231 void
233
234private:
236 void
238
241 SizeValueType m_NumberOfSamplesRequested{};
242 SizeValueType m_NumberOfSamplesDone{};
243 SizeValueType m_NumberOfPixelsInRegion{};
244};
245} // end namespace itk
246
247#ifndef ITK_MANUAL_INSTANTIATION
248# include "itkImageRandomConstIteratorWithOnlyIndex.hxx"
249#endif
250
251#endif
Pixel-wise addition of two images.
A base class for multi-dimensional iterators templated over image type that are designed to provide o...
A multi-dimensional image iterator that visits a random set of locations within an image region,...
ImageRandomConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex< TImage > &it)
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer
~ImageRandomConstIteratorWithOnlyIndex() override=default
ImageRandomConstIteratorWithOnlyIndex(const ImageType *ptr, const RegionType &region)
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