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: 2003/09/10 14:29:18 $
00007   Version:   $Revision: 1.46 $
00008 
00009   Copyright (c) Insight Software 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 
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 &region)
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   //  { *(this->operator[](i)) = v; }
00255   
00257   virtual void SetPixel(const OffsetType o, const PixelType &v)
00258   { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00259     //  { *(this->operator[](o)) = v; }
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 } // namespace itk
00297 
00298 
00299 #ifndef ITK_MANUAL_INSTANTIATION
00300 #include "itkNeighborhoodIterator.txx"
00301 #endif
00302 
00303 #endif

Generated at Sun Jan 25 13:19:41 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000