00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkImageRandomConstIteratorWithIndex_h
00018
#define __itkImageRandomConstIteratorWithIndex_h
00019
00020
#include "itkImageConstIteratorWithIndex.h"
00021
00022
namespace itk
00023 {
00024
00094
template<
typename TImage>
00095 class ITK_EXPORT ImageRandomConstIteratorWithIndex :
public ImageConstIteratorWithIndex<TImage>
00096 {
00097
public:
00099 typedef ImageRandomConstIteratorWithIndex
Self;
00100 typedef ImageConstIteratorWithIndex<TImage> Superclass;
00101
00106 typedef typename TImage::IndexType
IndexType;
00107
00112 typedef typename TImage::RegionType
RegionType;
00113
00118 typedef TImage
ImageType;
00119
00123 typedef typename TImage::PixelContainer
PixelContainer;
00124 typedef typename PixelContainer::Pointer
PixelContainerPointer;
00125
00127 ImageRandomConstIteratorWithIndex();
00128 ~ImageRandomConstIteratorWithIndex() {};
00129
00132 ImageRandomConstIteratorWithIndex(
const ImageType *ptr,
const RegionType& region);
00133
00140 ImageRandomConstIteratorWithIndex(
const ImageConstIteratorWithIndex<TImage> &it)
00141 { this->
ImageConstIteratorWithIndex<TImage>::operator=(it); }
00142
00144
void GoToBegin(
void)
00145 {
00146 this->RandomJump();
00147 m_NumberOfSamplesDone = 0L;
00148 }
00149
00151
void GoToEnd(
void)
00152 {
00153 this->RandomJump();
00154 m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
00155 }
00156
00158
bool IsAtBegin(
void)
const
00159
{
return (m_NumberOfSamplesDone == 0L) ; }
00160
00162
bool IsAtEnd(
void)
const
00163
{
return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested); }
00164
00167
Self & operator++()
00168 {
00169 this->RandomJump();
00170 m_NumberOfSamplesDone++;
00171
return *
this;
00172 }
00173
00176 Self & operator--()
00177 {
00178 this->RandomJump();
00179 m_NumberOfSamplesDone--;
00180 return *
this;
00181 }
00182
00184
void SetNumberOfSamples(
unsigned long number );
00185
unsigned long GetNumberOfSamples(
void ) const;
00186
00188 static
void ReinitializeSeed();
00189 static
void ReinitializeSeed(
int);
00190
00191 private:
00192
void RandomJump();
00193
unsigned long m_NumberOfSamplesRequested;
00194
unsigned long m_NumberOfSamplesDone;
00195
unsigned long m_NumberOfPixelsInRegion;
00196 };
00197
00198 }
00199
00200 #ifndef ITK_MANUAL_INSTANTIATION
00201 #include "itkImageRandomConstIteratorWithIndex.txx"
00202 #endif
00203
00204 #endif
00205
00206
00207