ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkPathConstIterator.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 itkPathConstIterator_h
19 #define itkPathConstIterator_h
20 
21 #include "itkImage.h"
22 #include "itkPath.h"
23 
24 namespace itk
25 {
74 template< typename TImage, typename TPath >
75 class ITK_TEMPLATE_EXPORT PathConstIterator
76 {
77 public:
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 
98  using RegionType = typename TImage::RegionType;
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;
113  using PixelContainerPointer = typename PixelContainer::Pointer;
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  itkTypeMacroNoParent(PathConstIterator);
136 
138  static unsigned int GetImageIteratorDimension()
139  {
140  return TImage::ImageDimension;
141  }
142 
145  {
146  return m_CurrentPathPosition;
147  }
148 
151  {
152  return m_CurrentImageIndex;
153  }
154 
156  const PixelType & Get() const
157  {
158  return m_Image->GetPixel(m_CurrentImageIndex);
159  }
160 
164  bool IsAtEnd() const
165  {
166  return m_IsAtEnd;
167  }
168 
173  inline virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
174  {
175  m_VisitStartIndexAsLastIndexIfClosed = flag;
176  }
177 
183  void GoToBegin();
184 
186  void operator++();
187 
190  Self & operator=(const Self & it);
191 
193  PathConstIterator(const ImageType *imagePtr, const PathType *pathPtr);
194 
196  virtual ~PathConstIterator() = default;
197 
198 protected: //made protected so other iterators can access
199  // This "constant" is initialized in the constructor
200  OffsetType m_ZeroOffset; // = 0 for all dimensions
201 
203  typename ImageType::ConstWeakPointer m_Image;
204 
206  typename PathType::ConstPointer m_Path;
207 
210 
213 
216 
219 
225 
227  bool m_IsAtEnd;
228 
231 
234 };
235 } // end namespace itk
236 
237 #ifndef ITK_MANUAL_INSTANTIATION
238 #include "itkPathConstIterator.hxx"
239 #endif
240 
241 #endif
typename PathType::InputType PathInputType
typename TImage::OffsetType OffsetType
typename TImage::InternalPixelType InternalPixelType
typename TImage::SizeType SizeType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
PathType::ConstPointer m_Path
ImageType::ConstWeakPointer m_Image
virtual void VisitStartIndexAsLastIndexIfClosed(bool flag)
const SizeValueType * m_ImageSize
typename TImage::IndexType IndexType
typename TImage::AccessorType AccessorType
typename TImage::RegionType RegionType
typename PixelContainer::Pointer PixelContainerPointer
static unsigned int GetImageIteratorDimension()
typename TImage::PointType PointType
typename PathType::OutputType PathOutputType
typename TImage::PixelType PixelType
PathConstIterator iterates (traces) over a path through an image.
typename TImage::PixelContainer PixelContainer
typename TImage::SpacingType SpacingType
const PathInputType GetPathPosition()
const PixelType & Get() const