Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNeighborhoodIterator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNeighborhoodIterator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/12/17 17:50:35 $
00007   Version:   $Revision: 1.44 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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 &region)
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   //  { *(this->operator[](i)) = v; }
00260   
00262   virtual void SetPixel(const OffsetType o, const PixelType &v)
00263   { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00264     //  { *(this->operator[](o)) = v; }
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 } // namespace itk
00302 
00303 
00304 #ifndef ITK_MANUAL_INSTANTIATION
00305 #include "itkNeighborhoodIterator.txx"
00306 #endif
00307 
00308 #endif

Generated at Fri May 21 01:15:08 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000