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: 2005/10/03 15:18:45 $
00007   Version:   $Revision: 1.13 $
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 #include "itkMersenneTwisterRandomVariateGenerator.h"
00022 
00023 namespace itk
00024 {
00025 
00112 template<typename TImage>
00113 class ITK_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstIteratorWithIndex<TImage>
00114 {
00115 public:
00117   typedef ImageRandomConstIteratorWithIndex Self;
00118   typedef ImageConstIteratorWithIndex<TImage>  Superclass;
00119   
00124   typedef typename TImage::IndexType   IndexType;
00125 
00130   typedef typename TImage::RegionType RegionType;
00131   
00136   typedef TImage ImageType;
00137 
00141   typedef typename TImage::PixelContainer PixelContainer;
00142   typedef typename PixelContainer::Pointer PixelContainerPointer;
00143   
00145   ImageRandomConstIteratorWithIndex();
00146   ~ImageRandomConstIteratorWithIndex() {};
00147   
00150   ImageRandomConstIteratorWithIndex(const ImageType *ptr, const RegionType& region);
00151 
00158   ImageRandomConstIteratorWithIndex( const ImageConstIteratorWithIndex<TImage> &it)
00159     { this->ImageConstIteratorWithIndex<TImage>::operator=(it); }
00160 
00162   void GoToBegin(void)
00163   {
00164     this->RandomJump();
00165     m_NumberOfSamplesDone = 0L;
00166   }
00167 
00169   void GoToEnd(void)
00170   {
00171     this->RandomJump();
00172     m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
00173   }
00174 
00176   bool IsAtBegin(void) const
00177     { return (m_NumberOfSamplesDone == 0L) ; }
00178 
00180   bool IsAtEnd(void) const
00181     { return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested);  }
00182  
00185   Self & operator++()
00186   {
00187     this->RandomJump();
00188     m_NumberOfSamplesDone++;
00189     return *this;
00190   }
00191 
00194   Self & operator--()
00195   {
00196     this->RandomJump();
00197     m_NumberOfSamplesDone--;
00198     return *this;
00199   }
00200   
00202   void SetNumberOfSamples( unsigned long number );
00203   unsigned long GetNumberOfSamples( void ) const;
00204 
00206   void ReinitializeSeed();
00207   void ReinitializeSeed(int);
00208 
00209 private:
00210   void RandomJump();
00211   Statistics::MersenneTwisterRandomVariateGenerator::Pointer m_Generator;
00212   unsigned long  m_NumberOfSamplesRequested;
00213   unsigned long  m_NumberOfSamplesDone;
00214   unsigned long  m_NumberOfPixelsInRegion;
00215 };
00216 
00217 } // end namespace itk
00218 
00219 #ifndef ITK_MANUAL_INSTANTIATION
00220 #include "itkImageRandomConstIteratorWithIndex.txx"
00221 #endif
00222 
00223 #endif 
00224 
00225 
00226 

Generated at Wed May 24 23:21:12 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000