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

itkImageIterator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageIterator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-18 20:31:36 $
00007   Version:   $Revision: 1.54 $
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 __itkImageIterator_h
00018 #define __itkImageIterator_h
00019 
00020 #include "itkImageConstIterator.h"
00021 
00022 namespace itk
00023 {
00024 
00062 template<typename TImage>
00063 class ITK_EXPORT ImageIterator : public ImageConstIterator<TImage>
00064 {
00065 public:
00066 
00068   typedef ImageIterator Self;
00069 
00074   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00075                       TImage::ImageDimension);
00076 
00078   typedef ImageConstIterator<TImage> Superclass;
00079 
00081   typedef typename Superclass::IndexType              IndexType;
00082   typedef typename Superclass::IndexValueType         IndexValueType;
00083   typedef typename Superclass::SizeType               SizeType;
00084   typedef typename Superclass::SizeValueType          SizeValueType;
00085   typedef typename Superclass::OffsetType             OffsetType;
00086   typedef typename Superclass::OffsetValueType        OffsetValueType;
00087   typedef typename Superclass::RegionType             RegionType;
00088   typedef typename Superclass::ImageType              ImageType;
00089   typedef typename Superclass::PixelContainer         PixelContainer;
00090   typedef typename Superclass::PixelContainerPointer  PixelContainerPointer;
00091   typedef typename Superclass::InternalPixelType      InternalPixelType;
00092   typedef typename Superclass::PixelType              PixelType;
00093   typedef typename Superclass::AccessorType           AccessorType;
00094 
00095 
00098   ImageIterator();
00099 
00101   ~ImageIterator() {};
00102 
00103 
00106   ImageIterator(const Self& it);
00107 
00110   ImageIterator(TImage *ptr, const RegionType& region);
00111 
00114   Self &operator=(const Self& it);
00115 
00117   void Set( const PixelType & value ) const  
00118     { 
00119     // const_cast is needed here because m_Buffer is declared as a const
00120     // pointer in the superclass which is the ConstIterator.
00121     this->m_PixelAccessorFunctor.Set(
00122       *(const_cast<InternalPixelType *>(this->m_Buffer)+this->m_Offset), value); 
00123     }
00124 
00128   PixelType & Value(void) 
00129     { 
00130     // const_cast is needed here because m_Buffer is declared as a const
00131     // pointer in the superclass which is the ConstIterator.
00132     return *(const_cast<InternalPixelType *>(this->m_Buffer)+this->m_Offset);
00133     }
00134 
00138   Self Begin(void) const;
00139 
00143   Self End(void) const;
00144 
00146   ImageType * GetImage() const
00147     {
00148     // const_cast is needed here because m_Image is declared as a const pointer
00149     // in the base class which is the ConstIterator.
00150     return const_cast<ImageType *>( this->m_Image.GetPointer() );
00151     }
00152 
00153 
00154 protected:
00155 
00157   ImageIterator(const ImageConstIterator<TImage> & it);
00158   Self &operator=(const ImageConstIterator<TImage> & it);
00159 };
00161 
00162 } // end namespace itk
00163 
00164 // Define instantiation macro for this template.
00165 #define ITK_TEMPLATE_ImageIterator(_, EXPORT, x, y) namespace itk { \
00166   _(1(class EXPORT ImageIterator< ITK_TEMPLATE_1 x >)) \
00167   namespace Templates { typedef ImageIterator< ITK_TEMPLATE_1 x > \
00168                                                   ImageIterator##y; } \
00169   }
00170 
00171 #if ITK_TEMPLATE_EXPLICIT
00172 # include "Templates/itkImageIterator+-.h"
00173 #endif
00174 
00175 #if ITK_TEMPLATE_TXX
00176 # include "itkImageIterator.txx"
00177 #endif
00178 
00179 #endif 
00180 

Generated at Wed Nov 5 21:59:51 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000