Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageRandomConstIteratorWithIndex.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageRandomConstIteratorWithIndex.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:29:11 $
00007   Version:   $Revision: 1.11 $
00008 
00009   Copyright (c) Insight Software 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 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 } // end namespace itk
00199 
00200 #ifndef ITK_MANUAL_INSTANTIATION
00201 #include "itkImageRandomConstIteratorWithIndex.txx"
00202 #endif
00203 
00204 #endif 
00205 
00206 
00207 

Generated at Sun Jan 25 13:19:36 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000