OTB  10.0.0
Orfeo Toolbox
otbPolyLineImageConstIterator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbPolyLineImageConstIterator_h
22 #define otbPolyLineImageConstIterator_h
23 
24 #include "itkIndex.h"
25 #include "itkImage.h"
26 #include "itkLineIterator.h"
27 
28 namespace otb
29 {
45 template <class TImage, class TPath>
47 {
48 public:
51 
52  itkStaticConstMacro(ImageIteratorDimension, unsigned int, TImage::ImageDimension);
53 
54  typedef typename TImage::IndexType IndexType;
55  typedef typename TImage::IndexValueType IndexValueType;
56  typedef typename TImage::OffsetType OffsetType;
57  typedef typename TImage::OffsetValueType OffsetValueType;
58  typedef typename TImage::SizeType SizeType;
59  typedef typename TImage::SizeValueType SizeValueType;
60  typedef typename TImage::RegionType RegionType;
61  typedef typename TImage::SpacingType SpacingType;
62  typedef typename TImage::PointType PointType;
63  typedef TImage ImageType;
64  typedef TPath PathType;
65  typedef typename PathType::VertexType VertexType;
66  typedef typename PathType::VertexListType VertexListType;
67  typedef typename VertexListType::ConstIterator VertexIteratorType;
68  typedef itk::LineIterator<ImageType> InternalImageIteratorType;
69  typedef typename TImage::PixelContainer PixelContainer;
70  typedef typename PixelContainer::Pointer PixelContainerPointer;
71  typedef typename TImage::InternalPixelType InternalPixelType;
72  typedef typename TImage::PixelType PixelType;
73  typedef typename TImage::AccessorType AccessorType;
74 
76  static unsigned int GetImageIteratorDimension()
77  {
78  return TImage::ImageDimension;
79  }
80 
83  {
84  return m_InternalImageIterator.GetIndex();
85  }
86 
88  const PixelType Get(void) const
89  {
90  return m_InternalImageIterator.Get();
91  }
92 
94  bool IsAtEnd()
95  {
96  return (m_InternalVertexIterator == m_Path->GetVertexList()->End()) && m_InternalImageIterator.IsAtEnd();
97  }
98 
100  void GoToBegin();
101 
103  void operator++();
104 
107  Self& operator=(const Self& it);
108 
110  PolyLineImageConstIterator(const ImageType* imagePtr, const PathType* pathPtr);
111 
114  {
115  }
116 
117 protected: // made protected so other iterators can access
119  typename ImageType::ConstWeakPointer m_Image;
120 
122  typename PathType::ConstPointer m_Path;
125 };
126 
127 } // End namespace otb
128 #ifndef OTB_MANUAL_INSTANTIATION
130 #endif
131 
132 #endif
Uses the bresenham algorithm to iterate over a polyline on an image (const version).
itk::LineIterator< ImageType > InternalImageIteratorType
VertexListType::ConstIterator VertexIteratorType
InternalImageIteratorType m_InternalImageIterator
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.