ITK
4.3.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
Common
include
itkImageRandomConstIteratorWithOnlyIndex.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 __itkImageRandomConstIteratorWithOnlyIndex_h
19
#define __itkImageRandomConstIteratorWithOnlyIndex_h
20
21
#include "
itkImageConstIteratorWithOnlyIndex.h
"
22
#include "
itkMersenneTwisterRandomVariateGenerator.h
"
23
24
namespace
itk
25
{
122
template
<
typename
TImage >
123
class
ITK_EXPORT
ImageRandomConstIteratorWithOnlyIndex
:
public
ImageConstIteratorWithOnlyIndex
< TImage >
124
{
125
public
:
127
typedef
ImageRandomConstIteratorWithOnlyIndex
Self
;
128
typedef
ImageConstIteratorWithOnlyIndex< TImage >
Superclass
;
129
131
typedef
typename
Superclass::IndexType
IndexType
;
132
typedef
typename
Superclass::SizeType
SizeType
;
133
typedef
typename
Superclass::OffsetType
OffsetType
;
134
typedef
typename
Superclass::RegionType
RegionType
;
135
typedef
typename
Superclass::ImageType
ImageType
;
136
typedef
typename
Superclass::IndexValueType
IndexValueType
;
137
typedef
typename
Superclass::OffsetValueType
OffsetValueType
;
138
typedef
typename
Superclass::SizeValueType
SizeValueType
;
139
141
ImageRandomConstIteratorWithOnlyIndex
();
142
~ImageRandomConstIteratorWithOnlyIndex
() {}
143
146
ImageRandomConstIteratorWithOnlyIndex
(
const
ImageType *ptr,
const
RegionType & region);
147
154
ImageRandomConstIteratorWithOnlyIndex
(
const
ImageConstIteratorWithOnlyIndex< TImage >
& it)
155
{
156
this->
ImageConstIteratorWithOnlyIndex< TImage >::operator=
(it);
157
}
158
160
void
GoToBegin(
void
)
161
{
162
this->RandomJump();
163
m_NumberOfSamplesDone = 0L;
164
}
166
168
void
GoToEnd(
void
)
169
{
170
this->RandomJump();
171
m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
172
}
174
176
bool
IsAtBegin(
void
)
const
177
{
178
return
( m_NumberOfSamplesDone == 0L );
179
}
180
182
bool
IsAtEnd(
void
)
const
183
{
184
return
( m_NumberOfSamplesDone >= m_NumberOfSamplesRequested );
185
}
186
189
Self
& operator++()
190
{
191
this->RandomJump();
192
m_NumberOfSamplesDone++;
193
return
*
this
;
194
}
196
199
Self
& operator--()
200
{
201
this->RandomJump();
202
m_NumberOfSamplesDone--;
203
return
*
this
;
204
}
206
208
void
SetNumberOfSamples(
SizeValueType
number);
209
210
SizeValueType
GetNumberOfSamples(
void
)
const
;
211
213
void
ReinitializeSeed();
214
215
void
ReinitializeSeed(
int
);
216
217
private
:
218
void
RandomJump();
219
220
typedef
Statistics::MersenneTwisterRandomVariateGenerator::Pointer
GeneratorPointer
;
221
GeneratorPointer
m_Generator
;
222
SizeValueType
m_NumberOfSamplesRequested
;
223
SizeValueType
m_NumberOfSamplesDone
;
224
SizeValueType
m_NumberOfPixelsInRegion
;
225
};
226
}
// end namespace itk
227
228
#ifndef ITK_MANUAL_INSTANTIATION
229
#include "itkImageRandomConstIteratorWithOnlyIndex.hxx"
230
#endif
231
232
#endif
233
Generated on Sun Dec 9 2012 01:07:35 for ITK by
1.8.2