ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLineIterator.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 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 IndexType = typename Superclass::IndexType;
75  using SizeType = typename Superclass::SizeType;
77  using ImageType = typename Superclass::ImageType;
81  using PixelType = typename Superclass::PixelType;
83 
85  itkTypeMacro(LineIterator, LineConstIterator);
86 
88  void Set(const PixelType & value)
89  {
90  // Normally, this would just be the following:
91  // m_Image->SetPixel(m_CurrentImageIndex,value);
92  // However, we don't want a warning about m_Image being a ConstPointer
93  // in the Superclass.
94  const_cast< ImageType * >( this->m_Image.GetPointer() )->
95  SetPixel(this->m_CurrentImageIndex, value);
96  }
98 
102  const PixelType & Value()
103  {
104  return ( this->m_Image->GetPixel(this->m_CurrentImageIndex) );
105  }
106 
109  Self & operator=(const Self & it);
110 
112  LineIterator(ImageType *imagePtr, const IndexType & firstIndex,
113  const IndexType & lastIndex);
114 
116  ~LineIterator() override = default;
117 };
118 } // end namespace itk
119 
120 #ifndef ITK_MANUAL_INSTANTIATION
121 #include "itkLineIterator.hxx"
122 #endif
123 
124 #endif
typename PixelContainer::Pointer PixelContainerPointer
typename TImage::PixelType PixelType
An iterator that walks a Bresenham line through an ND image with read-only access to pixels...
An iterator that walks a Bresenham line through an ND image with write access to pixels.
typename TImage::PixelContainer PixelContainer
typename TImage::OffsetType OffsetType
const PixelType & Value()
typename TImage::IndexType IndexType
typename TImage::RegionType RegionType
typename TImage::InternalPixelType InternalPixelType
void Set(const PixelType &value)
typename TImage::SizeType SizeType
typename TImage::AccessorType AccessorType