KWStyle - itkImageRegionIteratorWithIndex.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageRegionIteratorWithIndex.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 __itkImageRegionIteratorWithIndex_h
18 #define __itkImageRegionIteratorWithIndex_h
19
20 #include "itkImageRegionConstIteratorWithIndex.h"
21 #include "itkImageIteratorWithIndex.h"
22
23 namespace itk
24 {
25
26 /** \class ImageRegionIteratorWithIndex
27  * \brief A multi-dimensional iterator templated over image type that walks
28  * pixels within a region and is specialized to keep track of its image index
29  * location.
30  *
31  * This class is a specialization of ImageRegionConstIteratorWithIndex that
32  * adds write-access (the Set() method).  Please see
33  * ImageRegionConstIteratorWithIndex for more information.
34  *
35  * \par MORE INFORMATION
36  * For a complete description of the ITK Image Iterators and their API, please
37  * see the Iterators chapter in the ITK Software Guide.  The ITK Software Guide
38  * is available in print and as a free .pdf download from http://www.itk.org.
39  *
40  * \ingroup ImageIterators
41  *
42  * \sa ImageConstIterator \sa ConditionalConstIterator
43  * \sa ConstNeighborhoodIterator \sa ConstShapedNeighborhoodIterator
44  * \sa ConstSliceIterator  \sa CorrespondenceDataStructureIterator 
45  * \sa FloodFilledFunctionConditionalConstIterator 
46  * \sa FloodFilledImageFunctionConditionalConstIterator 
47  * \sa FloodFilledImageFunctionConditionalIterator 
48  * \sa FloodFilledSpatialFunctionConditionalConstIterator 
49  * \sa FloodFilledSpatialFunctionConditionalIterator 
50  * \sa ImageConstIterator \sa ImageConstIteratorWithIndex 
51  * \sa ImageIterator \sa ImageIteratorWithIndex
52  * \sa ImageLinearConstIteratorWithIndex  \sa ImageLinearIteratorWithIndex 
53  * \sa ImageRandomConstIteratorWithIndex  \sa ImageRandomIteratorWithIndex 
54  * \sa ImageRegionConstIterator \sa ImageRegionConstIteratorWithIndex 
55  * \sa ImageRegionExclusionConstIteratorWithIndex 
56  * \sa ImageRegionExclusionIteratorWithIndex 
57  * \sa ImageRegionIterator  \sa ImageRegionIteratorWithIndex 
58  * \sa ImageRegionReverseConstIterator  \sa ImageRegionReverseIterator 
59  * \sa ImageReverseConstIterator  \sa ImageReverseIterator 
60  * \sa ImageSliceConstIteratorWithIndex  \sa ImageSliceIteratorWithIndex 
61  * \sa NeighborhoodIterator \sa PathConstIterator  \sa PathIterator 
62  * \sa ShapedNeighborhoodIterator  \sa SliceIterator 
63  * \sa ImageConstIteratorWithIndex */
64 template<typename TImage>
65 LEN class ITK_EXPORT ImageRegionIteratorWithIndex : public ImageRegionConstIteratorWithIndex<TImage>
66 {
67 public:
68   /** Standard class typedefs. */
69   typedef ImageRegionIteratorWithIndex Self;
70 TDA   typedef ImageRegionConstIteratorWithIndex<TImage>  Superclass;
71   
72   /** Types inherited from the Superclass */
73   typedef typename Superclass::IndexType              IndexType;
74   typedef typename Superclass::IndexValueType         IndexValueType;
75   typedef typename Superclass::SizeType               SizeType;
76   typedef typename Superclass::SizeValueType          SizeValueType;
77   typedef typename Superclass::OffsetType             OffsetType;
78   typedef typename Superclass::OffsetValueType        OffsetValueType;
79   typedef typename Superclass::RegionType             RegionType;
80   typedef typename Superclass::ImageType              ImageType;
81   typedef typename Superclass::PixelContainer         PixelContainer;
82   typedef typename Superclass::PixelContainerPointer  PixelContainerPointer;
83   typedef typename Superclass::InternalPixelType      InternalPixelType;
84   typedef typename Superclass::PixelType              PixelType;
85   typedef typename Superclass::AccessorType           AccessorType;
86
87   
88   /** Default constructor. Needed since we provide a cast constructor. */
89   ImageRegionIteratorWithIndex();
90   
91   /** Constructor establishes an iterator to walk a particular image and a
92    * particular region of that image. */
93   ImageRegionIteratorWithIndex(TImage *ptr, const RegionType& region);
94
95   /** Constructor that can be used to cast from an ImageIterator to an
96 LEN    * ImageRegionIteratorWithIndex. Many routines return an ImageIterator but for a
97    * particular task, you may want an ImageRegionIteratorWithIndex.  Rather than
98    * provide overloaded APIs that return different types of Iterators, itk
99    * returns ImageIterators and uses constructors to cast from an
100    * ImageIterator to a ImageRegionIteratorWithIndex. */
101   ImageRegionIteratorWithIndex( const ImageIteratorWithIndex<TImage> &it);
102
103   /** Set the pixel value */
104   void Set( const PixelType & value) const  
105 LEN     { this->m_PixelAccessorFunctor.Set(*(const_cast<InternalPixelType *>(this->m_Position)),value); }
106
107   /** Return a reference to the pixel 
108    * This method will provide the fastest access to pixel
109    * data, but it will NOT support ImageAdaptors. */
110   PixelType & Value(void) 
111     { return *(const_cast<InternalPixelType *>(this->m_Position)); }
112  
113 protected:
114   /** the construction from a const iterator is declared protected
115 IND ******in order to enforce const correctness. */
116 LEN   ImageRegionIteratorWithIndex( const ImageRegionConstIteratorWithIndex<TImage> &it);
117   Self &operator=(const ImageRegionConstIteratorWithIndex<TImage> & it);
118   
119 };
120
121 // end namespace itk
122
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkImageRegionIteratorWithIndex.txx"
125 #endif
126
127 #endif 
128

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