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

#include <itkImageRandomNonRepeatingIteratorWithIndex.h>

Detailed Description

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

A multi-dimensional image iterator that visits a random set of pixels within an image region. All pixels in the image will be visited before any are repeated. A priority image may be passed to the iterator which will cause it to select certain sets of pixels (those with lower priority values) before others.

This class was contributed by Rupert Brooks, McGill Centre for Intelligent Machines, Montreal, Canada. It is heavily based on the ImageRandomIterator class.

ImageRandomNonRepeatingIteratorWithIndex is a multi-dimensional iterator class that is templated over image type. ImageRandomNonRepeatingIteratorWithIndex is constrained to walk only within the specified region. When first instantiated, it creates (and stores) a random permutation of the image pixels. It then visits each pixel in the order specified by the permutation. Thus, iterator++ followed by iterator– will end up leaving the iterator pointing at the same pixel. Furthermore, iterating from beginning to end will cover each pixel in the region exactly once.

This iterator can be passed an image the same size as the region, which specifies a priority for the pixels. Within areas of this priority image that have the same value, the pixel selection will be random. Otherwise the pixel selection will be in the order of the priority image. In the extreme, this allows the order of the pixel selection to be completely specified.

ImageRandomNonRepeatingIteratorWithIndex assumes a particular layout of the image data. The is arranged in a 1D array as if it were [][][][slice][row][col] with Index[0] = col, Index[1] = row, Index[2] = slice, etc.

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.
Author
Rupert Brooks, McGill Centre for Intelligent Machines. Canada
See also
ImageConstIterator
ConditionalConstIterator
ConstNeighborhoodIterator
ConstShapedNeighborhoodIterator
ConstSliceIterator
CorrespondenceDataStructureIterator
FloodFilledFunctionConditionalConstIterator
FloodFilledImageFunctionConditionalConstIterator
FloodFilledImageFunctionConditionalIterator
FloodFilledSpatialFunctionConditionalConstIterator
FloodFilledSpatialFunctionConditionalIterator
ImageConstIterator
ImageConstIteratorWithIndex
ImageIterator
ImageIteratorWithIndex
ImageLinearConstIteratorWithIndex
ImageLinearIteratorWithIndex
ImageRandomNonRepeatingConstIteratorWithIndex
ImageRandomIteratorWithIndex
ImageRegionConstIterator
ImageRegionConstIteratorWithIndex
ImageRegionExclusionConstIteratorWithIndex
ImageRegionExclusionIteratorWithIndex
ImageRegionIterator
ImageRegionIteratorWithIndex
ImageRegionReverseConstIterator
ImageRegionReverseIterator
ImageReverseConstIterator
ImageReverseIterator
ImageSliceConstIteratorWithIndex
ImageSliceIteratorWithIndex
NeighborhoodIterator
PathConstIterator
PathIterator
ShapedNeighborhoodIterator
SliceIterator
ImageConstIteratorWithIndex
ITK Sphinx Examples:

Definition at line 225 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

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

Public Types

using AccessorType
 
using ImageType
 
using IndexType
 
using IndexValueType
 
using InternalPixelType
 
using OffsetType
 
using OffsetValueType
 
using PixelContainer
 
using PixelContainerPointer
 
using PixelType
 
using PriorityImageType = itk::Image<SizeValueType, Self::ImageDimension>
 
using RegionType
 
using Self = ImageRandomNonRepeatingIteratorWithIndex
 
using SizeType
 
using SizeValueType
 
using Superclass = ImageIteratorWithIndex<TImage>
 
- Public Types inherited from itk::ImageIteratorWithIndex< TImage >
using AccessorFunctorType = typename TImage::AccessorFunctorType
 
using AccessorType = typename TImage::AccessorType
 
using ImageType = detail::IteratorImageType_t<TImage>
 
using IndexType = typename TImage::IndexType
 
using IndexValueType = typename IndexType::IndexValueType
 
using InternalPixelType = typename TImage::InternalPixelType
 
using OffsetType = typename TImage::OffsetType
 
using OffsetValueType = typename OffsetType::OffsetValueType
 
using PixelContainer = typename TImage::PixelContainer
 
using PixelContainerPointer = typename PixelContainer::Pointer
 
using PixelType = typename TImage::PixelType
 
using RegionType = typename TImage::RegionType
 
using Self = ImageIteratorWithIndex
 
using SizeType = typename TImage::SizeType
 
using SizeValueType = typename SizeType::SizeValueType
 

Public Member Functions

void GoToBegin ()
 
void GoToEnd ()
 
 ImageRandomNonRepeatingIteratorWithIndex ()=default
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageRandomNonRepeatingIteratorWithIndex (const ImageIteratorWithIndex< TOtherImage > &it)
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageRandomNonRepeatingIteratorWithIndex (const ImageRandomNonRepeatingIteratorWithIndex< TOtherImage > &it)
 
 ImageRandomNonRepeatingIteratorWithIndex (const Self &it)
 
 ImageRandomNonRepeatingIteratorWithIndex (TImage *ptr, const RegionType &region)
 
bool IsAtBegin () const
 
bool IsAtEnd () const
 
Self & operator++ ()
 
Self & operator-- ()
 
Self & operator= (const Self &it)
 
void ReinitializeSeed ()
 
void ReinitializeSeed (int)
 
void SetPriorityImage (const PriorityImageType *priorityImage)
 
 ~ImageRandomNonRepeatingIteratorWithIndex () override
 
void SetNumberOfSamples (SizeValueType number)
 
SizeValueType GetNumberOfSamples () const
 
- Public Member Functions inherited from itk::ImageIteratorWithIndex< TImage >
PixelType Get () const
 
const IndexType & GetIndex () const
 
const RegionType & GetRegion () const
 
void GoToBegin ()
 
void GoToReverseBegin ()
 
 ImageIteratorWithIndex ()=default
 
template<typename TOtherImage, std::enable_if_t< detail::IsImageIteratorConvertible_v< TOtherImage, TImage >, int > = 0>
 ImageIteratorWithIndex (const ImageIteratorWithIndex< TOtherImage > &it)
 
 ImageIteratorWithIndex (const Self &)=default
 
 ImageIteratorWithIndex (TImage *ptr, const RegionType &region)
 
bool IsAtEnd () const
 
bool IsAtReverseEnd () 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 ImageIteratorWithIndex< 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 ImageIteratorWithIndex< 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 ImageIteratorWithIndex< 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 ImageIteratorWithIndex< 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 ImageIteratorWithIndex< 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 ImageIteratorWithIndex< TOtherImage > &it) const
 
bool Remaining ()
 
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
 
void SetIndex (const IndexType &ind)
 
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 ~ImageIteratorWithIndex ()=default
 

Static Public Attributes

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

Private Member Functions

void UpdatePosition ()
 

Private Attributes

SizeValueType m_NumberOfPixelsInRegion {}
 
SizeValueType m_NumberOfSamplesDone {}
 
SizeValueType m_NumberOfSamplesRequested {}
 
RandomPermutation * m_Permutation {}
 

Friends

template<typename>
class ImageRandomNonRepeatingIteratorWithIndex
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::ImageIteratorWithIndex< TImage >
static constexpr unsigned int GetImageDimension ()
 
- Protected Types inherited from itk::ImageIteratorWithIndex< TImage >
using QualifiedInternalPixelType
 
- Protected Attributes inherited from itk::ImageIteratorWithIndex< TImage >
QualifiedInternalPixelType * m_Begin { nullptr }
 
IndexType m_BeginIndex { { 0 } }
 
QualifiedInternalPixelType * m_End { nullptr }
 
IndexType m_EndIndex { { 0 } }
 
WeakPointer< TImage > m_Image {}
 
OffsetValueType m_OffsetTable [ImageDimension+1] {}
 
AccessorType m_PixelAccessor {}
 
AccessorFunctorType m_PixelAccessorFunctor {}
 
QualifiedInternalPixelType * m_Position { nullptr }
 
IndexType m_PositionIndex { { 0 } }
 
RegionType m_Region {}
 
bool m_Remaining { false }
 

Member Typedef Documentation

◆ AccessorType

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

Accessor type that converts data between internal and external representations.

Definition at line 133 of file itkImageIteratorWithIndex.h.

◆ ImageType

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

Image type alias support

Definition at line 118 of file itkImageIteratorWithIndex.h.

◆ IndexType

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

Index type alias support

Definition at line 107 of file itkImageIteratorWithIndex.h.

◆ IndexValueType

template<typename TImage>
using itk::ImageIteratorWithIndex< TImage >::IndexValueType

Definition at line 108 of file itkImageIteratorWithIndex.h.

◆ InternalPixelType

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

Internal Pixel Type

Definition at line 126 of file itkImageIteratorWithIndex.h.

◆ OffsetType

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

Type of the Offset taken from the image

Definition at line 137 of file itkImageIteratorWithIndex.h.

◆ OffsetValueType

template<typename TImage>
using itk::ImageIteratorWithIndex< TImage >::OffsetValueType

Definition at line 138 of file itkImageIteratorWithIndex.h.

◆ PixelContainer

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

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

Definition at line 122 of file itkImageIteratorWithIndex.h.

◆ PixelContainerPointer

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

Definition at line 123 of file itkImageIteratorWithIndex.h.

◆ PixelType

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

External Pixel Type

Definition at line 129 of file itkImageIteratorWithIndex.h.

◆ PriorityImageType

template<typename TImage>
using itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::PriorityImageType = itk::Image<SizeValueType, Self::ImageDimension>

Image with priorities

Definition at line 327 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ RegionType

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

Region type alias support

Definition at line 115 of file itkImageIteratorWithIndex.h.

◆ Self

Standard class type aliases.

Definition at line 232 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ SizeType

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

Size type alias support

Definition at line 111 of file itkImageIteratorWithIndex.h.

◆ SizeValueType

template<typename TImage>
using itk::ImageIteratorWithIndex< TImage >::SizeValueType

Definition at line 112 of file itkImageIteratorWithIndex.h.

◆ Superclass

template<typename TImage>
using itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::Superclass = ImageIteratorWithIndex<TImage>

Constructor & Destructor Documentation

◆ ImageRandomNonRepeatingIteratorWithIndex() [1/5]

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

Default constructor.

◆ ~ImageRandomNonRepeatingIteratorWithIndex()

template<typename TImage>
itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::~ImageRandomNonRepeatingIteratorWithIndex ( )
inlineoverride

◆ ImageRandomNonRepeatingIteratorWithIndex() [2/5]

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

Constructor establishes an iterator to walk a particular image and a particular region of that image.

◆ ImageRandomNonRepeatingIteratorWithIndex() [3/5]

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

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

Definition at line 266 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ ImageRandomNonRepeatingIteratorWithIndex() [4/5]

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

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

Definition at line 272 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ ImageRandomNonRepeatingIteratorWithIndex() [5/5]

template<typename TImage>
itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ImageRandomNonRepeatingIteratorWithIndex ( const Self & it)
inline

The copy constructor is provided to deep copy m_Permutation.

Definition at line 281 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

Member Function Documentation

◆ GetNumberOfSamples()

template<typename TImage>
SizeValueType itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::GetNumberOfSamples ( ) const
inlinenodiscard

Set/Get number of random samples to extract from the image region.

Definition at line 369 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ GoToBegin()

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

Move an iterator to the beginning of the region.

Definition at line 295 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ GoToEnd()

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

Move an iterator to one position past the End of the region.

Definition at line 303 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ IsAtBegin()

template<typename TImage>
bool itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::IsAtBegin ( ) const
inlinenodiscard

Is the iterator at the beginning of the region?

Definition at line 311 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ IsAtEnd()

template<typename TImage>
bool itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::IsAtEnd ( ) const
inlinenodiscard

Is the iterator at the end of the region?

Definition at line 318 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ operator++()

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

Increment (prefix) the selected dimension. No bounds checking is performed.

See also
GetIndex
operator--

Definition at line 340 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ operator--()

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

Decrement (prefix) the selected dimension. No bounds checking is performed.

See also
GetIndex
operator++

Definition at line 350 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ operator=()

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

operator= is provided to deep copy m_Permutation.

◆ ReinitializeSeed() [1/2]

template<typename TImage>
void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ReinitializeSeed ( )

Reinitialize the seed of the random number generator.

◆ ReinitializeSeed() [2/2]

template<typename TImage>
void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ReinitializeSeed ( int )

Reinitialize the seed of the random number generator with a specific value

◆ SetNumberOfSamples()

template<typename TImage>
void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::SetNumberOfSamples ( SizeValueType number)
inline

Set/Get number of random samples to extract from the image region.

Definition at line 360 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ SetPriorityImage()

template<typename TImage>
void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::SetPriorityImage ( const PriorityImageType * priorityImage)

Set the priority image. The priority image controls the order of the random selection. Pixels of the same priority will be ordered randomly, but pixels of lower priority value will be selected first.

◆ UpdatePosition()

template<typename TImage>
void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::UpdatePosition ( )
private

Update the position.

Friends And Related Symbol Documentation

◆ ImageRandomNonRepeatingIteratorWithIndex

template<typename TImage>
template<typename>
friend class ImageRandomNonRepeatingIteratorWithIndex
friend

Member Data Documentation

◆ ImageDimension

template<typename TImage>
unsigned int itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ImageDimension = TImage::ImageDimension
staticconstexpr

The moving image dimension.

Definition at line 324 of file itkImageRandomNonRepeatingIteratorWithIndex.h.

◆ m_NumberOfPixelsInRegion

template<typename TImage>
SizeValueType itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::m_NumberOfPixelsInRegion {}
private

◆ m_NumberOfSamplesDone

template<typename TImage>
SizeValueType itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::m_NumberOfSamplesDone {}
private

◆ m_NumberOfSamplesRequested

template<typename TImage>
SizeValueType itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::m_NumberOfSamplesRequested {}
private

◆ m_Permutation

template<typename TImage>
RandomPermutation* itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::m_Permutation {}
private

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