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
00185 template<class TImage, class TBoundaryCondition
00186 = ZeroFluxNeumannBoundaryCondition<TImage> >
00187 class ITK_EXPORT NeighborhoodIterator
00188 : public ConstNeighborhoodIterator<TImage>
00189 {
00190 public:
00192 typedef NeighborhoodIterator Self;
00193 typedef ConstNeighborhoodIterator<TImage> Superclass;
00194
00196 typedef typename Superclass::InternalPixelType InternalPixelType;
00197 typedef typename Superclass::PixelType PixelType;
00198 typedef typename Superclass::SizeType SizeType;
00199 typedef typename Superclass::ImageType ImageType;
00200 typedef typename Superclass::RegionType RegionType;
00201 typedef typename Superclass::IndexType IndexType;
00202 typedef typename Superclass::OffsetType OffsetType;
00203 typedef typename OffsetType::OffsetValueType OffsetValueType;
00204 typedef typename Superclass::RadiusType RadiusType;
00205 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00206 typedef typename Superclass::Iterator Iterator;
00207 typedef typename Superclass::ConstIterator ConstIterator;
00208 typedef typename Superclass::ImageBoundaryConditionPointerType
00209 ImageBoundaryConditionPointerType;
00210
00212 NeighborhoodIterator(): Superclass() {}
00213
00215 NeighborhoodIterator( const NeighborhoodIterator &n )
00216 : Superclass(n) {}
00217
00219 Self &operator=(const Self& orig)
00220 {
00221 Superclass::operator=(orig);
00222 return *this;
00223 }
00224
00227 NeighborhoodIterator(const SizeType &radius, ImageType * ptr,
00228 const RegionType ®ion)
00229 : Superclass(radius, ptr, region) { }
00230
00232 virtual void PrintSelf(std::ostream &, Indent) const;
00233
00235 InternalPixelType *GetCenterPointer()
00236 { return (this->operator[]((this->Size())>>1)); }
00237
00239 virtual void SetCenterPixel(const PixelType &p)
00240 { *( this->GetCenterPointer() ) = p; }
00241
00245 virtual void SetNeighborhood(const NeighborhoodType &);
00246
00249 virtual void SetPixel(const unsigned i, const PixelType &v,
00250 bool &status);
00251
00253 virtual void SetPixel(const unsigned i, const PixelType &v);
00254
00255
00257 virtual void SetPixel(const OffsetType o, const PixelType &v)
00258 { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00259
00260
00264 virtual void SetNext(const unsigned axis, const unsigned i,
00265 const PixelType &v)
00266 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00267 + (i * this->GetStride(axis)), v); }
00268
00269
00273 virtual void SetNext(const unsigned axis, const PixelType &v)
00274 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00275 + this->GetStride(axis), v); }
00276
00280 virtual void SetPrevious(const unsigned axis, const unsigned i,
00281 const PixelType &v)
00282 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00283 - (i * this->GetStride(axis)), v); }
00284
00285
00289 virtual void SetPrevious(const unsigned axis,
00290 const PixelType &v)
00291 { this->SetPixel(this->GetCenterNeighborhoodIndex()
00292 - this->GetStride(axis), v); }
00293
00294 };
00295
00296 }
00297
00298
00299 #ifndef ITK_MANUAL_INSTANTIATION
00300 #include "itkNeighborhoodIterator.txx"
00301 #endif
00302
00303 #endif