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: 2008-10-18 21:13:25 $
00007   Version:   $Revision: 1.14 $
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() {};
00148 
00151   ImageRandomConstIteratorWithIndex(const ImageType *ptr, const RegionType& region);
00152 
00159   ImageRandomConstIteratorWithIndex( const ImageConstIteratorWithIndex<TImage> &it)
00160     { this->ImageConstIteratorWithIndex<TImage>::operator=(it); }
00161 
00163   void GoToBegin(void)
00164     {
00165     this->RandomJump();
00166     m_NumberOfSamplesDone = 0L;
00167     }
00169 
00171   void GoToEnd(void)
00172     {
00173     this->RandomJump();
00174     m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
00175     }
00177 
00179   bool IsAtBegin(void) const
00180     { return (m_NumberOfSamplesDone == 0L); }
00181 
00183   bool IsAtEnd(void) const
00184     { return (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested);  }
00185 
00188   Self & operator++()
00189     {
00190     this->RandomJump();
00191     m_NumberOfSamplesDone++;
00192     return *this;
00193     }
00195 
00198   Self & operator--()
00199     {
00200     this->RandomJump();
00201     m_NumberOfSamplesDone--;
00202     return *this;
00203     }
00205 
00207   void SetNumberOfSamples( unsigned long number );
00208   unsigned long GetNumberOfSamples( void ) const;
00210 
00212   void ReinitializeSeed();
00213   void ReinitializeSeed(int);
00215 
00216 private:
00217   void RandomJump();
00218   typedef Statistics::MersenneTwisterRandomVariateGenerator::Pointer  GeneratorPointer;
00219   GeneratorPointer  m_Generator;
00220   unsigned long     m_NumberOfSamplesRequested;
00221   unsigned long     m_NumberOfSamplesDone;
00222   unsigned long     m_NumberOfPixelsInRegion;
00223 };
00224 
00225 } // end namespace itk
00226 
00227 #ifndef ITK_MANUAL_INSTANTIATION
00228 #include "itkImageRandomConstIteratorWithIndex.txx"
00229 #endif
00230 
00231 #endif 
00232 

Generated at Tue Sep 15 03:21:37 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000