ITK  5.3.0
Insight Toolkit
itkPathIterator.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  * 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 itkPathIterator_h
19 #define itkPathIterator_h
20 
21 #include "itkPathConstIterator.h"
22 
23 namespace itk
24 {
67 template <typename TImage, typename TPath>
68 class ITK_TEMPLATE_EXPORT PathIterator : public PathConstIterator<TImage, TPath>
69 {
70 public:
71 
73  using Self = PathIterator;
74 
79  static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension;
80 
83 
85  using typename Superclass::IndexType;
86  using typename Superclass::OffsetType;
87  using typename Superclass::SizeType;
88  using typename Superclass::ImageType;
89  using typename Superclass::PixelContainer;
90  using typename Superclass::PixelContainerPointer;
91  using typename Superclass::InternalPixelType;
92  using typename Superclass::PixelType;
93  using typename Superclass::AccessorType;
94  using typename Superclass::PathType;
95  using typename Superclass::PathInputType;
96  using typename Superclass::PathOutputType;
97 
99  itkTypeMacro(PathIterator, PathConstIterator);
100 
102  void
103  Set(const PixelType & value)
104  {
105  // Normally, this would just be the following:
106  // m_Image->SetPixel(m_CurrentImageIndex,value);
107  // However, we don't want a warning about m_Image being a ConstPointer
108  // in the Superclass.
109  const_cast<ImageType *>(this->m_Image.GetPointer())->SetPixel(this->m_CurrentImageIndex, value);
110  }
112 
116  PixelType &
118  {
119  return this->GetImage()->GetPixel(this->m_ImageIndex);
120  }
121 
124  Self &
125  operator=(const Self & it);
126 
128  PathIterator(ImageType * imagePtr, const PathType * pathPtr);
129 
131  ~PathIterator() override = default;
132 };
133 } // end namespace itk
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 # include "itkPathIterator.hxx"
137 #endif
138 
139 #endif
itk::PathIterator
PathIterator iterates (traces) over a path through an image.
Definition: itkPathIterator.h:68
itk::PathIterator::Set
void Set(const PixelType &value)
Definition: itkPathIterator.h:103
itk::PathConstIterator::PixelContainer
typename TImage::PixelContainer PixelContainer
Definition: itkPathConstIterator.h:112
itk::PathConstIterator::ImageType
TImage ImageType
Definition: itkPathConstIterator.h:107
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::PathIterator::Value
PixelType & Value()
Definition: itkPathIterator.h:117
itk::PathConstIterator::PathInputType
typename PathType::InputType PathInputType
Definition: itkPathConstIterator.h:129
itk::PathConstIterator::PixelContainerPointer
typename PixelContainer::Pointer PixelContainerPointer
Definition: itkPathConstIterator.h:113
itkPathConstIterator.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::PathConstIterator::PathType
TPath PathType
Definition: itkPathConstIterator.h:126
itk::PathConstIterator
PathConstIterator iterates (traces) over a path through an image.
Definition: itkPathConstIterator.h:75
itk::PathConstIterator::PixelType
typename TImage::PixelType PixelType
Definition: itkPathConstIterator.h:119
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::PathConstIterator::InternalPixelType
typename TImage::InternalPixelType InternalPixelType
Definition: itkPathConstIterator.h:116
itk::PathConstIterator::AccessorType
typename TImage::AccessorType AccessorType
Definition: itkPathConstIterator.h:123
itk::PathConstIterator::OffsetType
typename TImage::OffsetType OffsetType
Definition: itkPathConstIterator.h:92
itk::PathConstIterator::PathOutputType
typename PathType::OutputType PathOutputType
Definition: itkPathConstIterator.h:132