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
00209 template<class TImage, class TBoundaryCondition
00210 = ZeroFluxNeumannBoundaryCondition<TImage> >
00211 class ITK_EXPORT NeighborhoodIterator
00212 : public ConstNeighborhoodIterator<TImage,TBoundaryCondition>
00213 {
00214 public:
00216 typedef NeighborhoodIterator Self;
00217 typedef ConstNeighborhoodIterator<TImage,TBoundaryCondition> Superclass;
00218
00220 typedef typename Superclass::InternalPixelType InternalPixelType;
00221 typedef typename Superclass::PixelType PixelType;
00222 typedef typename Superclass::SizeType SizeType;
00223 typedef typename Superclass::ImageType ImageType;
00224 typedef typename Superclass::RegionType RegionType;
00225 typedef typename Superclass::IndexType IndexType;
00226 typedef typename Superclass::OffsetType OffsetType;
00227 typedef typename OffsetType::OffsetValueType OffsetValueType;
00228 typedef typename Superclass::RadiusType RadiusType;
00229 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00230 typedef typename Superclass::Iterator Iterator;
00231 typedef typename Superclass::ConstIterator ConstIterator;
00232 typedef typename Superclass::ImageBoundaryConditionPointerType
00233 ImageBoundaryConditionPointerType;
00234
00236 NeighborhoodIterator(): Superclass() {}
00237
00239 NeighborhoodIterator( const NeighborhoodIterator &n )
00240 : Superclass(n) {}
00241
00243 Self &operator=(const Self& orig)
00244 {
00245 Superclass::operator=(orig);
00246 return *this;
00247 }
00248
00251 NeighborhoodIterator(const SizeType &radius, ImageType * ptr,
00252 const RegionType ®ion)
00253 : Superclass(radius, ptr, region) { }
00254
00256 virtual void PrintSelf(std::ostream &, Indent) const;
00257
00259 InternalPixelType *GetCenterPointer()
00260 { return (this->operator[]((this->Size())>>1)); }
00261
00263 virtual void SetCenterPixel(const PixelType &p)
00264 { this->m_NeighborhoodAccessorFunctor.Set(this->operator[]((this->Size())>>1), p); }
00265
00269 virtual void SetNeighborhood(const NeighborhoodType &);
00270
00273 virtual void SetPixel(const unsigned i, const PixelType &v,
00274 bool &status);
00275
00277 virtual void SetPixel(const unsigned i, const PixelType &v);
00278
00279
00281 virtual void SetPixel(const OffsetType o, const PixelType &v)
00282 { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00283
00284
00288 virtual void SetNext(const unsigned axis, const unsigned i,
00289 const PixelType &v)
00290 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00291 + (i * this->GetStride(axis)), v); }
00292
00293
00297 virtual void SetNext(const unsigned axis, const PixelType &v)
00298 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00299 + this->GetStride(axis), v); }
00300
00304 virtual void SetPrevious(const unsigned axis, const unsigned i,
00305 const PixelType &v)
00306 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00307 - (i * this->GetStride(axis)), v); }
00308
00309
00313 virtual void SetPrevious(const unsigned axis,
00314 const PixelType &v)
00315 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00316 - this->GetStride(axis), v); }
00317
00318 };
00319
00320 }
00321
00322
00323 #ifndef ITK_MANUAL_INSTANTIATION
00324 #include "itkNeighborhoodIterator.txx"
00325 #endif
00326
00327 #endif