ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches

#include <itkPathIterator.h>

Detailed Description

template<typename TImage, typename TPath>
class itk::PathIterator< TImage, TPath >

PathIterator iterates (traces) over a path through an image.

This iterator visits only those indices of the image that are overlapped by a specified 1D path. All indices are visited in path order. If a path crosses itself at an index, that index of the image will be visited twice. An exception to this rule is that if the path is closed, i.e. its starting and ending indices are coincident. When starting and ending indices are coincident, GoToBegin() will go to the second index, since the "first" index will be visited later as the "last" index. This is so that paths (especially parametric paths) can be properly closed, without double-visiting the starting/ending point. This behavior can be overridden by calling VisitStartIndexAsLastIndexIfClosed(false) before calling GoToBegin(). This class is the const version of the PathIterator, and for this reason it doesn't support the Set() method.

MORE INFORMATION
For a complete description of the ITK Image Iterators and their API, please see the Iterators chapter in the ITK Software Guide. The ITK Software Guide is available in print and as a free .pdf download from https://www.itk.org.
See also
ImageConstIterator
ConditionalConstIterator
ConstNeighborhoodIterator
ConstShapedNeighborhoodIterator
ConstSliceIterator
CorrespondenceDataStructureIterator
FloodFilledFunctionConditionalConstIterator
FloodFilledImageFunctionConditionalConstIterator
FloodFilledImageFunctionConditionalIterator
FloodFilledSpatialFunctionConditionalConstIterator
FloodFilledSpatialFunctionConditionalIterator
ImageConstIterator
ImageConstIteratorWithIndex
ImageIterator
ImageIteratorWithIndex
ImageLinearConstIteratorWithIndex
ImageLinearIteratorWithIndex
ImageRandomConstIteratorWithIndex
ImageRandomIteratorWithIndex
ImageRegionConstIterator
ImageRegionConstIteratorWithIndex
ImageRegionExclusionConstIteratorWithIndex
ImageRegionExclusionIteratorWithIndex
ImageRegionIterator
ImageRegionIteratorWithIndex
ImageRegionReverseConstIterator
ImageRegionReverseIterator
ImageReverseConstIterator
ImageReverseIterator
ImageSliceConstIteratorWithIndex
ImageSliceIteratorWithIndex
NeighborhoodIterator
ShapedNeighborhoodIterator
SliceIterator
ImageConstIteratorWithIndex

Definition at line 78 of file itkPathIterator.h.

+ Collaboration diagram for itk::PathIterator< TImage, TPath >:

Public Types

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 PathInputType = typename PathType::InputType
 
using PathOutputType = typename PathType::OutputType
 
using PathType = TPath
 
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 = PathIterator
 
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
 
const PathInputType GetPathPosition ()
 
void GoToBegin ()
 
bool IsAtEnd () const
 
void operator++ ()
 
Self & operator= (const Self &)=default
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 PathIterator (const PathIterator< TOtherImage, TPath > &it)
 
 PathIterator (const Self &)=default
 
 PathIterator (TImage *imagePtr, const PathType *pathPtr)
 
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)
 
template<typename T = TImage, std::enable_if_t< std::is_same_v< T, TImage > &&!std::is_const_v< T >, int > = 0>
PixelType & Value ()
 
virtual void VisitStartIndexAsLastIndexIfClosed (bool flag)
 
virtual ~PathIterator ()=default
 

Static Public Member Functions

static unsigned int GetImageIteratorDimension ()
 

Static Public Attributes

static constexpr unsigned int ImageIteratorDimension = TImage::ImageDimension
 

Protected Attributes

IndexType m_CurrentImageIndex {}
 
PathInputType m_CurrentPathPosition {}
 
WeakPointer< TImage > m_Image {}
 
PointType m_ImageOrigin {}
 
const SizeValueType * m_ImageSize {}
 
SpacingType m_ImageSpacing {}
 
bool m_IsAtEnd {}
 
PathType::ConstPointer m_Path {}
 
RegionType m_Region {}
 
bool m_VisitStartIndexAsLastIndexIfClosed {}
 
OffsetType m_ZeroOffset {}
 

Friends

template<typename, typename>
class PathIterator
 

Member Typedef Documentation

◆ AccessorType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::AccessorType = typename TImage::AccessorType

Accessor type that convert data between internal and external representations.

Definition at line 127 of file itkPathIterator.h.

◆ ImageType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::ImageType = detail::IteratorImageType_t<TImage>

Image type alias support

Definition at line 112 of file itkPathIterator.h.

◆ IndexType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::IndexType = typename TImage::IndexType

Index type alias support

Definition at line 94 of file itkPathIterator.h.

◆ InternalPixelType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::InternalPixelType = typename TImage::InternalPixelType

Internal Pixel Type

Definition at line 120 of file itkPathIterator.h.

◆ OffsetType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::OffsetType = typename TImage::OffsetType

Offset type alias support

Definition at line 97 of file itkPathIterator.h.

◆ PathInputType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PathInputType = typename PathType::InputType

Path 1D Input Type

Definition at line 133 of file itkPathIterator.h.

◆ PathOutputType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PathOutputType = typename PathType::OutputType

Path ND Output Type, which is not necessarily an index type

Definition at line 136 of file itkPathIterator.h.

◆ PathType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PathType = TPath

Path type alias support

Definition at line 130 of file itkPathIterator.h.

◆ PixelContainer

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PixelContainer = typename TImage::PixelContainer

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

Definition at line 116 of file itkPathIterator.h.

◆ PixelContainerPointer

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PixelContainerPointer = typename PixelContainer::Pointer

Definition at line 117 of file itkPathIterator.h.

◆ PixelType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PixelType = typename TImage::PixelType

External Pixel Type

Definition at line 123 of file itkPathIterator.h.

◆ PointType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::PointType = typename TImage::PointType

Origin type alias support

Definition at line 109 of file itkPathIterator.h.

◆ RegionType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::RegionType = typename TImage::RegionType

Region type alias support

Definition at line 103 of file itkPathIterator.h.

◆ Self

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::Self = PathIterator

Standard class type aliases.

Definition at line 85 of file itkPathIterator.h.

◆ SizeType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::SizeType = typename TImage::SizeType

Size type alias support

Definition at line 100 of file itkPathIterator.h.

◆ SpacingType

template<typename TImage, typename TPath>
using itk::PathIterator< TImage, TPath >::SpacingType = typename TImage::SpacingType

Spacing type alias support

Definition at line 106 of file itkPathIterator.h.

Constructor & Destructor Documentation

◆ PathIterator() [1/3]

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

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

Definition at line 220 of file itkPathIterator.h.

◆ PathIterator() [2/3]

template<typename TImage, typename TPath>
itk::PathIterator< TImage, TPath >::PathIterator ( const Self & )
default

◆ PathIterator() [3/3]

template<typename TImage, typename TPath>
itk::PathIterator< TImage, TPath >::PathIterator ( TImage * imagePtr,
const PathType * pathPtr )

Constructor establishes an iterator to walk along a path

◆ ~PathIterator()

template<typename TImage, typename TPath>
virtual itk::PathIterator< TImage, TPath >::~PathIterator ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ Get()

template<typename TImage, typename TPath>
const PixelType & itk::PathIterator< TImage, TPath >::Get ( ) const
inlinenodiscard

Get the pixel value

Definition at line 164 of file itkPathIterator.h.

◆ GetImageIteratorDimension()

template<typename TImage, typename TPath>
static unsigned int itk::PathIterator< TImage, TPath >::GetImageIteratorDimension ( )
inlinestatic

Get the dimension (size) of the index.

Definition at line 143 of file itkPathIterator.h.

◆ GetIndex()

template<typename TImage, typename TPath>
const IndexType itk::PathIterator< TImage, TPath >::GetIndex ( )
inline

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

Definition at line 157 of file itkPathIterator.h.

◆ GetNameOfClass()

template<typename TImage, typename TPath>
virtual const char * itk::PathIterator< TImage, TPath >::GetNameOfClass ( ) const
virtual

◆ GetPathPosition()

template<typename TImage, typename TPath>
const PathInputType itk::PathIterator< TImage, TPath >::GetPathPosition ( )
inline

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

Definition at line 150 of file itkPathIterator.h.

◆ GoToBegin()

template<typename TImage, typename TPath>
void itk::PathIterator< TImage, TPath >::GoToBegin ( )

Move an iterator to the beginning of the path. If the starting and ending indices of the path are coincident, then move to the 2'nd index of the path, since the 1'st index will be visited later as the last index. However, if m_VisitStartIndexAsLastIndexIfClosed is false, then GoToBegin() will always move to the 1'st index.

◆ IsAtEnd()

template<typename TImage, typename TPath>
bool itk::PathIterator< TImage, TPath >::IsAtEnd ( ) const
inlinenodiscard

Is the iterator at the end of the path? Note that for a closed path, it may be possible to increment back to the start of the path.

Definition at line 173 of file itkPathIterator.h.

◆ operator++()

template<typename TImage, typename TPath>
void itk::PathIterator< TImage, TPath >::operator++ ( )

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

◆ operator=()

template<typename TImage, typename TPath>
Self & itk::PathIterator< TImage, TPath >::operator= ( const Self & )
default

◆ Set()

template<typename TImage, typename TPath>
template<typename T = TImage, std::enable_if_t< std::is_same_v< T, TImage > &&!std::is_const_v< T >, int > = 0>
void itk::PathIterator< TImage, TPath >::Set ( const PixelType & value)
inline

Set the pixel value. Available only when TImage is not const.

Definition at line 203 of file itkPathIterator.h.

◆ Value()

template<typename TImage, typename TPath>
template<typename T = TImage, std::enable_if_t< std::is_same_v< T, TImage > &&!std::is_const_v< T >, int > = 0>
PixelType & itk::PathIterator< TImage, TPath >::Value ( )
inline

Return a reference to the pixel. Available only when TImage is not const. This method will provide the fastest access to pixel data, but it will NOT support ImageAdaptors.

Definition at line 213 of file itkPathIterator.h.

◆ VisitStartIndexAsLastIndexIfClosed()

template<typename TImage, typename TPath>
virtual void itk::PathIterator< TImage, TPath >::VisitStartIndexAsLastIndexIfClosed ( bool flag)
inlinevirtual

Should GoToBegin() initially skip the first index of a closed path so that the first index will only be visited once–at the end of the path? If set to false, then GoToBegin() will always move to the 1'st index. The constructor presets m_VisitStartIndexAsLastIndexIfClosed to true.

Definition at line 183 of file itkPathIterator.h.

Friends And Related Symbol Documentation

◆ PathIterator

template<typename TImage, typename TPath>
template<typename, typename>
friend class PathIterator
friend

Definition at line 81 of file itkPathIterator.h.

Member Data Documentation

◆ ImageIteratorDimension

template<typename TImage, typename TPath>
unsigned int itk::PathIterator< TImage, TPath >::ImageIteratorDimension = TImage::ImageDimension
staticconstexpr

Dimension of the image 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 91 of file itkPathIterator.h.

◆ m_CurrentImageIndex

template<typename TImage, typename TPath>
IndexType itk::PathIterator< TImage, TPath >::m_CurrentImageIndex {}
protected

Current ND index position in the image of the path

Definition at line 279 of file itkPathIterator.h.

◆ m_CurrentPathPosition

template<typename TImage, typename TPath>
PathInputType itk::PathIterator< TImage, TPath >::m_CurrentPathPosition {}
protected

Current 1D position along the path, such as time or arc length

Definition at line 276 of file itkPathIterator.h.

◆ m_Image

template<typename TImage, typename TPath>
WeakPointer<TImage> itk::PathIterator< TImage, TPath >::m_Image {}
protected

Weak pointer to the source image.

Definition at line 249 of file itkPathIterator.h.

◆ m_ImageOrigin

template<typename TImage, typename TPath>
PointType itk::PathIterator< TImage, TPath >::m_ImageOrigin {}
protected

The origin of the source image

Definition at line 258 of file itkPathIterator.h.

◆ m_ImageSize

template<typename TImage, typename TPath>
const SizeValueType* itk::PathIterator< TImage, TPath >::m_ImageSize {}
protected

Size of the source image

Definition at line 264 of file itkPathIterator.h.

◆ m_ImageSpacing

template<typename TImage, typename TPath>
SpacingType itk::PathIterator< TImage, TPath >::m_ImageSpacing {}
protected

The spacing of the source image

Definition at line 261 of file itkPathIterator.h.

◆ m_IsAtEnd

template<typename TImage, typename TPath>
bool itk::PathIterator< TImage, TPath >::m_IsAtEnd {}
protected

Is the iterator at the end of its walk?

Definition at line 273 of file itkPathIterator.h.

◆ m_Path

template<typename TImage, typename TPath>
PathType::ConstPointer itk::PathIterator< TImage, TPath >::m_Path {}
protected

Smart pointer to the path we're following

Definition at line 252 of file itkPathIterator.h.

◆ m_Region

template<typename TImage, typename TPath>
RegionType itk::PathIterator< TImage, TPath >::m_Region {}
protected

Region type to iterate over.

Definition at line 255 of file itkPathIterator.h.

◆ m_VisitStartIndexAsLastIndexIfClosed

template<typename TImage, typename TPath>
bool itk::PathIterator< TImage, TPath >::m_VisitStartIndexAsLastIndexIfClosed {}
protected

Should GoToBegin() initially skip the first index of a closed path so that the first index will only be visited once–at the end of the path? If false, then GoToBegin() will always move to the 1'st index. The default value is true, which is set the constructor.

Definition at line 270 of file itkPathIterator.h.

◆ m_ZeroOffset

template<typename TImage, typename TPath>
OffsetType itk::PathIterator< TImage, TPath >::m_ZeroOffset {}
protected

Definition at line 246 of file itkPathIterator.h.


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