00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConditionalConstIterator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/11 19:39:03 $ 00007 Version: $Revision: 1.5 $ 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 __itkConditionalConstIterator_h 00018 #define __itkConditionalConstIterator_h 00019 00020 #include "itkIndex.h" 00021 00022 namespace itk 00023 { 00024 00037 template<class TImage> 00038 class ConditionalConstIterator { 00039 public: 00041 typedef ConditionalConstIterator Self; 00042 00047 itkStaticConstMacro(NDimension, unsigned int, TImage::ImageDimension); 00048 00050 typedef typename TImage::IndexType IndexType; 00051 00053 typedef typename TImage::SizeType SizeType; 00054 00056 typedef typename TImage::RegionType RegionType; 00057 00059 typedef TImage ImageType; 00060 00062 typedef typename TImage::InternalPixelType InternalPixelType; 00063 00065 typedef typename TImage::PixelType PixelType; 00066 00068 virtual bool IsPixelIncluded(const IndexType & index) const = 0; 00069 00072 Self &operator=(const Self& it) 00073 { 00074 m_Image = it.m_Image; // copy the smart pointer 00075 m_Region = it.m_Region; // copy the region 00076 } 00077 00079 static unsigned int GetIteratorDimension() 00080 {return TImage::ImageDimension;} 00081 00083 virtual const IndexType GetIndex() = 0; 00084 00086 virtual const PixelType & Get(void) const = 0; 00087 00089 virtual bool IsAtEnd() = 0; 00090 00092 virtual void operator++() = 0; 00093 00095 ConditionalConstIterator(); 00096 00098 virtual ~ConditionalConstIterator(); 00099 00100 protected: //made protected so other iterators can access 00102 //SmartPointer<const ImageType> m_Image; 00103 typename ImageType::ConstPointer m_Image; 00104 00106 RegionType m_Region; 00107 00109 bool m_IsAtEnd; 00110 }; 00111 00112 } // end namespace itk 00113 00114 #ifndef ITK_MANUAL_INSTANTIATION 00115 #include "itkConditionalConstIterator.txx" 00116 #endif 00117 00118 #endif