ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::ImageScanlineIterator< TImage > Class Template Reference

#include <itkImageScanlineIterator.h>

Detailed Description

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

A multi-dimensional iterator templated over image type that walks a region of pixels, scanline by scanline or in the direction of the fastest axis.

The itk::ImageScanlineIterator is optimized for iteration speed and is the first choice for pixel-wise operations on an image. This iterator is preferred over the older ImageRegionConstIterator even when knowledge of the current line state is not desired because of its speed.

The following is sample usage:

while ( !it.IsAtEnd() )
{
while ( !it.IsAtEndOfLine() )
{
*it += 100.0;
++it;
}
it.NextLine();
}

Iterating beyond the end of a line results it undefined behavior.

See also
ImageRegionConstIterator
ImageConstIterator

Definition at line 63 of file itkImageScanlineIterator.h.

+ Inheritance diagram for itk::ImageScanlineIterator< TImage >:
+ Collaboration diagram for itk::ImageScanlineIterator< TImage >:

Public Types

using AccessorType
 
using ImageType
 
using IndexType
 
using InternalPixelType
 
using OffsetType
 
using PixelContainer
 
using PixelContainerPointer
 
using PixelType
 
using RegionType
 
using Self = ImageScanlineIterator
 
using SizeType
 
using Superclass = ImageIterator<TImage>
 
- Public Types inherited from itk::ImageIterator< TImage >
using AccessorFunctorType = typename TImage::AccessorFunctorType
 
using AccessorType = typename TImage::AccessorType
 
using ImageType = detail::IteratorImageType_t<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 RegionType = typename TImage::RegionType
 
using Self = ImageIterator
 
using SizeType = typename TImage::SizeType
 

Public Member Functions

virtual const char * GetNameOfClass () const
 
void GoToBegin ()
 
void GoToBeginOfLine ()
 
void GoToEnd ()
 
void GoToEndOfLine ()
 
 ImageScanlineIterator ()=default
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageScanlineIterator (const ImageIterator< TOtherImage > &it)
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageScanlineIterator (const ImageScanlineIterator< TOtherImage > &it)
 
 ImageScanlineIterator (TImage *ptr, const RegionType &region)
 
bool IsAtEndOfLine () const
 
void NextLine ()
 
Self & operator++ ()
 
Self & operator-- ()
 
void SetIndex (const IndexType &ind) override
 
- Public Member Functions inherited from itk::ImageIterator< TImage >
IndexType ComputeIndex () const
 
PixelType Get () const
 
TImage * GetImage () const
 
const RegionType & GetRegion () const
 
void GoToBegin ()
 
void GoToEnd ()
 
 ImageIterator ()
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageIterator (const ImageIterator< TOtherImage > &it)
 
 ImageIterator (const Self &)=default
 
 ImageIterator (TImage *ptr, const RegionType &region)
 
bool IsAtBegin () const
 
bool IsAtEnd () const
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator!= (const ImageIterator< TOtherImage > &it) const
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator< (const ImageIterator< TOtherImage > &it) const
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator<= (const ImageIterator< TOtherImage > &it) const
 
Self & operator= (const Self &)=default
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator== (const ImageIterator< TOtherImage > &it) const
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator> (const ImageIterator< TOtherImage > &it) const
 
template<typename TOtherImage, std::enable_if_t< std::is_same_v< std::remove_const_t< TOtherImage >, std::remove_const_t< TImage > >, int > = 0>
bool operator>= (const ImageIterator< TOtherImage > &it) const
 
template<typename T = TImage, std::enable_if_t< std::is_same_v< T, TImage > &&!std::is_const_v< T >, int > = 0>
void Set (const PixelType &value) const
 
virtual void SetRegion (const RegionType &region)
 
template<typename T = TImage, std::enable_if_t< std::is_same_v< T, TImage > &&!std::is_const_v< T >, int > = 0>
PixelType & Value ()
 
const PixelType & Value () const
 
virtual ~ImageIterator ()=default
 

Static Public Attributes

static constexpr unsigned int ImageIteratorDimension = Superclass::ImageIteratorDimension
 
- Static Public Attributes inherited from itk::ImageIterator< TImage >
static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension
 

Protected Attributes

OffsetValueType m_SpanBeginOffset {}
 
OffsetValueType m_SpanEndOffset {}
 
- Protected Attributes inherited from itk::ImageIterator< TImage >
OffsetValueType m_BeginOffset {}
 
std::conditional_t< std::is_const_v< TImage >, const InternalPixelType, InternalPixelType > * m_Buffer {}
 
OffsetValueType m_EndOffset {}
 
WeakPointer< TImage > m_Image {}
 
OffsetValueType m_Offset {}
 
AccessorType m_PixelAccessor {}
 
AccessorFunctorType m_PixelAccessorFunctor {}
 
RegionType m_Region {}
 

Friends

template<typename>
class ImageScanlineIterator
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::ImageIterator< TImage >
static unsigned int GetImageIteratorDimension ()
 

Member Typedef Documentation

◆ AccessorType

template<typename TImage>
using itk::ImageIterator< TImage >::AccessorType

Accessor type that convert data between internal and external representations.

Definition at line 154 of file itkImageIterator.h.

◆ ImageType

template<typename TImage>
using itk::ImageIterator< TImage >::ImageType

Image type alias support

Definition at line 139 of file itkImageIterator.h.

◆ IndexType

template<typename TImage>
using itk::ImageIterator< TImage >::IndexType

Index type alias support

Definition at line 127 of file itkImageIterator.h.

◆ InternalPixelType

template<typename TImage>
using itk::ImageIterator< TImage >::InternalPixelType

Internal Pixel Type

Definition at line 147 of file itkImageIterator.h.

◆ OffsetType

template<typename TImage>
using itk::ImageIterator< TImage >::OffsetType

Offset type alias support

Definition at line 133 of file itkImageIterator.h.

◆ PixelContainer

template<typename TImage>
using itk::ImageIterator< TImage >::PixelContainer

PixelContainer type alias support. Used to refer to the container for the pixel data.

Definition at line 143 of file itkImageIterator.h.

◆ PixelContainerPointer

template<typename TImage>
using itk::ImageIterator< TImage >::PixelContainerPointer

Definition at line 144 of file itkImageIterator.h.

◆ PixelType

template<typename TImage>
using itk::ImageIterator< TImage >::PixelType

External Pixel Type

Definition at line 150 of file itkImageIterator.h.

◆ RegionType

template<typename TImage>
using itk::ImageIterator< TImage >::RegionType

Region type alias support

Definition at line 136 of file itkImageIterator.h.

◆ Self

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

Standard class type alias.

Definition at line 70 of file itkImageScanlineIterator.h.

◆ SizeType

template<typename TImage>
using itk::ImageIterator< TImage >::SizeType

Size type alias support

Definition at line 130 of file itkImageIterator.h.

◆ Superclass

template<typename TImage>
using itk::ImageScanlineIterator< TImage >::Superclass = ImageIterator<TImage>

Definition at line 71 of file itkImageScanlineIterator.h.

Constructor & Destructor Documentation

◆ ImageScanlineIterator() [1/4]

template<typename TImage>
itk::ImageScanlineIterator< TImage >::ImageScanlineIterator ( )
default

Default constructor.

◆ ImageScanlineIterator() [2/4]

template<typename TImage>
itk::ImageScanlineIterator< TImage >::ImageScanlineIterator ( TImage * ptr,
const RegionType & region )
inline

Constructor establishes an iterator to walk a particular image and a particular region of that image. Initializes the iterator at the begin of the region.

Definition at line 99 of file itkImageScanlineIterator.h.

◆ ImageScanlineIterator() [3/4]

template<typename TImage>
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
itk::ImageScanlineIterator< TImage >::ImageScanlineIterator ( const ImageIterator< TOtherImage > & it)
inline

Constructor that can be used to cast from an ImageIterator to an ImageScanlineIterator. Many routines return an ImageIterator, but for a particular task, you may want an ImageScanlineIterator. Rather than provide overloaded APIs that return different types of Iterators, itk returns ImageIterators and uses constructors to cast from an ImageIterator to a ImageScanlineIterator.

Definition at line 112 of file itkImageScanlineIterator.h.

◆ ImageScanlineIterator() [4/4]

template<typename TImage>
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
itk::ImageScanlineIterator< TImage >::ImageScanlineIterator ( const ImageScanlineIterator< TOtherImage > & it)
inline

Conversion from a writable iterator to a read-only iterator.

Definition at line 123 of file itkImageScanlineIterator.h.

Member Function Documentation

◆ GetNameOfClass()

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

◆ GoToBegin()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::GoToBegin ( )
inline

Move an iterator to the beginning of the region. "Begin" is defined as the first pixel in the region.

Definition at line 132 of file itkImageScanlineIterator.h.

◆ GoToBeginOfLine()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::GoToBeginOfLine ( )
inline

Go to the beginning pixel of the current line.

See also
operator++
operator--
NextLine
IsAtEndOfLine

Definition at line 164 of file itkImageScanlineIterator.h.

◆ GoToEnd()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::GoToEnd ( )
inline

Move an iterator to the end of the region.

"End" is defined as one pixel past the last pixel of the region.

Definition at line 147 of file itkImageScanlineIterator.h.

◆ GoToEndOfLine()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::GoToEndOfLine ( )
inline

Go to the past end pixel of the current line.

See also
GoToBeginOfLine
operator++
operator--
NextLine
IsAtEndOfLine

Definition at line 178 of file itkImageScanlineIterator.h.

◆ IsAtEndOfLine()

template<typename TImage>
bool itk::ImageScanlineIterator< TImage >::IsAtEndOfLine ( ) const
inlinenodiscard

Test if the index is at the end of line

Definition at line 186 of file itkImageScanlineIterator.h.

◆ NextLine()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::NextLine ( )

Go to the next line.

The iterator always moves to the beginning of the next line. If the iterator is on the last scanline then no action is performed.

See also
operator++
IsAtEndOfLine

◆ operator++()

template<typename TImage>
Self & itk::ImageScanlineIterator< TImage >::operator++ ( )
inline

Increment (prefix) along the scanline the iterator's index.

If the iterator is at the end of the scanline ( one past the last valid element in the row ), then the results are undefined. Which means is may assert in debug mode or result in an undefined iterator which may have unknown consequences if used.

Definition at line 225 of file itkImageScanlineIterator.h.

◆ operator--()

template<typename TImage>
Self & itk::ImageScanlineIterator< TImage >::operator-- ( )
inline

decrement (prefix) along the scanline the iterator's index.

Definition at line 236 of file itkImageScanlineIterator.h.

◆ SetIndex()

template<typename TImage>
void itk::ImageScanlineIterator< TImage >::SetIndex ( const IndexType & ind)
inlineoverridevirtual

Set the index without bounds checking.

This is overridden from the parent because we have an extra ivar.

See also
GetIndex

Reimplemented from itk::ImageIterator< TImage >.

Definition at line 198 of file itkImageScanlineIterator.h.

Friends And Related Symbol Documentation

◆ ImageScanlineIterator

template<typename TImage>
template<typename>
friend class ImageScanlineIterator
friend

Definition at line 66 of file itkImageScanlineIterator.h.

Member Data Documentation

◆ ImageIteratorDimension

template<typename TImage>
unsigned int itk::ImageScanlineIterator< TImage >::ImageIteratorDimension = Superclass::ImageIteratorDimension
staticconstexpr

Dimension of the image that the iterator walks. This constant is needed so 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 77 of file itkImageScanlineIterator.h.

◆ m_SpanBeginOffset

template<typename TImage>
OffsetValueType itk::ImageScanlineIterator< TImage >::m_SpanBeginOffset {}
protected

Definition at line 244 of file itkImageScanlineIterator.h.

◆ m_SpanEndOffset

template<typename TImage>
OffsetValueType itk::ImageScanlineIterator< TImage >::m_SpanEndOffset {}
protected

Definition at line 245 of file itkImageScanlineIterator.h.


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