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
00111 template<typename TImage>
00112 class ITK_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstIteratorWithIndex<TImage>
00113 {
00114 public:
00116 typedef ImageRandomConstIteratorWithIndex Self;
00117 typedef ImageConstIteratorWithIndex<TImage> Superclass;
00118
00123 typedef typename TImage::IndexType IndexType;
00124
00129 typedef typename TImage::RegionType RegionType;
00130
00135 typedef TImage ImageType;
00136
00140 typedef typename TImage::PixelContainer PixelContainer;
00141 typedef typename PixelContainer::Pointer PixelContainerPointer;
00142
00144 ImageRandomConstIteratorWithIndex();
00145 ~ImageRandomConstIteratorWithIndex() {};
00146
00149 ImageRandomConstIteratorWithIndex(const ImageType *ptr, const RegionType& region);
00150
00157 ImageRandomConstIteratorWithIndex( const ImageConstIteratorWithIndex<TImage> &it)
00158 { this->ImageConstIteratorWithIndex<TImage>::operator=(it); }
00159
00161 void GoToBegin(void)
00162 {
00163 this->RandomJump();
00164 m_NumberOfSamplesDone = 0L;
00165 }
00166
00168 void GoToEnd(void)
00169 {
00170 this->RandomJump();
00171 m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
00172 }
00173
00175 bool IsAtBegin(void) const
00176 { return (m_NumberOfSamplesDone == 0L) ; }
00177
00179 bool IsAtEnd(void) const
00180 { return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested); }
00181
00184 Self & operator++()
00185 {
00186 this->RandomJump();
00187 m_NumberOfSamplesDone++;
00188 return *this;
00189 }
00190
00193 Self & operator--()
00194 {
00195 this->RandomJump();
00196 m_NumberOfSamplesDone--;
00197 return *this;
00198 }
00199
00201 void SetNumberOfSamples( unsigned long number );
00202 unsigned long GetNumberOfSamples( void ) const;
00203
00205 static void ReinitializeSeed();
00206 static void ReinitializeSeed(int);
00207
00208 private:
00209 void RandomJump();
00210 unsigned long m_NumberOfSamplesRequested;
00211 unsigned long m_NumberOfSamplesDone;
00212 unsigned long m_NumberOfPixelsInRegion;
00213 };
00214
00215 }
00216
00217 #ifndef ITK_MANUAL_INSTANTIATION
00218 #include "itkImageRandomConstIteratorWithIndex.txx"
00219 #endif
00220
00221 #endif
00222
00223
00224