ITK  6.0.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 * https://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
22
23namespace itk
24{
55template <typename TImage>
56class ITK_TEMPLATE_EXPORT LineIterator : public LineConstIterator<TImage>
57{
58public:
59
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;
80 using typename Superclass::InternalPixelType;
81 using typename Superclass::PixelType;
82 using typename Superclass::AccessorType;
83
85 itkOverrideGetNameOfClassMacro(LineIterator);
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 }
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
Pixel-wise addition of two images.
An iterator that walks a Bresenham line through an ND image with read-only access to pixels.
typename TImage::PixelType PixelType
typename TImage::IndexType IndexType
typename PixelContainer::Pointer PixelContainerPointer
typename TImage::InternalPixelType InternalPixelType
typename TImage::OffsetType OffsetType
typename TImage::PixelContainer PixelContainer
typename TImage::AccessorType AccessorType
An iterator that walks a Bresenham line through an ND image with write access to pixels.
LineIterator(ImageType *imagePtr, const IndexType &firstIndex, const IndexType &lastIndex)
~LineIterator() override=default
Self & operator=(const Self &it)
void Set(const PixelType &value)
const PixelType & Value()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....