ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkRLEImageRegionIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef itkRLEImageRegionIterator_h
19 #define itkRLEImageRegionIterator_h
20 
21 #include "itkImageRegionIterator.h"
23 #include "itkRLEImageIterator.h"
25 
26 namespace itk
27 {
49 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
50 class ImageRegionIterator< RLEImage< TPixel, VImageDimension, CounterType > > :
51  public ImageRegionConstIterator< RLEImage< TPixel, VImageDimension, CounterType > >
52 {
53 public:
57 
59  typedef typename Superclass::IndexType IndexType;
60  typedef typename Superclass::SizeType SizeType;
63  typedef typename Superclass::ImageType ImageType;
65  typedef typename Superclass::PixelType PixelType;
66 
70  {}
71 
74  ImageRegionIterator( ImageType* ptr, const RegionType& region )
75  : ImageRegionConstIterator< ImageType >( ptr, region )
76  {}
77 
85  {
87  }
88 
91  void
92  Set( const PixelType& value ) const
93  {
94  const_cast< ImageType * >( this->m_Image.GetPointer() )->SetPixel(
95  *const_cast< typename ImageType::RLLine * >( this->m_RunLengthLine ),
96  this->m_SegmentRemainder, this->m_RealIndex, value );
97  }
98 
99 protected:
103  {
105  }
106 
107  Self &
109  {
111  }
112 };
113 
114 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
115 class ImageRegionIteratorWithIndex< RLEImage< TPixel, VImageDimension, CounterType > > :
116  public ImageRegionConstIteratorWithIndex< RLEImage< TPixel, VImageDimension, CounterType > >
117 {
118 public:
120 
122 
126  {}
127 
131  : ImageRegionConstIteratorWithIndex< ImageType >( ptr, region )
132  {}
133 
136  void
137  Set( const TPixel& value ) const
138  {
139  const_cast< ImageType * >( this->m_Image.GetPointer() )->SetPixel(
140  *const_cast< typename ImageType::RLLine * >( this->m_RunLengthLine ),
141  this->m_SegmentRemainder, this->m_RealIndex, value );
142  }
143 
151  {
153  }
154 
162  {
164  }
165 }; // no additional implementation required
166 } // end namespace itk
168 
169 #endif // itkRLEImageRegionIterator_h
ImageRegionConstIterator< RLEImage< TPixel, VImageDimension, CounterType > > Superclass
A multi-dimensional iterator templated over image type.
An image region represents a structured region of data.
A multi-dimensional iterator templated over image type that walks an image region and is specialized ...
A multi-dimensional image iterator templated over image type.
Self & operator=(const Self &it)
itk::ImageConstIterator< RLEImage< TPixel, VImageDimension, CounterType > >::RegionType RegionType
A multi-dimensional iterator templated over image type that walks a region of pixels.
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
TImage::ConstWeakPointer m_Image
Run-Length Encoded image. It saves memory for label images at the expense of processing times...
Definition: itkRLEImage.h:52
Self & operator=(const Self &it)
A multi-dimensional iterator templated over image type that walks a region of pixels.