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: 2003/12/09 17:26:02 $
00007   Version:   $Revision: 1.5 $
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 
00047 template<class TImage, class TPath>
00048 class ITK_EXPORT PathConstIterator
00049 {
00050 public:
00052   typedef PathConstIterator Self;
00053 
00058   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00059                       TImage::ImageDimension);
00060 
00062   typedef typename TImage::IndexType          IndexType;
00063   typedef typename TImage::IndexValueType     IndexValueType;
00064 
00066   typedef typename TImage::OffsetType         OffsetType;
00067   typedef typename TImage::OffsetValueType    OffsetValueType;
00068 
00070   typedef typename TImage::SizeType           SizeType;
00071   typedef typename TImage::SizeValueType      SizeValueType;
00072 
00074   typedef typename TImage::RegionType         RegionType;
00075 
00077   typedef typename TImage::SpacingType        SpacingType;
00078 
00080   typedef typename TImage::PointType          PointType;
00081   
00083   typedef TImage                              ImageType;
00084 
00088   typedef typename TImage::PixelContainer     PixelContainer;
00089   typedef typename PixelContainer::Pointer    PixelContainerPointer;
00090   
00092   typedef typename TImage::InternalPixelType  InternalPixelType;
00093 
00095   typedef typename TImage::PixelType          PixelType;
00096 
00099   typedef typename TImage::AccessorType       AccessorType;
00100 
00102   typedef TPath                               PathType;
00103 
00105   typedef typename PathType::InputType        PathInputType;
00106 
00108   typedef typename PathType::OutputType       PathOutputType;
00109   
00111   itkTypeMacro(PathConstIterator, None);
00112   
00114   static unsigned int GetImageIteratorDimension() 
00115     {
00116     return TImage::ImageDimension;
00117     }
00118 
00120   const PathInputType GetPathPosition()
00121     {
00122     return m_CurrentPathPosition;
00123     }
00124 
00126   const IndexType GetIndex()
00127     {
00128     return m_CurrentImageIndex;
00129     }
00130 
00132   const PixelType & Get(void) const
00133     {
00134     return m_Image->GetPixel(m_CurrentImageIndex );
00135     }
00136  
00140   bool IsAtEnd()
00141     {
00142     return m_IsAtEnd;
00143     }
00144 
00149   inline virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
00150     {
00151     m_VisitStartIndexAsLastIndexIfClosed = flag;
00152     }
00153   
00159   void GoToBegin();
00160 
00162   void operator++();
00163 
00166   Self &operator=(const Self& it);
00167 
00169   PathConstIterator(const ImageType *imagePtr, const PathType  *pathPtr);
00170 
00172   virtual ~PathConstIterator() {};
00173 
00174 protected: //made protected so other iterators can access 
00175   // This "constant" is initialized in the constructor
00176   OffsetType  m_ZeroOffset; // = 0 for all dimensions
00177 
00179   typename ImageType::ConstPointer m_Image;
00180 
00182   typename PathType::ConstPointer m_Path;
00183 
00185   RegionType m_Region;
00186 
00188   PointType m_ImageOrigin;
00189   
00191   SpacingType m_ImageSpacing;
00192 
00194   const unsigned long int* m_ImageSize;
00195   
00200   bool m_VisitStartIndexAsLastIndexIfClosed;
00201   
00203   bool m_IsAtEnd;
00204 
00206   PathInputType m_CurrentPathPosition;
00207 
00209   IndexType m_CurrentImageIndex;
00210 };
00211 
00212 } // end namespace itk
00213 
00214 #ifndef ITK_MANUAL_INSTANTIATION
00215 #include "itkPathConstIterator.txx"
00216 #endif
00217 
00218 #endif 

Generated at Sun Jan 25 13:19:42 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000