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
00190 template<class TImage, class TBoundaryCondition
00191 = ZeroFluxNeumannBoundaryCondition<TImage> >
00192 class ITK_EXPORT NeighborhoodIterator
00193 : public ConstNeighborhoodIterator<TImage>
00194 {
00195 public:
00197 typedef NeighborhoodIterator Self;
00198 typedef ConstNeighborhoodIterator<TImage> Superclass;
00199
00201 typedef typename Superclass::InternalPixelType InternalPixelType;
00202 typedef typename Superclass::PixelType PixelType;
00203 typedef typename Superclass::SizeType SizeType;
00204 typedef typename Superclass::ImageType ImageType;
00205 typedef typename Superclass::RegionType RegionType;
00206 typedef typename Superclass::IndexType IndexType;
00207 typedef typename Superclass::OffsetType OffsetType;
00208 typedef typename OffsetType::OffsetValueType OffsetValueType;
00209 typedef typename Superclass::RadiusType RadiusType;
00210 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00211 typedef typename Superclass::Iterator Iterator;
00212 typedef typename Superclass::ConstIterator ConstIterator;
00213 typedef typename Superclass::ImageBoundaryConditionPointerType
00214 ImageBoundaryConditionPointerType;
00215
00217 NeighborhoodIterator(): Superclass() {}
00218
00220 NeighborhoodIterator( const NeighborhoodIterator &n )
00221 : Superclass(n) {}
00222
00224 Self &operator=(const Self& orig)
00225 {
00226 Superclass::operator=(orig);
00227 return *this;
00228 }
00229
00232 NeighborhoodIterator(const SizeType &radius, ImageType * ptr,
00233 const RegionType ®ion)
00234 : Superclass(radius, ptr, region) { }
00235
00237 virtual void PrintSelf(std::ostream &, Indent) const;
00238
00240 InternalPixelType *GetCenterPointer()
00241 { return (this->operator[]((this->Size())>>1)); }
00242
00244 virtual void SetCenterPixel(const PixelType &p)
00245 { *( this->GetCenterPointer() ) = p; }
00246
00250 virtual void SetNeighborhood(const NeighborhoodType &);
00251
00254 virtual void SetPixel(const unsigned i, const PixelType &v,
00255 bool &status);
00256
00258 virtual void SetPixel(const unsigned i, const PixelType &v);
00259
00260
00262 virtual void SetPixel(const OffsetType o, const PixelType &v)
00263 { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00264
00265
00269 virtual void SetNext(const unsigned axis, const unsigned i,
00270 const PixelType &v)
00271 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00272 + (i * this->GetStride(axis)), v); }
00273
00274
00278 virtual void SetNext(const unsigned axis, const PixelType &v)
00279 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00280 + this->GetStride(axis), v); }
00281
00285 virtual void SetPrevious(const unsigned axis, const unsigned i,
00286 const PixelType &v)
00287 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00288 - (i * this->GetStride(axis)), v); }
00289
00290
00294 virtual void SetPrevious(const unsigned axis,
00295 const PixelType &v)
00296 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00297 - this->GetStride(axis), v); }
00298
00299 };
00300
00301 }
00302
00303
00304 #ifndef ITK_MANUAL_INSTANTIATION
00305 #include "itkNeighborhoodIterator.txx"
00306 #endif
00307
00308 #endif