ITK  5.4.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
itk::LineConstIterator< TImage > Class Template Reference

#include <itkLineConstIterator.h>

Detailed Description

template<typename TImage>
class itk::LineConstIterator< TImage >

An iterator that walks a Bresenham line through an ND image with read-only access to pixels.

LineConstIterator is an iterator that walks a Bresenham line through an image. The iterator is constructed similar to other image iterators, except instead of specifying a region to traverse, you specify two indices. The interval specified by the two indices is closed. So, a line iterator specified with the same start and end index will visit exactly one pixel.

LineConstIterator<ImageType> it(image, I1, I2);
while (!it.IsAtEnd())
{
// visits at least 1 pixel
}
Author
Benjamin King, Experimentelle Radiologie, Medizinische Hochschule Hannover.
ITK Sphinx Examples:
Examples
SphinxExamples/src/Core/Common/IterateLineThroughImageWithoutWriteAccess/Code.cxx.

Definition at line 56 of file itkLineConstIterator.h.

+ Inheritance diagram for itk::LineConstIterator< TImage >:

Public Types

using AccessorType = typename TImage::AccessorType
 
using ImageType = TImage
 
using IndexType = typename TImage::IndexType
 
using InternalPixelType = typename TImage::InternalPixelType
 
using OffsetType = typename TImage::OffsetType
 
using PixelContainer = typename TImage::PixelContainer
 
using PixelContainerPointer = typename PixelContainer::Pointer
 
using PixelType = typename TImage::PixelType
 
using PointType = typename TImage::PointType
 
using RegionType = typename TImage::RegionType
 
using Self = LineConstIterator
 
using SizeType = typename TImage::SizeType
 
using SpacingType = typename TImage::SpacingType
 

Public Member Functions

const PixelType Get () const
 
const IndexType GetIndex ()
 
virtual const char * GetNameOfClass () const
 
void GoToBegin ()
 
bool IsAtEnd () const
 
 LineConstIterator (const ImageType *imagePtr, const IndexType &firstIndex, const IndexType &lastIndex)
 
void operator++ ()
 
Selfoperator= (const Self &it)
 
virtual ~LineConstIterator ()=default
 

Static Public Member Functions

static unsigned int GetImageIteratorDimension ()
 

Static Public Attributes

static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension
 

Protected Attributes

IndexType m_AccumulateError {}
 
IndexType m_CurrentImageIndex {}
 
IndexType m_EndIndex {}
 
ImageType::ConstWeakPointer m_Image {}
 
IndexType m_IncrementError {}
 
bool m_IsAtEnd {}
 
IndexType m_LastIndex {}
 
unsigned int m_MainDirection {}
 
IndexType m_MaximalError {}
 
IndexType m_OverflowIncrement {}
 
IndexType m_ReduceErrorAfterIncrement {}
 
RegionType m_Region {}
 
IndexType m_StartIndex {}
 

Member Typedef Documentation

◆ AccessorType

template<typename TImage>
using itk::LineConstIterator< TImage >::AccessorType = typename TImage::AccessorType

Accessor type that convert data between internal and external representations.

Definition at line 104 of file itkLineConstIterator.h.

◆ ImageType

template<typename TImage>
using itk::LineConstIterator< TImage >::ImageType = TImage

Image type alias support

Definition at line 88 of file itkLineConstIterator.h.

◆ IndexType

template<typename TImage>
using itk::LineConstIterator< TImage >::IndexType = typename TImage::IndexType

Index type alias support

Definition at line 70 of file itkLineConstIterator.h.

◆ InternalPixelType

template<typename TImage>
using itk::LineConstIterator< TImage >::InternalPixelType = typename TImage::InternalPixelType

Internal Pixel Type

Definition at line 97 of file itkLineConstIterator.h.

◆ OffsetType

template<typename TImage>
using itk::LineConstIterator< TImage >::OffsetType = typename TImage::OffsetType

Offset type alias support

Definition at line 73 of file itkLineConstIterator.h.

◆ PixelContainer

template<typename TImage>
using itk::LineConstIterator< TImage >::PixelContainer = typename TImage::PixelContainer

PixelContainer type alias support Used to refer to the container for the pixel data. While this was already typedef'ed in the superclass, it needs to be redone here for this subclass to compile properly with gcc.

Definition at line 93 of file itkLineConstIterator.h.

◆ PixelContainerPointer

template<typename TImage>
using itk::LineConstIterator< TImage >::PixelContainerPointer = typename PixelContainer::Pointer

Definition at line 94 of file itkLineConstIterator.h.

◆ PixelType

template<typename TImage>
using itk::LineConstIterator< TImage >::PixelType = typename TImage::PixelType

External Pixel Type

Definition at line 100 of file itkLineConstIterator.h.

◆ PointType

template<typename TImage>
using itk::LineConstIterator< TImage >::PointType = typename TImage::PointType

Origin type alias support

Definition at line 85 of file itkLineConstIterator.h.

◆ RegionType

template<typename TImage>
using itk::LineConstIterator< TImage >::RegionType = typename TImage::RegionType

Region type alias support

Definition at line 79 of file itkLineConstIterator.h.

◆ Self

template<typename TImage>
using itk::LineConstIterator< TImage >::Self = LineConstIterator

Standard class type aliases.

Definition at line 61 of file itkLineConstIterator.h.

◆ SizeType

template<typename TImage>
using itk::LineConstIterator< TImage >::SizeType = typename TImage::SizeType

Size type alias support

Definition at line 76 of file itkLineConstIterator.h.

◆ SpacingType

template<typename TImage>
using itk::LineConstIterator< TImage >::SpacingType = typename TImage::SpacingType

Spacing type alias support

Definition at line 82 of file itkLineConstIterator.h.

Constructor & Destructor Documentation

◆ LineConstIterator()

template<typename TImage>
itk::LineConstIterator< TImage >::LineConstIterator ( const ImageType imagePtr,
const IndexType firstIndex,
const IndexType lastIndex 
)

Constructor establishes an iterator to walk along a line

◆ ~LineConstIterator()

template<typename TImage>
virtual itk::LineConstIterator< TImage >::~LineConstIterator ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ Get()

template<typename TImage>
const PixelType itk::LineConstIterator< TImage >::Get ( ) const
inline

Get the pixel value

Definition at line 125 of file itkLineConstIterator.h.

◆ GetImageIteratorDimension()

template<typename TImage>
static unsigned int itk::LineConstIterator< TImage >::GetImageIteratorDimension ( )
inlinestatic

Get the dimension (size) of the index.

Definition at line 111 of file itkLineConstIterator.h.

◆ GetIndex()

template<typename TImage>
const IndexType itk::LineConstIterator< TImage >::GetIndex ( )
inline

Get the index. This provides a read only reference to the index.

Definition at line 118 of file itkLineConstIterator.h.

◆ GetNameOfClass()

template<typename TImage>
virtual const char* itk::LineConstIterator< TImage >::GetNameOfClass ( ) const
virtual

◆ GoToBegin()

template<typename TImage>
void itk::LineConstIterator< TImage >::GoToBegin ( )

Move an iterator to the beginning of the line.

◆ IsAtEnd()

template<typename TImage>
bool itk::LineConstIterator< TImage >::IsAtEnd ( ) const
inline

Is the iterator at the end of the line?

Definition at line 132 of file itkLineConstIterator.h.

◆ operator++()

template<typename TImage>
void itk::LineConstIterator< TImage >::operator++ ( )

Walk forward along the line to the next index in the image.

◆ operator=()

template<typename TImage>
Self& itk::LineConstIterator< TImage >::operator= ( const Self it)

operator= is provided to make sure the handle to the image is properly reference counted.

Member Data Documentation

◆ ImageIteratorDimension

template<typename TImage>
constexpr unsigned int itk::LineConstIterator< TImage >::ImageIteratorDimension = TImage::ImageDimension
staticconstexpr

Dimension of the image that the iterator walks. This constant is needed so that functions that are templated over image iterator type (as opposed to being templated over pixel type and dimension) can have compile time access to the dimension of the image that the iterator walks.

Definition at line 67 of file itkLineConstIterator.h.

◆ m_AccumulateError

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_AccumulateError {}
protected

Definition at line 177 of file itkLineConstIterator.h.

◆ m_CurrentImageIndex

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_CurrentImageIndex {}
protected

Start, end and current ND index position in the image of the line

Definition at line 167 of file itkLineConstIterator.h.

◆ m_EndIndex

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_EndIndex {}
protected

Definition at line 170 of file itkLineConstIterator.h.

◆ m_Image

template<typename TImage>
ImageType::ConstWeakPointer itk::LineConstIterator< TImage >::m_Image {}
protected

Smart pointer to the source image.

Definition at line 158 of file itkLineConstIterator.h.

◆ m_IncrementError

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_IncrementError {}
protected

Definition at line 181 of file itkLineConstIterator.h.

◆ m_IsAtEnd

template<typename TImage>
bool itk::LineConstIterator< TImage >::m_IsAtEnd {}
protected

Is the iterator at the end of its walk?

Definition at line 164 of file itkLineConstIterator.h.

◆ m_LastIndex

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_LastIndex {}
protected

Definition at line 169 of file itkLineConstIterator.h.

◆ m_MainDirection

template<typename TImage>
unsigned int itk::LineConstIterator< TImage >::m_MainDirection {}
protected

Variables that drive the Bresenham-Algorithm

Definition at line 174 of file itkLineConstIterator.h.

◆ m_MaximalError

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_MaximalError {}
protected

Definition at line 185 of file itkLineConstIterator.h.

◆ m_OverflowIncrement

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_OverflowIncrement {}
protected

Definition at line 188 of file itkLineConstIterator.h.

◆ m_ReduceErrorAfterIncrement

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_ReduceErrorAfterIncrement {}
protected

Definition at line 192 of file itkLineConstIterator.h.

◆ m_Region

template<typename TImage>
RegionType itk::LineConstIterator< TImage >::m_Region {}
protected

Region type to iterate over.

Definition at line 161 of file itkLineConstIterator.h.

◆ m_StartIndex

template<typename TImage>
IndexType itk::LineConstIterator< TImage >::m_StartIndex {}
protected

Definition at line 168 of file itkLineConstIterator.h.


The documentation for this class was generated from the following file: