#include <itkImageRandomNonRepeatingIteratorWithIndex.h>
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.
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 ®ion) | |
| 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 ®ion) | |
| 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 } |
| using itk::ImageIteratorWithIndex< TImage >::AccessorType |
Accessor type that converts data between internal and external representations.
Definition at line 133 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::ImageType |
Image type alias support
Definition at line 118 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::IndexType |
Index type alias support
Definition at line 107 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::IndexValueType |
Definition at line 108 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::InternalPixelType |
Internal Pixel Type
Definition at line 126 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::OffsetType |
Type of the Offset taken from the image
Definition at line 137 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::OffsetValueType |
Definition at line 138 of file itkImageIteratorWithIndex.h.
| 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.
| using itk::ImageIteratorWithIndex< TImage >::PixelContainerPointer |
Definition at line 123 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::PixelType |
External Pixel Type
Definition at line 129 of file itkImageIteratorWithIndex.h.
| using itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::PriorityImageType = itk::Image<SizeValueType, Self::ImageDimension> |
Image with priorities
Definition at line 327 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::RegionType |
Region type alias support
Definition at line 115 of file itkImageIteratorWithIndex.h.
| using itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::Self = ImageRandomNonRepeatingIteratorWithIndex |
Standard class type aliases.
Definition at line 232 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::SizeType |
Size type alias support
Definition at line 111 of file itkImageIteratorWithIndex.h.
| using itk::ImageIteratorWithIndex< TImage >::SizeValueType |
Definition at line 112 of file itkImageIteratorWithIndex.h.
| using itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::Superclass = ImageIteratorWithIndex<TImage> |
Definition at line 233 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
default |
Default constructor.
|
inlineoverride |
Definition at line 253 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
| 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.
|
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.
|
inline |
Conversion from a writable iterator to a read-only iterator.
Definition at line 272 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inline |
The copy constructor is provided to deep copy m_Permutation.
Definition at line 281 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inlinenodiscard |
Set/Get number of random samples to extract from the image region.
Definition at line 369 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inline |
Move an iterator to the beginning of the region.
Definition at line 295 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inline |
Move an iterator to one position past the End of the region.
Definition at line 303 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inlinenodiscard |
Is the iterator at the beginning of the region?
Definition at line 311 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inlinenodiscard |
Is the iterator at the end of the region?
Definition at line 318 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inline |
Increment (prefix) the selected dimension. No bounds checking is performed.
Definition at line 340 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
inline |
Decrement (prefix) the selected dimension. No bounds checking is performed.
Definition at line 350 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
| Self & itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::operator= | ( | const Self & | it | ) |
operator= is provided to deep copy m_Permutation.
| void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ReinitializeSeed | ( | ) |
Reinitialize the seed of the random number generator.
| void itk::ImageRandomNonRepeatingIteratorWithIndex< TImage >::ReinitializeSeed | ( | int | ) |
Reinitialize the seed of the random number generator with a specific value
|
inline |
Set/Get number of random samples to extract from the image region.
Definition at line 360 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
| 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.
|
private |
Update the position.
|
friend |
Definition at line 228 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
staticconstexpr |
The moving image dimension.
Definition at line 324 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
private |
Definition at line 391 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
private |
Definition at line 390 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
private |
Definition at line 389 of file itkImageRandomNonRepeatingIteratorWithIndex.h.
|
private |
Definition at line 392 of file itkImageRandomNonRepeatingIteratorWithIndex.h.