#include <itkImageIterator.h>
A multi-dimensional image iterator templated over image type.
ImageIterator is a templated class to represent a multi-dimensional iterator. ImageIterator is templated over the type of the image to be iterated over.
The constness of the template image type determines the access semantics of the iterator: a const-qualified type provides read-only access, while a non-const type allows both reading and writing.
ImageIterator is a base class for all the image iterators. It provides the basic construction and comparison operations. However, it does not provide mechanisms for moving the iterator. A subclass of ImageIterator must be used to move the iterator.
ImageIterator is a multi-dimensional iterator, requiring more information be specified before the iterator can be used than conventional iterators. Whereas the std::vector::iterator from the STL only needs to be passed a pointer to establish the iterator, the multi-dimensional image iterator needs a pointer, the size of the buffer, the size of the region, the start index of the buffer, and the start index of the region. To gain access to this information, ImageIterator holds a reference to the image over which it is traversing.
ImageIterator assumes a particular layout of the image data. In particular, the data is arranged in a 1D array as if it were [][][][slice][row][col] with Index[0] = col, Index[1] = row, Index[2] = slice, etc.
Definition at line 108 of file itkImageIterator.h.
Inheritance diagram for itk::ImageIterator< TImage >:
Collaboration diagram for itk::ImageIterator< TImage >:Public Types | |
| 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 | |
| IndexType | ComputeIndex () const |
| PixelType | Get () const |
| TImage * | GetImage () const |
| virtual const char * | GetNameOfClass () 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 ®ion) | |
| 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 | SetIndex (const IndexType &ind) |
| virtual void | SetRegion (const RegionType ®ion) |
| 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 Member Functions | |
| static unsigned int | GetImageIteratorDimension () |
Static Public Attributes | |
| static constexpr unsigned int | ImageIteratorDimension = TImage::ImageDimension |
Protected Attributes | |
| 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 | ImageIterator |
| using itk::ImageIterator< TImage >::AccessorFunctorType = typename TImage::AccessorFunctorType |
Definition at line 155 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::AccessorType = typename TImage::AccessorType |
Accessor type that convert data between internal and external representations.
Definition at line 154 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::ImageType = detail::IteratorImageType_t<TImage> |
Image type alias support
Definition at line 139 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::IndexType = typename TImage::IndexType |
Index type alias support
Definition at line 127 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::InternalPixelType = typename TImage::InternalPixelType |
Internal Pixel Type
Definition at line 147 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::OffsetType = typename TImage::OffsetType |
Offset type alias support
Definition at line 133 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::PixelContainer = typename TImage::PixelContainer |
PixelContainer type alias support. Used to refer to the container for the pixel data.
Definition at line 143 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::PixelContainerPointer = typename PixelContainer::Pointer |
Definition at line 144 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::PixelType = typename TImage::PixelType |
External Pixel Type
Definition at line 150 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::RegionType = typename TImage::RegionType |
Region type alias support
Definition at line 136 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::Self = ImageIterator |
Standard class type aliases.
Definition at line 115 of file itkImageIterator.h.
| using itk::ImageIterator< TImage >::SizeType = typename TImage::SizeType |
Size type alias support
Definition at line 130 of file itkImageIterator.h.
|
inline |
Default Constructor. Need to provide a default constructor since we provide a copy constructor.
Definition at line 159 of file itkImageIterator.h.
|
virtualdefault |
Default Destructor.
|
default |
|
inline |
Conversion from a writable iterator to a read-only iterator.
Definition at line 178 of file itkImageIterator.h.
|
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 191 of file itkImageIterator.h.
|
inlinenodiscard |
Computes the index. Internally calls ImageBase::ComputeIndex, which may be a relatively expensive operation.
Definition at line 323 of file itkImageIterator.h.
Referenced by itk::ImageReverseIterator< std::add_const_t< TImage > >::ImageReverseIterator(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator().
|
inlinenodiscard |
Get the pixel value
Definition at line 365 of file itkImageIterator.h.
Referenced by itk::MultiphaseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFunction, TIdCell >::SetLevelSet(), and itk::GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType >::TransformOutputPixel().
|
inlinenodiscard |
Get the image that this iterator walks.
Definition at line 358 of file itkImageIterator.h.
Referenced by itk::ImageReverseIterator< std::add_const_t< TImage > >::operator=(), itk::GradientImageFilter< TInputImage, TOperatorValueType, TOutputValueType, TOutputImageType >::SetOutputPixel(), and itk::GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType >::TransformOutputPixel().
|
inlinestatic |
Get the dimension (size) of the index.
Definition at line 246 of file itkImageIterator.h.
|
virtual |
Reimplemented in itk::ImageConstIterator< TImage >, itk::ImageRegionConstIterator< TImage >, itk::ImageRegionConstIterator< CoordImageType >, itk::ImageRegionConstIterator< CoordImageType >, itk::ImageRegionConstIterator< FeatureImageType >, itk::ImageRegionConstIterator< FeatureImageType >, itk::ImageRegionConstIterator< ImageType >, itk::ImageRegionConstIterator< ImageType >, itk::ImageRegionConstIterator< InputImageType >, itk::ImageRegionConstIterator< InputImageType >, itk::ImageRegionConstIterator< InternalImageType >, itk::ImageRegionConstIterator< InternalImageType >, itk::ImageRegionConstIterator< MembershipImageType >, itk::ImageRegionConstIterator< MembershipImageType >, itk::ImageRegionConstIterator< PriorsImageType >, itk::ImageRegionConstIterator< PriorsImageType >, itk::ImageRegionConstIterator< TInputImage >, itk::ImageRegionConstIterator< TInputImage >, itk::ImageRegionConstIterator< TTrainingImage >, itk::ImageRegionConstIterator< TTrainingImage >, itk::ImageRegionIterator< TImage >, itk::ImageRegionIterator< ImageType >, itk::ImageRegionIterator< ImageType >, itk::ImageRegionIterator< InputImageType >, itk::ImageRegionIterator< InputImageType >, itk::ImageRegionIterator< InternalImageType >, itk::ImageRegionIterator< InternalImageType >, itk::ImageRegionIterator< LabelImageType >, itk::ImageRegionIterator< LabelImageType >, itk::ImageRegionIterator< LabelStatusImageType >, itk::ImageRegionIterator< LabelStatusImageType >, itk::ImageRegionIterator< MembershipImageType >, itk::ImageRegionIterator< MembershipImageType >, itk::ImageRegionIterator< OutputImageType >, itk::ImageRegionIterator< OutputImageType >, itk::ImageRegionIterator< PosteriorsImageType >, itk::ImageRegionIterator< PosteriorsImageType >, itk::ImageRegionIterator< std::add_const_t< TImage > >, itk::ImageRegionIterator< std::add_const_t< TImage > >, itk::ImageRegionIterator< TClassifiedImage >, itk::ImageRegionIterator< TClassifiedImage >, itk::ImageRegionIterator< TInputImage >, itk::ImageRegionIterator< TInputImage >, itk::ImageRegionIterator< TOutputImage >, itk::ImageRegionIterator< TOutputImage >, itk::ImageRegionIterator< TTrainingImage >, itk::ImageRegionIterator< TTrainingImage >, itk::ImageScanlineConstIterator< TImage >, itk::ImageScanlineConstIterator< InputImageType >, itk::ImageScanlineConstIterator< InputImageType >, itk::ImageScanlineIterator< TImage >, itk::ImageScanlineIterator< std::add_const_t< TImage > >, and itk::ImageScanlineIterator< std::add_const_t< TImage > >.
|
inlinenodiscard |
Get the region that this iterator walks. ImageIterators know the beginning and the end of the region of the image to iterate over.
Definition at line 351 of file itkImageIterator.h.
Referenced by itk::ImageReverseIterator< std::add_const_t< TImage > >::operator=().
|
inline |
Move an iterator to the beginning of the region. "Begin" is defined as the first pixel in the region.
Definition at line 400 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToBegin(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToBegin().
|
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 408 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToEnd(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToEnd().
|
inlinenodiscard |
Is the iterator at the beginning of the region? "Begin" is defined as the first pixel in the region.
Definition at line 416 of file itkImageIterator.h.
|
inlinenodiscard |
Is the iterator at the end of the region? "End" is defined as one pixel past the last pixel of the region.
Definition at line 424 of file itkImageIterator.h.
Referenced by itk::MultiphaseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFunction, TIdCell >::SetLevelSet().
|
inline |
Definition at line 266 of file itkImageIterator.h.
|
inline |
Comparison operator. An iterator is "less than" another if it "points to" a lower memory location.
Definition at line 288 of file itkImageIterator.h.
|
inline |
Comparison operator. An iterator is "less than" another if it "points to" a lower memory location.
Definition at line 276 of file itkImageIterator.h.
|
default |
|
inline |
Comparison operator. Two iterators are the same if they "point to" the same memory location
Definition at line 256 of file itkImageIterator.h.
|
inline |
Comparison operator. An iterator is "greater than" another if it "points to" a higher location.
Definition at line 313 of file itkImageIterator.h.
|
inline |
Comparison operator. An iterator is "greater than" another if it "points to" a higher location.
Definition at line 301 of file itkImageIterator.h.
|
inline |
Set the pixel value. Available only when TImage is not const.
Definition at line 373 of file itkImageIterator.h.
Referenced by itk::MultiphaseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFunction, TIdCell >::SetLevelSet(), and itk::GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType >::TransformOutputPixel().
|
inlinevirtual |
Set the index. No bounds checking is performed.
Reimplemented in itk::ImageRegionIterator< TImage >, itk::ImageRegionIterator< std::add_const_t< TImage > >, itk::ImageRegionIterator< std::add_const_t< TImage > >, itk::ImageScanlineIterator< TImage >, itk::ImageScanlineIterator< std::add_const_t< TImage > >, and itk::ImageScanlineIterator< std::add_const_t< TImage > >.
Definition at line 343 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::SetIndex(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::SetIndex().
|
inlinevirtual |
Set the region of the image to iterate over.
Definition at line 207 of file itkImageIterator.h.
|
inline |
Return a reference to the pixel This method will provide the fastest access to pixel data, but it will NOT support ImageAdaptors. Available only when TImage is not const.
Definition at line 392 of file itkImageIterator.h.
|
inlinenodiscard |
Return a const reference to the pixel This method will provide the fastest access to pixel data, but it will NOT support ImageAdaptors.
Definition at line 382 of file itkImageIterator.h.
Referenced by itk::GradientImageFilter< TInputImage, TOperatorValueType, TOutputValueType, TOutputImageType >::SetOutputPixel().
Definition at line 111 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::ImageRegionIterator(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator().
|
staticconstexpr |
Dimension of the image 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 121 of file itkImageIterator.h.
|
protected |
Definition at line 435 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToBegin(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToBegin(), itk::ImageRegionIterator< std::add_const_t< TImage > >::ImageRegionIterator(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator().
|
protected |
Definition at line 438 of file itkImageIterator.h.
Referenced by itk::ImageIterator< std::add_const_t< TImage > >::operator<(), itk::ImageIterator< std::add_const_t< TImage > >::operator<=(), itk::ImageIterator< std::add_const_t< TImage > >::operator==(), itk::ImageIterator< std::add_const_t< TImage > >::operator>(), and itk::ImageIterator< std::add_const_t< TImage > >::operator>=().
|
protected |
Definition at line 436 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToEnd(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToEnd().
|
protected |
Definition at line 430 of file itkImageIterator.h.
|
protected |
Definition at line 434 of file itkImageIterator.h.
Referenced by itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToBeginOfLine(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToEndOfLine(), itk::ImageRegionIterator< std::add_const_t< TImage > >::ImageRegionIterator(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::IsAtEndOfLine(), itk::ImageRegionIterator< std::add_const_t< TImage > >::operator++(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::operator++(), itk::ImageRegionIterator< std::add_const_t< TImage > >::operator--(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::operator--(), itk::ImageIterator< std::add_const_t< TImage > >::operator<(), itk::ImageIterator< std::add_const_t< TImage > >::operator<=(), itk::ImageIterator< std::add_const_t< TImage > >::operator==(), itk::ImageIterator< std::add_const_t< TImage > >::operator>(), itk::ImageIterator< std::add_const_t< TImage > >::operator>=(), itk::ImageRegionIterator< std::add_const_t< TImage > >::SetIndex(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::SetIndex().
|
protected |
Definition at line 440 of file itkImageIterator.h.
|
protected |
Definition at line 441 of file itkImageIterator.h.
|
protected |
Definition at line 432 of file itkImageIterator.h.
Referenced by itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToBegin(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToBegin(), itk::ImageRegionIterator< std::add_const_t< TImage > >::GoToEnd(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::GoToEnd(), itk::ImageRegionIterator< std::add_const_t< TImage > >::ImageRegionIterator(), itk::ImageRegionIterator< std::add_const_t< TImage > >::ImageRegionIterator(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator(), itk::ImageScanlineIterator< std::add_const_t< TImage > >::ImageScanlineIterator(), itk::ImageRegionIterator< std::add_const_t< TImage > >::SetIndex(), and itk::ImageScanlineIterator< std::add_const_t< TImage > >::SetIndex().