ITK
4.2.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
Common
include
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
21
#include "
itkImageConstIteratorWithIndex.h
"
22
#include "
itkMersenneTwisterRandomVariateGenerator.h
"
23
24
namespace
itk
25
{
115
template
<
typename
TImage >
116
class
ITK_EXPORT
ImageRandomConstIteratorWithIndex
:
public
ImageConstIteratorWithIndex
< TImage >
117
{
118
public
:
120
typedef
ImageRandomConstIteratorWithIndex
Self
;
121
typedef
ImageConstIteratorWithIndex< TImage >
Superclass
;
122
124
typedef
typename
Superclass::IndexType
IndexType
;
125
typedef
typename
Superclass::SizeType
SizeType
;
126
typedef
typename
Superclass::OffsetType
OffsetType
;
127
typedef
typename
Superclass::RegionType
RegionType
;
128
typedef
typename
Superclass::ImageType
ImageType
;
129
typedef
typename
Superclass::PixelContainer
PixelContainer
;
130
typedef
typename
Superclass::PixelContainerPointer
PixelContainerPointer
;
131
typedef
typename
Superclass::InternalPixelType
InternalPixelType
;
132
typedef
typename
Superclass::PixelType
PixelType
;
133
typedef
typename
Superclass::AccessorType
AccessorType
;
134
typedef
typename
Superclass::IndexValueType
IndexValueType
;
135
typedef
typename
Superclass::OffsetValueType
OffsetValueType
;
136
typedef
typename
Superclass::SizeValueType
SizeValueType
;
137
139
ImageRandomConstIteratorWithIndex
();
140
~ImageRandomConstIteratorWithIndex
() {}
141
144
ImageRandomConstIteratorWithIndex
(
const
ImageType *ptr,
const
RegionType & region);
145
152
ImageRandomConstIteratorWithIndex
(
const
ImageConstIteratorWithIndex< TImage >
& it)
153
{
154
this->
ImageConstIteratorWithIndex< TImage >::operator=
(it);
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
218
typedef
Statistics::MersenneTwisterRandomVariateGenerator::Pointer
GeneratorPointer
;
219
GeneratorPointer
m_Generator
;
220
SizeValueType
m_NumberOfSamplesRequested
;
221
SizeValueType
m_NumberOfSamplesDone
;
222
SizeValueType
m_NumberOfPixelsInRegion
;
223
};
224
}
// end namespace itk
225
226
#ifndef ITK_MANUAL_INSTANTIATION
227
#include "itkImageRandomConstIteratorWithIndex.hxx"
228
#endif
229
230
#endif
231
Generated on Tue Jul 10 2012 23:29:38 for ITK by
1.8.1