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

itkPathConstIterator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPathConstIterator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/11/01 21:16:31 $
00007   Version:   $Revision: 1.7 $
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 __itkPathConstIterator_h
00018 #define __itkPathConstIterator_h
00019 
00020 #include "itkIndex.h"
00021 #include "itkImage.h"
00022 #include "itkPath.h"
00023 
00024 namespace itk
00025 {
00026 
00072 template<class TImage, class TPath>
00073 class ITK_EXPORT PathConstIterator
00074 {
00075 public:
00076 
00078   typedef PathConstIterator Self;
00079 
00084   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00085                       TImage::ImageDimension);
00086 
00088   typedef typename TImage::IndexType          IndexType;
00089   typedef typename TImage::IndexValueType     IndexValueType;
00090 
00092   typedef typename TImage::OffsetType         OffsetType;
00093   typedef typename TImage::OffsetValueType    OffsetValueType;
00094 
00096   typedef typename TImage::SizeType           SizeType;
00097   typedef typename TImage::SizeValueType      SizeValueType;
00098 
00100   typedef typename TImage::RegionType         RegionType;
00101 
00103   typedef typename TImage::SpacingType        SpacingType;
00104 
00106   typedef typename TImage::PointType          PointType;
00107 
00109   typedef TImage                              ImageType;
00110 
00114   typedef typename TImage::PixelContainer     PixelContainer;
00115   typedef typename PixelContainer::Pointer    PixelContainerPointer;
00116 
00118   typedef typename TImage::InternalPixelType  InternalPixelType;
00119 
00121   typedef typename TImage::PixelType          PixelType;
00122 
00125   typedef typename TImage::AccessorType       AccessorType;
00126 
00128   typedef TPath                               PathType;
00129 
00131   typedef typename PathType::InputType        PathInputType;
00132 
00134   typedef typename PathType::OutputType       PathOutputType;
00135 
00137   itkTypeMacro(PathConstIterator, None);
00138 
00140   static unsigned int GetImageIteratorDimension() 
00141     {
00142     return TImage::ImageDimension;
00143     }
00144 
00146   const PathInputType GetPathPosition()
00147     {
00148     return m_CurrentPathPosition;
00149     }
00150 
00152   const IndexType GetIndex()
00153     {
00154     return m_CurrentImageIndex;
00155     }
00156 
00158   const PixelType & Get(void) const
00159     {
00160     return m_Image->GetPixel(m_CurrentImageIndex );
00161     }
00162 
00166   bool IsAtEnd()
00167     {
00168     return m_IsAtEnd;
00169     }
00170 
00175   inline virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
00176     {
00177     m_VisitStartIndexAsLastIndexIfClosed = flag;
00178     }
00179 
00185   void GoToBegin();
00186 
00188   void operator++();
00189 
00192   Self &operator=(const Self& it);
00193 
00195   PathConstIterator(const ImageType *imagePtr, const PathType  *pathPtr);
00196 
00198   virtual ~PathConstIterator() {};
00199 
00200 protected: //made protected so other iterators can access 
00201   // This "constant" is initialized in the constructor
00202   OffsetType  m_ZeroOffset; // = 0 for all dimensions
00203 
00205   typename ImageType::ConstWeakPointer m_Image;
00206 
00208   typename PathType::ConstPointer m_Path;
00209 
00211   RegionType m_Region;
00212 
00214   PointType m_ImageOrigin;
00215 
00217   SpacingType m_ImageSpacing;
00218 
00220   const unsigned long int* m_ImageSize;
00221 
00226   bool m_VisitStartIndexAsLastIndexIfClosed;
00227 
00229   bool m_IsAtEnd;
00230 
00232   PathInputType m_CurrentPathPosition;
00233 
00235   IndexType m_CurrentImageIndex;
00236 };
00237 
00238 } // end namespace itk
00239 
00240 #ifndef ITK_MANUAL_INSTANTIATION
00241 #include "itkPathConstIterator.txx"
00242 #endif
00243 
00244 #endif 
00245 

Generated at Wed Nov 5 23:25:20 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000