00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkLineIterator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-01-30 20:56:09 $ 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 __itkLineIterator_h 00018 #define __itkLineIterator_h 00019 00020 #include "itkIndex.h" 00021 #include "itkImage.h" 00022 #include "itkLineConstIterator.h" 00023 00024 namespace itk 00025 { 00026 00051 template<class TImage> 00052 class ITK_EXPORT LineIterator : public LineConstIterator<TImage> 00053 { 00054 public: 00055 00057 typedef LineIterator Self; 00058 00063 itkStaticConstMacro(ImageIteratorDimension, unsigned int, 00064 TImage::ImageDimension); 00065 00067 typedef LineConstIterator<TImage> Superclass; 00068 00070 typedef typename Superclass::IndexType IndexType; 00071 typedef typename Superclass::IndexValueType IndexValueType; 00072 typedef typename Superclass::OffsetType OffsetType; 00073 typedef typename Superclass::OffsetValueType OffsetValueType; 00074 typedef typename Superclass::SizeType SizeType; 00075 typedef typename Superclass::SizeValueType SizeValueType; 00076 typedef typename Superclass::RegionType RegionType; 00077 typedef typename Superclass::ImageType ImageType; 00078 typedef typename Superclass::PixelContainer PixelContainer; 00079 typedef typename Superclass::PixelContainerPointer PixelContainerPointer; 00080 typedef typename Superclass::InternalPixelType InternalPixelType; 00081 typedef typename Superclass::PixelType PixelType; 00082 typedef typename Superclass::AccessorType AccessorType; 00083 00085 itkTypeMacro(LineIterator, LineConstIterator); 00086 00088 void Set( const PixelType & value) 00089 { 00090 // Normally, this would just be the following: 00091 // m_Image->SetPixel(m_CurrentImageIndex,value); 00092 // However, we don't want a warning about m_Image being a ConstPointer 00093 // in the Superclass. 00094 const_cast<ImageType *>(this->m_Image.GetPointer())-> 00095 SetPixel(this->m_CurrentImageIndex,value); 00096 } 00098 00102 const PixelType & Value(void) 00103 { 00104 return (this->m_Image->GetPixel(this->m_CurrentImageIndex)); 00105 } 00106 00109 Self &operator=(const Self& it); 00110 00112 LineIterator(ImageType *imagePtr, const IndexType &firstIndex, 00113 const IndexType &lastIndex); 00114 00116 virtual ~LineIterator() {}; 00117 }; 00118 00119 } // end namespace itk 00120 00121 // Define instantiation macro for this template. 00122 #define ITK_TEMPLATE_LineIterator(_, EXPORT, x, y) namespace itk { \ 00123 _(1(class EXPORT LineIterator< ITK_TEMPLATE_1 x >)) \ 00124 namespace Templates { typedef LineIterator< ITK_TEMPLATE_1 x > \ 00125 LineIterator##y; } \ 00126 } 00127 00128 #if ITK_TEMPLATE_EXPLICIT 00129 # include "Templates/itkLineIterator+-.h" 00130 #endif 00131 00132 #if ITK_TEMPLATE_TXX 00133 # include "itkLineIterator.txx" 00134 #endif 00135 00136 #endif 00137