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: 2004/02/10 21:13:17 $
00007   Version:   $Revision: 1.12 $
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 
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 } // end namespace itk
00216 
00217 #ifndef ITK_MANUAL_INSTANTIATION
00218 #include "itkImageRandomConstIteratorWithIndex.txx"
00219 #endif
00220 
00221 #endif 
00222 
00223 
00224 

Generated at Tue Mar 29 23:56:10 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000