ITK  5.3.0
Insight Toolkit
itkLineIterator.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 itkLineIterator_h
19 #define itkLineIterator_h
20 
21 #include "itkLineConstIterator.h"
22 
23 namespace itk
24 {
55 template <typename TImage>
56 class ITK_TEMPLATE_EXPORT LineIterator : public LineConstIterator<TImage>
57 {
58 public:
59 
61  using Self = LineIterator;
62 
67  static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension;
68 
71 
73  using typename Superclass::IndexType;
74  using typename Superclass::OffsetType;
75  using typename Superclass::SizeType;
76  using typename Superclass::RegionType;
77  using typename Superclass::ImageType;
78  using typename Superclass::PixelContainer;
79  using typename Superclass::PixelContainerPointer;
80  using typename Superclass::InternalPixelType;
81  using typename Superclass::PixelType;
82  using typename Superclass::AccessorType;
83 
85  itkTypeMacro(LineIterator, LineConstIterator);
86 
88  void
89  Set(const PixelType & value)
90  {
91  // Normally, this would just be the following:
92  // m_Image->SetPixel(m_CurrentImageIndex,value);
93  // However, we don't want a warning about m_Image being a ConstPointer
94  // in the Superclass.
95  const_cast<ImageType *>(this->m_Image.GetPointer())->SetPixel(this->m_CurrentImageIndex, value);
96  }
98 
102  const PixelType &
104  {
105  return (this->m_Image->GetPixel(this->m_CurrentImageIndex));
106  }
107 
110  Self &
111  operator=(const Self & it);
112 
114  LineIterator(ImageType * imagePtr, const IndexType & firstIndex, const IndexType & lastIndex);
115 
117  ~LineIterator() override = default;
118 };
119 } // end namespace itk
120 
121 #ifndef ITK_MANUAL_INSTANTIATION
122 # include "itkLineIterator.hxx"
123 #endif
124 
125 #endif
itk::LineIterator::Value
const PixelType & Value()
Definition: itkLineIterator.h:103
itk::LineIterator::Set
void Set(const PixelType &value)
Definition: itkLineIterator.h:89
itk::LineConstIterator::PixelContainerPointer
typename PixelContainer::Pointer PixelContainerPointer
Definition: itkLineConstIterator.h:94
itk::LineConstIterator::PixelType
typename TImage::PixelType PixelType
Definition: itkLineConstIterator.h:100
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkLineConstIterator.h
itk::LineConstIterator
An iterator that walks a Bresenham line through an ND image with read-only access to pixels.
Definition: itkLineConstIterator.h:56
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LineConstIterator::PixelContainer
typename TImage::PixelContainer PixelContainer
Definition: itkLineConstIterator.h:93
itk::LineConstIterator::OffsetType
typename TImage::OffsetType OffsetType
Definition: itkLineConstIterator.h:73
itk::LineConstIterator::AccessorType
typename TImage::AccessorType AccessorType
Definition: itkLineConstIterator.h:104
itk::LineConstIterator::InternalPixelType
typename TImage::InternalPixelType InternalPixelType
Definition: itkLineConstIterator.h:97
itk::LineConstIterator::ImageType
TImage ImageType
Definition: itkLineConstIterator.h:88
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LineIterator
An iterator that walks a Bresenham line through an ND image with write access to pixels.
Definition: itkLineIterator.h:56