OTB  9.0.0
Orfeo Toolbox
otbPolyLineImageConstIterator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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
otb::PolyLineImageConstIterator::IsAtEnd
bool IsAtEnd()
Definition: otbPolyLineImageConstIterator.h:94
otb::PolyLineImageConstIterator::AccessorType
TImage::AccessorType AccessorType
Definition: otbPolyLineImageConstIterator.h:73
otb::PolyLineImageConstIterator::VertexType
PathType::VertexType VertexType
Definition: otbPolyLineImageConstIterator.h:65
otb::PolyLineImageConstIterator::OffsetType
TImage::OffsetType OffsetType
Definition: otbPolyLineImageConstIterator.h:56
otb::PolyLineImageConstIterator::Get
const PixelType Get(void) const
Definition: otbPolyLineImageConstIterator.h:88
otb::PolyLineImageConstIterator::m_Image
ImageType::ConstWeakPointer m_Image
Definition: otbPolyLineImageConstIterator.h:119
otb::PolyLineImageConstIterator::SizeValueType
TImage::SizeValueType SizeValueType
Definition: otbPolyLineImageConstIterator.h:59
otb::PolyLineImageConstIterator::VertexListType
PathType::VertexListType VertexListType
Definition: otbPolyLineImageConstIterator.h:66
otb::PolyLineImageConstIterator::ImageType
TImage ImageType
Definition: otbPolyLineImageConstIterator.h:63
otb::PolyLineImageConstIterator::GetIndex
const IndexType GetIndex()
Definition: otbPolyLineImageConstIterator.h:82
otbPolyLineImageConstIterator.hxx
otb::PolyLineImageConstIterator::RegionType
TImage::RegionType RegionType
Definition: otbPolyLineImageConstIterator.h:60
otb::PolyLineImageConstIterator::~PolyLineImageConstIterator
virtual ~PolyLineImageConstIterator()
Definition: otbPolyLineImageConstIterator.h:113
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::PolyLineImageConstIterator::m_InternalVertexIterator
VertexIteratorType m_InternalVertexIterator
Definition: otbPolyLineImageConstIterator.h:124
otb::PolyLineImageConstIterator::InternalImageIteratorType
itk::LineIterator< ImageType > InternalImageIteratorType
Definition: otbPolyLineImageConstIterator.h:68
otb::PolyLineImageConstIterator::PointType
TImage::PointType PointType
Definition: otbPolyLineImageConstIterator.h:62
otb::PolyLineImageConstIterator::PixelContainerPointer
PixelContainer::Pointer PixelContainerPointer
Definition: otbPolyLineImageConstIterator.h:70
otb::PolyLineImageConstIterator::VertexIteratorType
VertexListType::ConstIterator VertexIteratorType
Definition: otbPolyLineImageConstIterator.h:67
otb::PolyLineImageConstIterator::GetImageIteratorDimension
static unsigned int GetImageIteratorDimension()
Definition: otbPolyLineImageConstIterator.h:76
otb::PolyLineImageConstIterator::m_Path
PathType::ConstPointer m_Path
Definition: otbPolyLineImageConstIterator.h:122
otb::PolyLineImageConstIterator::OffsetValueType
TImage::OffsetValueType OffsetValueType
Definition: otbPolyLineImageConstIterator.h:57
otb::PolyLineImageConstIterator::IndexValueType
TImage::IndexValueType IndexValueType
Definition: otbPolyLineImageConstIterator.h:55
otb::PolyLineImageConstIterator
Uses the bresenham algorithm to iterate over a polyline on an image (const version).
Definition: otbPolyLineImageConstIterator.h:46
otb::PolyLineImageConstIterator::PathType
TPath PathType
Definition: otbPolyLineImageConstIterator.h:64
otb::PolyLineImageConstIterator::PixelType
TImage::PixelType PixelType
Definition: otbPolyLineImageConstIterator.h:72
otb::PolyLineImageConstIterator::SizeType
TImage::SizeType SizeType
Definition: otbPolyLineImageConstIterator.h:58
otb::PolyLineImageConstIterator::IndexType
TImage::IndexType IndexType
Definition: otbPolyLineImageConstIterator.h:54
otb::PolyLineImageConstIterator::Self
PolyLineImageConstIterator Self
Definition: otbPolyLineImageConstIterator.h:50
otb::PolyLineImageConstIterator::SpacingType
TImage::SpacingType SpacingType
Definition: otbPolyLineImageConstIterator.h:61
otb::PolyLineImageConstIterator::InternalPixelType
TImage::InternalPixelType InternalPixelType
Definition: otbPolyLineImageConstIterator.h:71
otb::PolyLineImageConstIterator::m_InternalImageIterator
InternalImageIteratorType m_InternalImageIterator
Definition: otbPolyLineImageConstIterator.h:123
otb::PolyLineImageConstIterator::PixelContainer
TImage::PixelContainer PixelContainer
Definition: otbPolyLineImageConstIterator.h:69