00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkConstSmartNeighborhoodIterator_h
00018 #define __itkConstSmartNeighborhoodIterator_h
00019
00020 #include "itkConstNeighborhoodIterator.h"
00021 #include "itkZeroFluxNeumannBoundaryCondition.h"
00022
00023 namespace itk {
00024
00040 template<class TImage, class TBoundaryCondition
00041 = ZeroFluxNeumannBoundaryCondition<TImage> >
00042 class ITK_EXPORT ConstSmartNeighborhoodIterator
00043 : public ConstNeighborhoodIterator<TImage>
00044 {
00045 public:
00047 typedef ConstSmartNeighborhoodIterator Self;
00048 typedef ConstNeighborhoodIterator<TImage> Superclass;
00049
00051 typedef typename Superclass::InternalPixelType InternalPixelType;
00052 typedef typename Superclass::PixelType PixelType;
00053
00055 itkStaticConstMacro(Dimension, unsigned int,Superclass::Dimension);
00056
00058 typedef typename Superclass::ImageType ImageType;
00059 typedef typename Superclass::RegionType RegionType;
00060 typedef typename Superclass::SizeType SizeType;
00061 typedef typename Superclass::SizeValueType SizeValueType;
00062 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00063 typedef typename Superclass::IndexType IndexType;
00064 typedef typename Superclass::IndexValueType IndexValueType;
00065 typedef typename Superclass::OffsetType OffsetType;
00066 typedef typename Superclass::OffsetValueType OffsetValueType;
00067
00069 typedef typename Superclass::ImageBoundaryConditionPointerType
00070 ImageBoundaryConditionPointerType;
00071
00073 typedef TBoundaryCondition BoundaryConditionType;
00074
00077 typedef typename Superclass::ConstIterator ConstIterator;
00078
00080 ConstSmartNeighborhoodIterator()
00081 : Superclass()
00082 { for (unsigned int i=0; i < Dimension; i++)
00083 { m_InBounds[i] = false; }
00084 this->ResetBoundaryCondition();
00085 m_NeedToUseBoundaryCondition = true;}
00086
00088 ConstSmartNeighborhoodIterator(const Self& orig);
00089
00093 ConstSmartNeighborhoodIterator(const SizeType& radius,
00094 const ImageType *ptr,
00095 const RegionType& region)
00096 : Superclass()
00097 { this->Initialize(radius, ptr, region);
00098 for (unsigned int i=0; i < Dimension; i++)
00099 { m_InBounds[i] = false; }
00100 this->ResetBoundaryCondition(); }
00101
00107 virtual void Initialize(const SizeType &radius, const ImageType *ptr,
00108 const RegionType ®ion);
00109
00111 Self &operator=(const Self& orig);
00112
00115 virtual void PrintSelf(std::ostream &, Indent) const;
00116
00118 const BoundaryConditionType *GetBoundaryCondition() const
00119 { return dynamic_cast<BoundaryConditionType *>(m_BoundaryCondition); }
00120
00123 NeighborhoodType GetNeighborhood() const;
00124
00128 virtual PixelType GetPixel(const unsigned long i) const;
00129
00133 bool InBounds() const;
00134
00140 virtual void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00141 { m_BoundaryCondition = i; }
00142
00145 virtual void ResetBoundaryCondition()
00146 { m_BoundaryCondition = &m_InternalBoundaryCondition; }
00147
00149 void SetBoundaryCondition( const TBoundaryCondition &c )
00150 { m_InternalBoundaryCondition = c; }
00151
00152 protected:
00154 void SetBound(const SizeType&);
00155
00160 ImageBoundaryConditionPointerType m_BoundaryCondition;
00161
00164 mutable bool m_InBounds[Dimension];
00165
00167 IndexType m_InnerBoundsLow;
00168
00170 IndexType m_InnerBoundsHigh;
00171
00173 TBoundaryCondition m_InternalBoundaryCondition;
00174
00176 bool m_NeedToUseBoundaryCondition;
00177 };
00178
00179 }
00180
00181 #ifndef ITK_MANUAL_INSTANTIATION
00182 #include "itkConstSmartNeighborhoodIterator.txx"
00183 #endif
00184
00185 #endif
00186