ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::ConstSliceIterator< TPixel, TContainer > Class Template Reference

#include <itkConstSliceIterator.h>

Detailed Description

template<typename TPixel, typename TContainer>
class itk::ConstSliceIterator< TPixel, TContainer >

A flexible iterator for ITK containers(i.e. itk::Neighborhood) that support pixel access through operator[].

ConstSliceIterator allows const iteration along a std::slice through the container. A slice is a construct that defines a starting position, stride length (distance between adjacent elements), and a length.

Any container with operator[] const is supported. Because it uses this interface the iterator is only as efficient as the implementation of a container's operator[] method.

References: Modeled after a slice iterator proposed by Bjarne Stroustrup in [111].

Definition at line 50 of file itkConstSliceIterator.h.

Public Member Functions

ConstSliceIterator Begin ()
 
 ConstSliceIterator (const TContainer *n, std::slice s)
 
ConstSliceIterator End ()
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (ConstSliceIterator)
 
const TPixel & operator* ()
 
ConstSliceIterator operator++ ()
 
ConstSliceIterator operator++ (int)
 
bool operator< (const ConstSliceIterator &orig) const
 
bool operator== (const ConstSliceIterator &orig) const
 
const TPixel & operator[] (SizeValueType n)
 

Private Member Functions

const TPixel & Loc (SizeValueType n) const
 

Private Attributes

const TContainer * m_ContainerPointer
 
SizeValueType m_Pos { 0 }
 
std::slice m_Slice
 

Constructor & Destructor Documentation

◆ ConstSliceIterator()

template<typename TPixel, typename TContainer>
itk::ConstSliceIterator< TPixel, TContainer >::ConstSliceIterator ( const TContainer * n,
std::slice s )
inline

Constructor.

Definition at line 55 of file itkConstSliceIterator.h.

References m_ContainerPointer, and m_Slice.

Referenced by Begin(), End(), ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(), operator++(), operator<(), and operator==().

Member Function Documentation

◆ Begin()

template<typename TPixel, typename TContainer>
ConstSliceIterator itk::ConstSliceIterator< TPixel, TContainer >::Begin ( )
inline

Returns a ConstSliceIterator that points to the beginning of the slice.

Definition at line 62 of file itkConstSliceIterator.h.

References ConstSliceIterator(), and m_Pos.

◆ End()

template<typename TPixel, typename TContainer>
ConstSliceIterator itk::ConstSliceIterator< TPixel, TContainer >::End ( )
inline

Returns a ConstSliceIterator that points to one past the end of the slice.

Definition at line 73 of file itkConstSliceIterator.h.

References ConstSliceIterator(), m_Pos, and m_Slice.

◆ ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION()

template<typename TPixel, typename TContainer>
itk::ConstSliceIterator< TPixel, TContainer >::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION ( ConstSliceIterator< TPixel, TContainer > )

References ConstSliceIterator().

◆ Loc()

template<typename TPixel, typename TContainer>
const TPixel & itk::ConstSliceIterator< TPixel, TContainer >::Loc ( SizeValueType n) const
inlineprivate

Returns the value located at position n of the slice.

Definition at line 139 of file itkConstSliceIterator.h.

References m_ContainerPointer, and m_Slice.

Referenced by operator*(), and operator[]().

◆ operator*()

template<typename TPixel, typename TContainer>
const TPixel & itk::ConstSliceIterator< TPixel, TContainer >::operator* ( )
inline

Dereferences the iterator, returning the value that it points to.

Definition at line 110 of file itkConstSliceIterator.h.

References Loc(), and m_Pos.

◆ operator++() [1/2]

template<typename TPixel, typename TContainer>
ConstSliceIterator itk::ConstSliceIterator< TPixel, TContainer >::operator++ ( )
inline

Increments the iterator.

Definition at line 83 of file itkConstSliceIterator.h.

References m_Pos.

◆ operator++() [2/2]

template<typename TPixel, typename TContainer>
ConstSliceIterator itk::ConstSliceIterator< TPixel, TContainer >::operator++ ( int )
inline

Increments the iterator.

Definition at line 91 of file itkConstSliceIterator.h.

References ConstSliceIterator(), and m_Pos.

◆ operator<()

template<typename TPixel, typename TContainer>
bool itk::ConstSliceIterator< TPixel, TContainer >::operator< ( const ConstSliceIterator< TPixel, TContainer > & orig) const
inline

Returns the boolean < of two slice iterator positions. Result is only true if the slice iterators have the same stride and start location.

Definition at line 129 of file itkConstSliceIterator.h.

References ConstSliceIterator(), m_Pos, and m_Slice.

◆ operator==()

template<typename TPixel, typename TContainer>
bool itk::ConstSliceIterator< TPixel, TContainer >::operator== ( const ConstSliceIterator< TPixel, TContainer > & orig) const
inline

Returns the logical && of the boolean == of two slice iterator positions, stride, and start locations.

Definition at line 118 of file itkConstSliceIterator.h.

References ConstSliceIterator(), m_Pos, and m_Slice.

◆ operator[]()

template<typename TPixel, typename TContainer>
const TPixel & itk::ConstSliceIterator< TPixel, TContainer >::operator[] ( SizeValueType n)
inline

Returns the element at position n of the slice. Sets the iterator to point to position n.

Definition at line 102 of file itkConstSliceIterator.h.

References Loc(), and m_Pos.

Member Data Documentation

◆ m_ContainerPointer

template<typename TPixel, typename TContainer>
const TContainer* itk::ConstSliceIterator< TPixel, TContainer >::m_ContainerPointer
private

Pointer to the container referenced by the slice iterator.

Definition at line 145 of file itkConstSliceIterator.h.

Referenced by ConstSliceIterator(), and Loc().

◆ m_Pos

template<typename TPixel, typename TContainer>
SizeValueType itk::ConstSliceIterator< TPixel, TContainer >::m_Pos { 0 }
private

Current position within the slice.

Definition at line 148 of file itkConstSliceIterator.h.

Referenced by Begin(), End(), operator*(), operator++(), operator++(), operator<(), operator==(), and operator[]().

◆ m_Slice

template<typename TPixel, typename TContainer>
std::slice itk::ConstSliceIterator< TPixel, TContainer >::m_Slice
private

Slice structure information.

Definition at line 151 of file itkConstSliceIterator.h.

Referenced by ConstSliceIterator(), End(), Loc(), operator<(), and operator==().


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