KWStyle - itkImageRegionIterator.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageRegionIterator.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:39 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkImageRegionIterator_h
18 #define __itkImageRegionIterator_h
19
20 #include "itkImageRegionConstIterator.h"
21 #include "itkImageIteratorWithIndex.h"
22
23 namespace itk
24 {
25
26 /** \class ImageRegionIterator
27  * \brief A multi-dimensional iterator templated over image type that walks a
28  * region of pixels.
29  *
30  * The itk::ImageRegionIterator is optimized for iteration speed and is the
31  * first choice for iterative, pixel-wise operations on an image.
32  * ImageRegionIterator is the least specialized of the ITK image iterator
33  * classes.  ImageRegionIterator is templated over the image type, and is
34  * constrained to walk only within the specified region and along a line
35  * parallel to one of the coordinate axes, "wrapping" to the next line as it
36  * reaches the boundary of the image.  To walk the entire image, specify the
37  * region to be \c image->GetRequestedRegion().
38  *
39  * Most of the functionality is inherited from the ImageRegionConstIterator.
40  * The current class only adds write access to image pixels.
41  *
42  * \par MORE INFORMATION
43  * For a complete description of the ITK Image Iterators and their API, please
44  * see the Iterators chapter in the ITK Software Guide.  The ITK Software Guide
45  * is available in print and as a free .pdf download from http://www.itk.org.
46  *
47  * \example Iterators/ImageRegionIterator.cxx
48  * \ingroup ImageIterators
49  *
50  * \sa ImageConstIterator \sa ConditionalConstIterator
51  * \sa ConstNeighborhoodIterator \sa ConstShapedNeighborhoodIterator
52  * \sa ConstSliceIterator  \sa CorrespondenceDataStructureIterator 
53  * \sa FloodFilledFunctionConditionalConstIterator 
54  * \sa FloodFilledImageFunctionConditionalConstIterator 
55  * \sa FloodFilledImageFunctionConditionalIterator 
56  * \sa FloodFilledSpatialFunctionConditionalConstIterator 
57  * \sa FloodFilledSpatialFunctionConditionalIterator 
58  * \sa ImageConstIterator \sa ImageConstIteratorWithIndex 
59  * \sa ImageIterator \sa ImageIteratorWithIndex
60  * \sa ImageLinearConstIteratorWithIndex  \sa ImageLinearIteratorWithIndex 
61  * \sa ImageRandomConstIteratorWithIndex  \sa ImageRandomIteratorWithIndex 
62  * \sa ImageRegionConstIterator \sa ImageRegionConstIteratorWithIndex 
63  * \sa ImageRegionExclusionConstIteratorWithIndex 
64  * \sa ImageRegionExclusionIteratorWithIndex 
65  * \sa ImageRegionIterator  \sa ImageRegionIteratorWithIndex 
66  * \sa ImageRegionReverseConstIterator  \sa ImageRegionReverseIterator 
67  * \sa ImageReverseConstIterator  \sa ImageReverseIterator 
68  * \sa ImageSliceConstIteratorWithIndex  \sa ImageSliceIteratorWithIndex 
69  * \sa NeighborhoodIterator \sa PathConstIterator  \sa PathIterator 
70  * \sa ShapedNeighborhoodIterator  \sa SliceIterator 
71  * \sa ImageConstIteratorWithIndex */
72 template<typename TImage>
73 class ITK_EXPORT ImageRegionIterator : public ImageRegionConstIterator<TImage>
74 {
75 public:
76   /** Standard class typedefs. */
77   typedef ImageRegionIterator Self;
78 TDA   typedef ImageRegionConstIterator<TImage>  Superclass;
79   
80 IND ***/** Types inherited from the Superclass */
81   typedef typename Superclass::IndexType              IndexType;
82   typedef typename Superclass::IndexValueType         IndexValueType;
83   typedef typename Superclass::SizeType               SizeType;
84   typedef typename Superclass::SizeValueType          SizeValueType;
85   typedef typename Superclass::OffsetType             OffsetType;
86   typedef typename Superclass::OffsetValueType        OffsetValueType;
87   typedef typename Superclass::RegionType             RegionType;
88   typedef typename Superclass::ImageType              ImageType;
89   typedef typename Superclass::PixelContainer         PixelContainer;
90   typedef typename Superclass::PixelContainerPointer  PixelContainerPointer;
91   typedef typename Superclass::InternalPixelType      InternalPixelType;
92   typedef typename Superclass::PixelType              PixelType;
93   typedef typename Superclass::AccessorType           AccessorType;
94
95
96   /** Default constructor. Needed since we provide a cast constructor. */
97   ImageRegionIterator();
98   
99   /** Constructor establishes an iterator to walk a particular image and a
100    * particular region of that image. */
101   ImageRegionIterator(ImageType *ptr, const RegionType& region);
102
103   /** Constructor that can be used to cast from an ImageIterator to an
104    * ImageRegionIterator. Many routines return an ImageIterator but for a
105    * particular task, you may want an ImageRegionIterator.  Rather than
106    * provide overloaded APIs that return different types of Iterators, itk
107    * returns ImageIterators and uses constructors to cast from an
108    * ImageIterator to a ImageRegionIterator. */
109   ImageRegionIterator( const ImageIteratorWithIndex<TImage> &it);
110   
111   /** Set the pixel value */
112   void Set( const PixelType & value) const  
113     { 
114     this->m_PixelAccessorFunctor.Set(*(const_cast<InternalPixelType *>(
115             this->m_Buffer+this->m_Offset)),value); 
116     }
117
118   /** Return a reference to the pixel 
119    * This method will provide the fastest access to pixel
120    * data, but it will NOT support ImageAdaptors. */
121   PixelType & Value(void) 
122 LEN     { return *(const_cast<InternalPixelType *>(this->m_Buffer+this->m_Offset)); }
123
124 IND ***/** Return an iterator for the beginning of the region. "Begin"
125    * is defined as the first pixel in the region.
126    * \deprecated Use GoToBegin() instead */
127   Self Begin(void) const;
128
129 IND ***/** Return an iterator for the end of the region. "End" is defined
130    * as one pixel past the last pixel of the region. 
131    * \deprecated Use GoToEnd() instead */
132   Self End(void) const;
133
134
135 protected:
136   /** the construction from a const iterator is declared protected
137 IND ******in order to enforce const correctness. */
138   ImageRegionIterator( const ImageRegionConstIterator<TImage> &it);
139   Self & operator=(const ImageRegionConstIterator<TImage> & it);
140  
141
142 };
143
144 // end namespace itk
145
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "itkImageRegionIterator.txx"
148 #endif
149
150 #endif 
151
152 EOF
153 EOF,EML
154 EOF,EML

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:14PM
© Kitware Inc.