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:
00077   typedef PathConstIterator Self;
00078 
00083   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00084                       TImage::ImageDimension);
00085 
00087   typedef typename TImage::IndexType          IndexType;
00088   typedef typename TImage::IndexValueType     IndexValueType;
00089 
00091   typedef typename TImage::OffsetType         OffsetType;
00092   typedef typename TImage::OffsetValueType    OffsetValueType;
00093 
00095   typedef typename TImage::SizeType           SizeType;
00096   typedef typename TImage::SizeValueType      SizeValueType;
00097 
00099   typedef typename TImage::RegionType         RegionType;
00100 
00102   typedef typename TImage::SpacingType        SpacingType;
00103 
00105   typedef typename TImage::PointType          PointType;
00106   
00108   typedef TImage                              ImageType;
00109 
00113   typedef typename TImage::PixelContainer     PixelContainer;
00114   typedef typename PixelContainer::Pointer    PixelContainerPointer;
00115   
00117   typedef typename TImage::InternalPixelType  InternalPixelType;
00118 
00120   typedef typename TImage::PixelType          PixelType;
00121 
00124   typedef typename TImage::AccessorType       AccessorType;
00125 
00127   typedef TPath                               PathType;
00128 
00130   typedef typename PathType::InputType        PathInputType;
00131 
00133   typedef typename PathType::OutputType       PathOutputType;
00134   
00136   itkTypeMacro(PathConstIterator, None);
00137   
00139   static unsigned int GetImageIteratorDimension() 
00140     {
00141     return TImage::ImageDimension;
00142     }
00143 
00145   const PathInputType GetPathPosition()
00146     {
00147     return m_CurrentPathPosition;
00148     }
00149 
00151   const IndexType GetIndex()
00152     {
00153     return m_CurrentImageIndex;
00154     }
00155 
00157   const PixelType & Get(void) const
00158     {
00159     return m_Image->GetPixel(m_CurrentImageIndex );
00160     }
00161  
00165   bool IsAtEnd()
00166     {
00167     return m_IsAtEnd;
00168     }
00169 
00174   inline virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
00175     {
00176     m_VisitStartIndexAsLastIndexIfClosed = flag;
00177     }
00178   
00184   void GoToBegin();
00185 
00187   void operator++();
00188 
00191   Self &operator=(const Self& it);
00192 
00194   PathConstIterator(const ImageType *imagePtr, const PathType  *pathPtr);
00195 
00197   virtual ~PathConstIterator() {};
00198 
00199 protected: //made protected so other iterators can access 
00200   // This "constant" is initialized in the constructor
00201   OffsetType  m_ZeroOffset; // = 0 for all dimensions
00202 
00204   typename ImageType::ConstWeakPointer m_Image;
00205 
00207   typename PathType::ConstPointer m_Path;
00208 
00210   RegionType m_Region;
00211 
00213   PointType m_ImageOrigin;
00214   
00216   SpacingType m_ImageSpacing;
00217 
00219   const unsigned long int* m_ImageSize;
00220   
00225   bool m_VisitStartIndexAsLastIndexIfClosed;
00226   
00228   bool m_IsAtEnd;
00229 
00231   PathInputType m_CurrentPathPosition;
00232 
00234   IndexType m_CurrentImageIndex;
00235 };
00236 
00237 } // end namespace itk
00238 
00239 #ifndef ITK_MANUAL_INSTANTIATION
00240 #include "itkPathConstIterator.txx"
00241 #endif
00242 
00243 #endif 

Generated at Wed May 24 23:49:36 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000