00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNeighborhoodIterator_h
00018 #define __itkNeighborhoodIterator_h
00019
00020 #include <vector>
00021 #include <string.h>
00022 #include <iostream>
00023 #include "itkConstNeighborhoodIterator.h"
00024
00025 namespace itk {
00026
00097
00210 template<class TImage, class TBoundaryCondition
00211 = ZeroFluxNeumannBoundaryCondition<TImage> >
00212 class ITK_EXPORT NeighborhoodIterator
00213 : public ConstNeighborhoodIterator<TImage,TBoundaryCondition>
00214 {
00215 public:
00217 typedef NeighborhoodIterator Self;
00218 typedef ConstNeighborhoodIterator<TImage,TBoundaryCondition> Superclass;
00219
00221 typedef typename Superclass::InternalPixelType InternalPixelType;
00222 typedef typename Superclass::PixelType PixelType;
00223 typedef typename Superclass::SizeType SizeType;
00224 typedef typename Superclass::ImageType ImageType;
00225 typedef typename Superclass::RegionType RegionType;
00226 typedef typename Superclass::IndexType IndexType;
00227 typedef typename Superclass::OffsetType OffsetType;
00228 typedef typename OffsetType::OffsetValueType OffsetValueType;
00229 typedef typename Superclass::RadiusType RadiusType;
00230 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00231 typedef typename Superclass::Iterator Iterator;
00232 typedef typename Superclass::ConstIterator ConstIterator;
00233 typedef typename Superclass::ImageBoundaryConditionPointerType
00234 ImageBoundaryConditionPointerType;
00235
00237 NeighborhoodIterator(): Superclass() {}
00238
00240 NeighborhoodIterator( const NeighborhoodIterator &n )
00241 : Superclass(n) {}
00242
00244 Self &operator=(const Self& orig)
00245 {
00246 Superclass::operator=(orig);
00247 return *this;
00248 }
00250
00253 NeighborhoodIterator(const SizeType &radius, ImageType * ptr,
00254 const RegionType ®ion)
00255 : Superclass(radius, ptr, region) { }
00256
00258 virtual void PrintSelf(std::ostream &, Indent) const;
00259
00261 InternalPixelType *GetCenterPointer()
00262 { return (this->operator[]((this->Size())>>1)); }
00263
00265 virtual void SetCenterPixel(const PixelType &p)
00266 { this->m_NeighborhoodAccessorFunctor.Set(this->operator[]((this->Size())>>1), p); }
00267
00271 virtual void SetNeighborhood(const NeighborhoodType &);
00272
00275 virtual void SetPixel(const unsigned i, const PixelType &v,
00276 bool &status);
00277
00279 virtual void SetPixel(const unsigned i, const PixelType &v);
00280
00282
00284 virtual void SetPixel(const OffsetType o, const PixelType &v)
00285 { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00286
00288
00292 virtual void SetNext(const unsigned axis, const unsigned i,
00293 const PixelType &v)
00294 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00295 + (i * this->GetStride(axis)), v); }
00296
00297
00301 virtual void SetNext(const unsigned axis, const PixelType &v)
00302 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00303 + this->GetStride(axis), v); }
00304
00308 virtual void SetPrevious(const unsigned axis, const unsigned i,
00309 const PixelType &v)
00310 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00311 - (i * this->GetStride(axis)), v); }
00312
00313
00317 virtual void SetPrevious(const unsigned axis,
00318 const PixelType &v)
00319 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00320 - this->GetStride(axis), v); }
00321
00322 };
00323
00324 }
00325
00326
00327 #ifndef ITK_MANUAL_INSTANTIATION
00328 #include "itkNeighborhoodIterator.txx"
00329 #endif
00330
00331 #endif
00332