00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00047 template<class TImage, class TPath>
00048 class ITK_EXPORT PathConstIterator
00049 {
00050 public:
00052 typedef PathConstIterator Self;
00053
00058 itkStaticConstMacro(ImageIteratorDimension, unsigned int,
00059 TImage::ImageDimension);
00060
00062 typedef typename TImage::IndexType IndexType;
00063 typedef typename TImage::IndexValueType IndexValueType;
00064
00066 typedef typename TImage::OffsetType OffsetType;
00067 typedef typename TImage::OffsetValueType OffsetValueType;
00068
00070 typedef typename TImage::SizeType SizeType;
00071 typedef typename TImage::SizeValueType SizeValueType;
00072
00074 typedef typename TImage::RegionType RegionType;
00075
00077 typedef TImage ImageType;
00078
00082 typedef typename TImage::PixelContainer PixelContainer;
00083 typedef typename PixelContainer::Pointer PixelContainerPointer;
00084
00086 typedef typename TImage::InternalPixelType InternalPixelType;
00087
00089 typedef typename TImage::PixelType PixelType;
00090
00093 typedef typename TImage::AccessorType AccessorType;
00094
00096 typedef TPath PathType;
00097
00099 typedef typename PathType::InputType PathInputType;
00100
00102 typedef typename PathType::OutputType PathOutputType;
00103
00105 itkTypeMacro(PathConstIterator, None);
00106
00108 static unsigned int GetImageIteratorDimension()
00109 {
00110 return TImage::ImageDimension;
00111 }
00112
00114 const PathInputType GetPathPosition()
00115 {
00116 return m_CurrentPathPosition;
00117 }
00118
00120 const IndexType GetIndex()
00121 {
00122 return m_CurrentImageIndex;
00123 }
00124
00126 const PixelType & Get(void) const
00127 {
00128 return m_Image->GetPixel(m_CurrentImageIndex );
00129 }
00130
00134 bool IsAtEnd()
00135 {
00136 return m_IsAtEnd;
00137 }
00138
00143 inline virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
00144 {
00145 m_VisitStartIndexAsLastIndexIfClosed = flag;
00146 }
00147
00153 void GoToBegin();
00154
00156 void operator++();
00157
00160 Self &operator=(const Self& it);
00161
00163 PathConstIterator(const ImageType *imagePtr, const PathType *pathPtr);
00164
00166 virtual ~PathConstIterator() {};
00167
00168 protected:
00169
00170 OffsetType m_ZeroOffset;
00171
00173 typename ImageType::ConstPointer m_Image;
00174
00176 typename PathType::ConstPointer m_Path;
00177
00179 RegionType m_Region;
00180
00182 const double* m_ImageOrigin;
00183
00185 const double* m_ImageSpacing;
00186
00188 const unsigned long int* m_ImageSize;
00189
00194 bool m_VisitStartIndexAsLastIndexIfClosed;
00195
00197 bool m_IsAtEnd;
00198
00200 PathInputType m_CurrentPathPosition;
00201
00203 IndexType m_CurrentImageIndex;
00204 };
00205
00206 }
00207
00208 #ifndef ITK_MANUAL_INSTANTIATION
00209 #include "itkPathConstIterator.txx"
00210 #endif
00211
00212 #endif