00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageRandomConstIteratorWithIndex.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/25 06:08:28 $ 00007 Version: $Revision: 1.7 $ 00008 00009 Copyright (c) 2002 Insight Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 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 00147 void GoToEnd(void); 00148 00150 bool IsAtBegin(void) const 00151 { return (m_NumberOfSamplesDone > m_NumberOfSamplesRequested) ; } 00152 00154 bool IsAtEnd(void) const 00155 { return (m_NumberOfSamplesDone > m_NumberOfSamplesRequested); } 00156 00159 Self & operator++(); 00160 00163 Self & operator--(); 00164 00166 void SetNumberOfSamples( unsigned long number ); 00167 unsigned long GetNumberOfSamples( void ) const; 00168 00170 static void ReinitializeSeed(); 00171 00172 private: 00173 unsigned long m_NumberOfSamplesRequested; 00174 unsigned long m_NumberOfSamplesDone; 00175 unsigned long m_NumberOfPixelsInRegion; 00176 }; 00177 00178 } // end namespace itk 00179 00180 #ifndef ITK_MANUAL_INSTANTIATION 00181 #include "itkImageRandomConstIteratorWithIndex.txx" 00182 #endif 00183 00184 #endif 00185 00186 00187