ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageRegionIterator.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkImageRegionIterator_h
00019 #define __itkImageRegionIterator_h
00020 
00021 #include "itkImageRegionConstIterator.h"
00022 
00023 namespace itk
00024 {
00077 template< typename TImage >
00078 class ITK_EXPORT ImageRegionIterator:public ImageRegionConstIterator< TImage >
00079 {
00080 public:
00082   typedef ImageRegionIterator                Self;
00083   typedef ImageRegionConstIterator< TImage > Superclass;
00084 
00086   typedef typename Superclass::IndexType             IndexType;
00087   typedef typename Superclass::SizeType              SizeType;
00088   typedef typename Superclass::OffsetType            OffsetType;
00089   typedef typename Superclass::RegionType            RegionType;
00090   typedef typename Superclass::ImageType             ImageType;
00091   typedef typename Superclass::PixelContainer        PixelContainer;
00092   typedef typename Superclass::PixelContainerPointer PixelContainerPointer;
00093   typedef typename Superclass::InternalPixelType     InternalPixelType;
00094   typedef typename Superclass::PixelType             PixelType;
00095   typedef typename Superclass::AccessorType          AccessorType;
00096 
00098   ImageRegionIterator();
00099 
00102   ImageRegionIterator(ImageType *ptr, const RegionType & region);
00103 
00110   ImageRegionIterator(const ImageIterator< TImage > & it);
00111 
00113   void Set(const PixelType & value) const
00114   {
00115     this->m_PixelAccessorFunctor.Set(*( const_cast< InternalPixelType * >(
00116                                           this->m_Buffer + this->m_Offset ) ), value);
00117   }
00118 
00122   PixelType & Value(void)
00123   { return *( const_cast< InternalPixelType * >( this->m_Buffer + this->m_Offset ) ); }
00124 
00128   Self Begin(void) const;
00129 
00133   Self End(void) const;
00134 
00135 protected:
00138   ImageRegionIterator(const ImageRegionConstIterator< TImage > & it);
00139   Self & operator=(const ImageRegionConstIterator< TImage > & it);
00140 };
00141 } // end namespace itk
00143 
00144 // Define instantiation macro for this template.
00145 #define ITK_TEMPLATE_ImageRegionIterator(_, EXPORT, TypeX, TypeY)                   \
00146   namespace itk                                                                     \
00147   {                                                                                 \
00148   _( 1 ( class EXPORT ImageRegionIterator< ITK_TEMPLATE_1 TypeX > ) )               \
00149   namespace Templates                                                               \
00150   {                                                                                 \
00151   typedef ImageRegionIterator< ITK_TEMPLATE_1 TypeX > ImageRegionIterator##TypeY; \
00152   }                                                                                 \
00153   }
00154 
00155 #if ITK_TEMPLATE_EXPLICIT
00156 #include "Templates/itkImageRegionIterator+-.h"
00157 #endif
00158 
00159 #if ITK_TEMPLATE_TXX
00160 #include "itkImageRegionIterator.hxx"
00161 #endif
00162 
00163 #endif
00164