00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageIterator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/30 12:43:58 $ 00007 Version: $Revision: 1.44 $ 00008 00009 Copyright (c) 2002 Insight 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 00042 template<typename TImage> 00043 class ImageIterator : public ImageConstIterator<TImage> { 00044 public: 00046 typedef ImageIterator Self; 00047 00052 itkStaticConstMacro(ImageIteratorDimension, unsigned int, 00053 TImage::ImageDimension); 00054 00056 typedef ImageConstIterator<TImage> Superclass; 00057 00059 typedef typename Superclass::IndexType IndexType; 00060 typedef typename Superclass::IndexValueType IndexValueType; 00061 typedef typename Superclass::SizeType SizeType; 00062 typedef typename Superclass::SizeValueType SizeValueType; 00063 typedef typename Superclass::OffsetType OffsetType; 00064 typedef typename Superclass::OffsetValueType OffsetValueType; 00065 typedef typename Superclass::RegionType RegionType; 00066 typedef typename Superclass::ImageType ImageType; 00067 typedef typename Superclass::PixelContainer PixelContainer; 00068 typedef typename Superclass::PixelContainerPointer PixelContainerPointer; 00069 typedef typename Superclass::InternalPixelType InternalPixelType; 00070 typedef typename Superclass::PixelType PixelType; 00071 typedef typename Superclass::AccessorType AccessorType; 00072 00073 00076 ImageIterator(); 00077 00079 ~ImageIterator() {}; 00080 00081 00084 ImageIterator(const Self& it); 00085 00088 ImageIterator(TImage *ptr, const RegionType& region); 00089 00092 Self &operator=(const Self& it); 00093 00095 void Set( const PixelType & value) const 00096 { m_PixelAccessor.Set(*(const_cast<InternalPixelType *>(m_Buffer)+m_Offset),value); } 00097 00101 PixelType & Value(void) 00102 { return *(const_cast<InternalPixelType *>(m_Buffer)+m_Offset); } 00103 00107 Self Begin(void) const; 00108 00112 Self End(void) const; 00113 00115 ImageType * GetImage() const 00116 { return const_cast<ImageType *>( m_Image.GetPointer() ); }; 00117 00118 00119 protected: 00120 00122 ImageIterator(const ImageConstIterator<TImage> & it); 00123 Self &operator=(const ImageConstIterator<TImage> & it); 00124 }; 00125 00126 } // end namespace itk 00127 00128 #ifndef ITK_MANUAL_INSTANTIATION 00129 #include "itkImageIterator.txx" 00130 #endif 00131 00132 #endif