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

itkShapedNeighborhoodIterator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkShapedNeighborhoodIterator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/01/09 21:28:00 $
00007   Version:   $Revision: 1.2 $
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 __itkShapedNeighborhoodIterator_h
00018 #define __itkShapedNeighborhoodIterator_h
00019 
00020 #include <vector>
00021 #include <list>
00022 #include "itkConstShapedNeighborhoodIterator.h"
00023 
00024 namespace itk {
00025 
00115 template<class TImage,  class TBoundaryCondition
00116                        = ZeroFluxNeumannBoundaryCondition<TImage> >
00117 class ITK_EXPORT ShapedNeighborhoodIterator
00118   :  public ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition>
00119 {
00120 public:
00122   typedef typename TImage::InternalPixelType InternalPixelType;
00123   typedef typename TImage::PixelType PixelType;
00124     
00126   itkStaticConstMacro(Dimension, unsigned int, TImage::ImageDimension);
00127   
00129   typedef ShapedNeighborhoodIterator Self;
00130   typedef ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition> Superclass;
00131 
00133   typedef typename Superclass::OffsetType OffsetType;
00134   typedef typename OffsetType::OffsetValueType OffsetValueType;
00135   typedef typename Superclass::RadiusType RadiusType;  
00136   typedef typename Superclass::SizeType SizeType;
00137   typedef typename Superclass::SizeValueType SizeValueType;
00138   typedef typename Superclass::ConstIterator ConstIterator;
00139   typedef typename Superclass::IndexListType  IndexListType;
00140   typedef typename Superclass::BoundaryConditionType BoundaryConditionType;
00141   typedef typename Superclass::ImageBoundaryConditionPointerType
00142   ImageBoundaryConditionPointerType;
00143   
00145   typedef TImage ImageType;
00146   typedef typename TImage::RegionType RegionType;
00147   typedef Index<itkGetStaticConstMacro(Dimension)> IndexType;
00148   typedef typename IndexType::IndexValueType IndexValueType;
00149   typedef Neighborhood<PixelType, itkGetStaticConstMacro(Dimension)> NeighborhoodType;
00150 
00152   struct Iterator : public ConstIterator
00153   {
00154     Iterator() {}
00155     Iterator(Self *s) : ConstIterator(s) {}
00156 
00157     ~Iterator() {}
00158     const Iterator &operator=(const Iterator &o)
00159     {
00160       ConstIterator::operator=(o);
00161       return *this;
00162     }
00163     
00164     // Promote to public
00165     void Set(const PixelType &v) const
00166     { ConstIterator::ProtectedSet(v); }
00167 
00168   };
00169   
00171   ShapedNeighborhoodIterator();
00172 
00174   virtual ~ShapedNeighborhoodIterator() {}
00175 
00177   ShapedNeighborhoodIterator( const ShapedNeighborhoodIterator & );
00178 
00181   ShapedNeighborhoodIterator(const SizeType &radius,
00182                        const ImageType * ptr,
00183                        const RegionType &region
00184                                   ) : Superclass (radius, const_cast<ImageType*>(ptr),
00185                                                   region)
00186   {
00187     m_BeginIterator = Iterator(this);
00188     m_EndIterator = Iterator(this);
00189     m_EndIterator.GoToEnd();
00190   }
00191   
00192   // Expose the following methods from the superclass.  This is a restricted
00193   // subset of the methods available for ConstNeighborhoodIterator.
00194   Superclass::SetPixel;
00195   
00197   Self &operator=(const Self& orig)
00198   { return Superclass::operator=(orig); }
00199 
00201   virtual void PrintSelf(std::ostream &, Indent) const;
00202 
00205   Iterator &Begin() {    return m_BeginIterator;  }
00206   Iterator &End() {   return m_EndIterator; }
00207 
00210   const ConstIterator &End() const
00211   {    return m_ConstEndIterator;  }
00212 
00213   void ClearActiveList()
00214   {
00215     Superclass::ClearActiveList();
00216     m_EndIterator.GoToEnd();
00217     m_BeginIterator.GoToBegin();
00218   }
00219   
00220 protected:
00221   void ActivateIndex(const unsigned int n)
00222   {
00223     Superclass::ActivateIndex(n);
00224     m_EndIterator.GoToEnd();
00225     m_BeginIterator.GoToBegin();
00226   }
00227 
00228   void DeactivateIndex(const unsigned int n)
00229   {
00230     Superclass::DeactivateIndex(n);
00231     m_EndIterator.GoToEnd();
00232     m_BeginIterator.GoToBegin();
00233   }
00234 
00235   
00236   Iterator m_EndIterator;
00237   Iterator m_BeginIterator;
00238 };
00239 
00240 } // namespace itk
00241 
00242 
00243 #ifndef ITK_MANUAL_INSTANTIATION
00244 #include "itkShapedNeighborhoodIterator.txx"
00245 #endif
00246 
00247 #endif
00248 

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