00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkPathIterator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2004/12/05 00:42:44 $ 00007 Version: $Revision: 1.6 $ 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 __itkPathIterator_h 00018 #define __itkPathIterator_h 00019 00020 #include "itkIndex.h" 00021 #include "itkImage.h" 00022 #include "itkPath.h" 00023 #include "itkPathConstIterator.h" 00024 00025 namespace itk 00026 { 00027 00068 template<class TImage, class TPath> 00069 class ITK_EXPORT PathIterator : public PathConstIterator<TImage, TPath> 00070 { 00071 public: 00073 typedef PathIterator Self; 00074 00079 itkStaticConstMacro(ImageIteratorDimension, unsigned int, 00080 TImage::ImageDimension); 00081 00083 typedef PathConstIterator<TImage,TPath> Superclass; 00084 00086 typedef typename Superclass::IndexType IndexType; 00087 typedef typename Superclass::IndexValueType IndexValueType; 00088 typedef typename Superclass::OffsetType OffsetType; 00089 typedef typename Superclass::OffsetValueType OffsetValueType; 00090 typedef typename Superclass::SizeType SizeType; 00091 typedef typename Superclass::SizeValueType SizeValueType; 00092 typedef typename Superclass::RegionType RegionType; 00093 typedef typename Superclass::ImageType ImageType; 00094 typedef typename Superclass::PixelContainer PixelContainer; 00095 typedef typename Superclass::PixelContainerPointer PixelContainerPointer; 00096 typedef typename Superclass::InternalPixelType InternalPixelType; 00097 typedef typename Superclass::PixelType PixelType; 00098 typedef typename Superclass::AccessorType AccessorType; 00099 typedef typename Superclass::PathType PathType; 00100 typedef typename Superclass::PathInputType PathInputType; 00101 typedef typename Superclass::PathOutputType PathOutputType; 00102 00104 itkTypeMacro(PathIterator, PathConstIterator); 00105 00106 00107 00109 void Set( const PixelType & value) 00110 { 00111 // Normally, this would just be the following: 00112 // m_Image->SetPixel(m_CurrentImageIndex,value); 00113 // However, we don't want a warning about m_Image being a ConstPointer 00114 // in the Superclass. 00115 const_cast<ImageType *>(this->m_Image.GetPointer())-> 00116 SetPixel(this->m_CurrentImageIndex,value); 00117 } 00118 00122 PixelType & Value(void) 00123 { 00124 return this->GetImage()->GetPixel(this->m_ImageIndex); 00125 } 00126 00129 Self &operator=(const Self& it); 00130 00132 PathIterator(ImageType *imagePtr, const PathType *pathPtr); 00133 00135 virtual ~PathIterator() {}; 00136 }; 00137 00138 } // end namespace itk 00139 00140 #ifndef ITK_MANUAL_INSTANTIATION 00141 #include "itkPathIterator.txx" 00142 #endif 00143 00144 #endif