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

itkLineConstIterator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLineConstIterator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/07/18 12:14:36 $
00007   Version:   $Revision: 1.4 $
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 __itkLineConstIterator_h
00018 #define __itkLineConstIterator_h
00019 
00020 #include "itkIndex.h"
00021 #include "itkImage.h"
00022 
00023 namespace itk
00024 {
00025 
00049 template<class TImage>
00050 class ITK_EXPORT LineConstIterator
00051 {
00052 public:
00054   typedef LineConstIterator Self;
00055 
00060   itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00061                       TImage::ImageDimension);
00062 
00064   typedef typename TImage::IndexType          IndexType;
00065   typedef typename TImage::IndexValueType     IndexValueType;
00066 
00068   typedef typename TImage::OffsetType         OffsetType;
00069   typedef typename TImage::OffsetValueType    OffsetValueType;
00070 
00072   typedef typename TImage::SizeType           SizeType;
00073   typedef typename TImage::SizeValueType      SizeValueType;
00074 
00076   typedef typename TImage::RegionType         RegionType;
00077 
00079   typedef typename TImage::SpacingType        SpacingType;
00080 
00082   typedef typename TImage::PointType          PointType;
00083   
00085   typedef TImage                              ImageType;
00086 
00090   typedef typename TImage::PixelContainer     PixelContainer;
00091   typedef typename PixelContainer::Pointer    PixelContainerPointer;
00092   
00094   typedef typename TImage::InternalPixelType  InternalPixelType;
00095 
00097   typedef typename TImage::PixelType          PixelType;
00098 
00101   typedef typename TImage::AccessorType       AccessorType;
00102 
00104   itkTypeMacro(LineConstIterator, None);
00105   
00107   static unsigned int GetImageIteratorDimension() 
00108     {
00109     return TImage::ImageDimension;
00110     }
00111 
00113   const IndexType GetIndex()
00114     {
00115     return m_CurrentImageIndex;
00116     }
00117 
00119   const PixelType & Get(void) const
00120     {
00121     return m_Image->GetPixel(m_CurrentImageIndex );
00122     }
00123  
00125   bool IsAtEnd()
00126     {
00127     return m_IsAtEnd;
00128     }
00129   
00131   void GoToBegin();
00132 
00134   void operator++();
00135 
00138   Self &operator=(const Self& it);
00139 
00141   LineConstIterator(const ImageType *imagePtr, const IndexType &firstIndex, const IndexType &lastIndex);
00142 
00144   virtual ~LineConstIterator() {};
00145 
00146 
00147 protected: //made protected so other iterators can access 
00149   typename ImageType::ConstWeakPointer m_Image;
00150 
00152   RegionType m_Region;
00153 
00155   bool m_IsAtEnd;
00156 
00158   IndexType m_CurrentImageIndex;
00159   IndexType m_StartIndex;
00160   IndexType m_LastIndex;
00161   IndexType m_EndIndex;  // one past the end of the line in the m_MainDirection
00162 
00164   // The dimension with the largest difference between start and end
00165   unsigned int m_MainDirection; 
00166 
00167   // Accumulated error for the other dimensions
00168   IndexType m_AccumulateError;
00169 
00170   // Increment for the error for each step. Two times the difference between
00171   // start and end
00172   IndexType m_IncrementError;
00173 
00174   // If enough is accumulated for a dimension, the index has to be
00175   // incremented. Will be the number of pixels in the line
00176   IndexType m_MaximalError; 
00177 
00178   // Direction of increment. -1 or 1
00179   IndexType m_OverflowIncrement; 
00180 
00181   // After an overflow, the accumulated error is reduced again. Will be
00182   // two times the number of pixels in the line
00183   IndexType m_ReduceErrorAfterIncrement; 
00184 };
00185 
00186 } // end namespace itk
00187 
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkLineConstIterator.txx"
00190 #endif
00191 
00192 #endif 

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