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: 2009-02-06 20:53:13 $
00007   Version:   $Revision: 1.50 $
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 
00097 
00210 template<class TImage, class TBoundaryCondition
00211                        = ZeroFluxNeumannBoundaryCondition<TImage> >
00212 class ITK_EXPORT NeighborhoodIterator
00213   :  public ConstNeighborhoodIterator<TImage,TBoundaryCondition>
00214 {
00215 public:
00217   typedef NeighborhoodIterator                                 Self;
00218   typedef ConstNeighborhoodIterator<TImage,TBoundaryCondition> Superclass;
00219 
00221   typedef typename Superclass::InternalPixelType InternalPixelType;
00222   typedef typename Superclass::PixelType         PixelType;
00223   typedef typename Superclass::SizeType          SizeType;
00224   typedef typename Superclass::ImageType         ImageType;
00225   typedef typename Superclass::RegionType        RegionType;
00226   typedef typename Superclass::IndexType         IndexType;
00227   typedef typename Superclass::OffsetType        OffsetType;
00228   typedef typename OffsetType::OffsetValueType   OffsetValueType;
00229   typedef typename Superclass::RadiusType        RadiusType;
00230   typedef typename Superclass::NeighborhoodType  NeighborhoodType;
00231   typedef typename Superclass::Iterator          Iterator;
00232   typedef typename Superclass::ConstIterator     ConstIterator;
00233   typedef typename Superclass::ImageBoundaryConditionPointerType
00234                                                  ImageBoundaryConditionPointerType;
00235 
00237   NeighborhoodIterator(): Superclass() {}
00238 
00240   NeighborhoodIterator( const NeighborhoodIterator &n ) : Superclass(n) {}
00241 
00243   Self &operator=(const Self& orig)
00244     {
00245       Superclass::operator=(orig);
00246       return *this;
00247     }
00249 
00252   NeighborhoodIterator(const SizeType &radius, ImageType * ptr,
00253                        const RegionType &region)
00254     : Superclass(radius, ptr, region) { }
00255 
00257   virtual void PrintSelf(std::ostream &, Indent) const;
00258 
00260   InternalPixelType *GetCenterPointer()
00261     { return (this->operator[]((this->Size())>>1)); }
00262 
00264   virtual void SetCenterPixel(const PixelType &p)
00265   { this->m_NeighborhoodAccessorFunctor.Set(this->operator[]((this->Size())>>1), p); }
00266 
00270   virtual void SetNeighborhood(const NeighborhoodType &);
00271 
00274   virtual void SetPixel(const unsigned i, const PixelType &v,
00275                         bool  &status);
00276 
00278   virtual void SetPixel(const unsigned i, const PixelType &v);
00279   //  { *(this->operator[](i)) = v; }
00281 
00283   virtual void SetPixel(const OffsetType o, const PixelType &v)
00284   { this->SetPixel(this->GetNeighborhoodIndex(o), v); }
00285     //  { *(this->operator[](o)) = v; }
00287 
00291   virtual void SetNext(const unsigned axis, const unsigned i,
00292                             const PixelType &v)
00293   {   this->SetPixel(this->GetCenterNeighborhoodIndex()
00294                      + (i * this->GetStride(axis)), v); }
00295 
00296   
00300   virtual void SetNext(const unsigned axis, const PixelType &v)
00301     {   this->SetPixel(this->GetCenterNeighborhoodIndex()
00302                        + this->GetStride(axis), v); }
00303 
00307   virtual void SetPrevious(const unsigned axis, const unsigned i,
00308                                 const PixelType &v)
00309     { this->SetPixel(this->GetCenterNeighborhoodIndex()
00310                      - (i * this->GetStride(axis)), v); }
00311 
00312   
00316   virtual void SetPrevious(const unsigned axis,
00317                                 const PixelType &v)
00318     { this->SetPixel(this->GetCenterNeighborhoodIndex()
00319                      - this->GetStride(axis), v); }
00320 
00321 };
00322 
00323 } // namespace itk
00324 
00325 
00326 #ifndef ITK_MANUAL_INSTANTIATION
00327 #include "itkNeighborhoodIterator.txx"
00328 #endif
00329 
00330 #endif
00331 

Generated at Tue Sep 15 04:10:17 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000