ITK  6.0.0
Insight Toolkit
itkPathConstIterator.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 itkPathConstIterator_h
19#define itkPathConstIterator_h
20
21#include "itkImage.h"
22#include "itkPath.h"
23
24namespace itk
25{
74template <typename TImage, typename TPath>
75class ITK_TEMPLATE_EXPORT PathConstIterator
76{
77public:
78
81
86 static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension;
87
89 using IndexType = typename TImage::IndexType;
90
92 using OffsetType = typename TImage::OffsetType;
93
95 using SizeType = typename TImage::SizeType;
96
99
101 using SpacingType = typename TImage::SpacingType;
102
104 using PointType = typename TImage::PointType;
105
107 using ImageType = TImage;
108
112 using PixelContainer = typename TImage::PixelContainer;
114
116 using InternalPixelType = typename TImage::InternalPixelType;
117
119 using PixelType = typename TImage::PixelType;
120
123 using AccessorType = typename TImage::AccessorType;
124
126 using PathType = TPath;
127
129 using PathInputType = typename PathType::InputType;
130
132 using PathOutputType = typename PathType::OutputType;
133
135 itkVirtualGetNameOfClassMacro(PathConstIterator);
136
138 static unsigned int
140 {
141 return TImage::ImageDimension;
142 }
143
145 const PathInputType
147 {
148 return m_CurrentPathPosition;
149 }
150
152 const IndexType
154 {
155 return m_CurrentImageIndex;
156 }
157
159 const PixelType &
160 Get() const
161 {
162 return m_Image->GetPixel(m_CurrentImageIndex);
163 }
164
168 bool
169 IsAtEnd() const
170 {
171 return m_IsAtEnd;
172 }
173
178 inline virtual void
180 {
181 m_VisitStartIndexAsLastIndexIfClosed = flag;
182 }
183
189 void
191
193 void
195
198 Self &
199 operator=(const Self & it);
200
202 PathConstIterator(const ImageType * imagePtr, const PathType * pathPtr);
203
205 virtual ~PathConstIterator() = default;
206
207protected: // made protected so other iterators can access
208 // This "constant" is initialized in the constructor
209 OffsetType m_ZeroOffset{}; // = 0 for all dimensions
210
212 typename ImageType::ConstWeakPointer m_Image{};
213
215 typename PathType::ConstPointer m_Path{};
216
218 RegionType m_Region{};
219
221 PointType m_ImageOrigin{};
222
224 SpacingType m_ImageSpacing{};
225
227 const SizeValueType * m_ImageSize{};
228
233 bool m_VisitStartIndexAsLastIndexIfClosed{};
234
236 bool m_IsAtEnd{};
237
239 PathInputType m_CurrentPathPosition{};
240
242 IndexType m_CurrentImageIndex{};
243};
244} // end namespace itk
245
246#ifndef ITK_MANUAL_INSTANTIATION
247# include "itkPathConstIterator.hxx"
248#endif
249
250#endif
PathConstIterator iterates (traces) over a path through an image.
const PixelType & Get() const
typename TImage::PixelContainer PixelContainer
typename TImage::SizeType SizeType
typename TImage::InternalPixelType InternalPixelType
typename TImage::PointType PointType
Self & operator=(const Self &it)
typename PixelContainer::Pointer PixelContainerPointer
typename PathType::InputType PathInputType
const PathInputType GetPathPosition()
typename TImage::PixelType PixelType
static unsigned int GetImageIteratorDimension()
typename TImage::IndexType IndexType
typename PathType::OutputType PathOutputType
typename TImage::OffsetType OffsetType
typename TImage::RegionType RegionType
virtual ~PathConstIterator()=default
typename TImage::AccessorType AccessorType
typename TImage::SpacingType SpacingType
PathConstIterator(const ImageType *imagePtr, const PathType *pathPtr)
virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86