ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkRLEImageRegionIterator.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
23#include "itkRLEImageIterator.h"
25
26namespace itk
27{
48
49template <typename TPixel, unsigned int VImageDimension, typename CounterType>
50class ImageRegionIterator<RLEImage<TPixel, VImageDimension, CounterType>>
51 : public ImageRegionConstIterator<RLEImage<TPixel, VImageDimension, CounterType>>
52{
53public:
57
59 using IndexType = typename Superclass::IndexType;
60 using SizeType = typename Superclass::SizeType;
61 using OffsetType = typename Superclass::OffsetType;
62 using RegionType = typename Superclass::RegionType;
63 using ImageType = typename Superclass::ImageType;
64 using InternalPixelType = typename Superclass::InternalPixelType;
65 using PixelType = typename Superclass::PixelType;
66
71
76 {}
77
85
88 void
89 Set(const PixelType & value) const
90 {
91 const_cast<ImageType *>(this->m_Image.GetPointer())
92 ->SetPixel(*const_cast<typename ImageType::RLLine *>(this->m_RunLengthLine),
93 this->m_SegmentRemainder,
94 this->m_RealIndex,
95 value);
96 }
97
98protected:
102
103 Self &
108};
109
110template <typename TPixel, unsigned int VImageDimension, typename CounterType>
111class ImageRegionIteratorWithIndex<RLEImage<TPixel, VImageDimension, CounterType>>
112 : public ImageRegionConstIteratorWithIndex<RLEImage<TPixel, VImageDimension, CounterType>>
113{
114public:
116
118
123
129
132 void
133 Set(const TPixel & value) const
134 {
135 const_cast<ImageType *>(this->m_Image.GetPointer())
136 ->SetPixel(*const_cast<typename ImageType::RLLine *>(this->m_RunLengthLine),
137 this->m_SegmentRemainder,
138 this->m_RealIndex,
139 value);
140 }
141
152
163}; // no additional implementation required
164
165// CTAD deduction guide. See the matching guide in
166// itkRLEImageRegionConstIterator.h for rationale.
167template <typename TPixel, unsigned int VImageDimension, typename CounterType>
171
172} // end namespace itk
173
174#endif // itkRLEImageRegionIterator_h
Read-only ImageIterator: ImageConstIterator<TImage> behaves as ImageIterator<const TImage>.
Self & operator=(const Self &)=default
WeakPointer< RLEImage< TPixel, VImageDimension, CounterType > > m_Image
A multi-dimensional image iterator templated over image type.
WeakPointer< RLEImage< TPixel, VImageDimension, CounterType > > m_Image
typename itk::ImageConstIterator< RLEImage< TPixel, VImageDimension, CounterType > >::RegionType RegionType
ImageRegionConstIterator< RLEImage< TPixel, VImageDimension, CounterType > > Superclass
A multi-dimensional iterator templated over image type that walks a region of pixels.
Run-Length Encoded image. It saves memory for label images at the expense of processing times....
Definition itkRLEImage.h:53
typename Superclass::RegionType RegionType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ImageRegionIterator(SmartPointer< TImage >, const typename TImage::RegionType &) -> ImageRegionIterator< TImage >