ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | List of all members
itk::Offset< VDimension > Struct Template Referencefinal

#include <itkOffset.h>

+ Inheritance diagram for itk::Offset< VDimension >:

Public Types

using OffsetType = Offset< VDimension >
 
using OffsetValueType = ::itk::OffsetValueType
 
using Self = Offset
 

Public Member Functions

const Self operator+ (const Self &vec) const
 
const Self operator+ (const Size< VDimension > &sz) const
 

Static Public Member Functions

static constexpr unsigned int GetOffsetDimension ()
 

Static Public Attributes

static constexpr unsigned int Dimension = VDimension
 
using value_type = ::itk::OffsetValueType
 
using reference = value_type &
 
using const_reference = const value_type &
 
using iterator = value_type *
 
using const_iterator = const value_type *
 
using size_type = unsigned int
 
using difference_type = std::ptrdiff_t
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
OffsetValueType m_InternalArray [VDimension]
 
static Self GetBasisOffset (unsigned int dim)
 
const Selfoperator+= (const Size< VDimension > &sz)
 
const Selfoperator-= (const Size< VDimension > &sz)
 
const Self operator- (const Self &vec)
 
const Selfoperator+= (const Self &vec)
 
const Selfoperator-= (const Self &vec)
 
const OffsetValueTypeGetOffset () const
 
void SetOffset (const OffsetValueType val[VDimension])
 
void SetElement (unsigned long element, OffsetValueType val)
 
OffsetValueType GetElement (unsigned long element) const
 
void Fill (OffsetValueType value)
 
template<typename TCoordRep >
void CopyWithRound (const FixedArray< TCoordRep, VDimension > &point)
 
template<typename TCoordRep >
void CopyWithCast (const FixedArray< TCoordRep, VDimension > &point)
 
void assign (const value_type &newValue)
 
void swap (Offset &other)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
constexpr size_type size () const
 
constexpr size_type max_size () const
 
constexpr bool empty () const
 
reference operator[] (size_type pos)
 
const_reference operator[] (size_type pos) const
 
reference at (size_type pos)
 
const_reference at (size_type pos) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
OffsetValueTypedata ()
 
const OffsetValueTypedata () const
 
void ExceptionThrowingBoundsCheck (size_type pos) const
 

Detailed Description

template<unsigned int VDimension = 2>
struct itk::Offset< VDimension >

Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.

Offset is a templated class to represent a multi-dimensional offset, i.e. (i,j,k,...). Offset is templated over the dimension of the space. ITK assumes the first element of a size (bounds) is the fastest moving index.

For efficiency, Offset does not define a default constructor, a copy constructor, or an operator=. We rely on the compiler to provide efficient bitwise copies.

Offset is an "aggregate" class. Its data is public (m_InternalArray) allowing for fast and convenient instantiations/assignments.

The following syntax for assigning an aggregate type like this is allowed/suggested:

Offset<3> var{{ 256, 256, 20 }}; // Also prevent narrowing conversions Offset<3> var = {{ 256, 256, 20 }};

The doubled braces {{ and }} are required to prevent ‘gcc -Wall’ (and perhaps other compilers) from complaining about a partly bracketed initializer.

As an aggregate type that is intended to provide highest performance characteristics, this class is not appropriate to inherit from, so setting this struct as final.

See also
Index
ITK Sphinx Examples:
Examples
SphinxExamples/src/Core/Common/AddOffsetToIndex/Code.cxx, and SphinxExamples/src/Core/Common/DemonstrateAllOperators/Code.cxx.

Definition at line 67 of file itkOffset.h.

Member Typedef Documentation

◆ const_iterator

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::const_iterator = const value_type *

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 288 of file itkOffset.h.

◆ const_reference

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::const_reference = const value_type &

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 286 of file itkOffset.h.

◆ const_reverse_iterator

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 292 of file itkOffset.h.

◆ difference_type

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::difference_type = std::ptrdiff_t

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 290 of file itkOffset.h.

◆ iterator

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::iterator = value_type *

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 287 of file itkOffset.h.

◆ OffsetType

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::OffsetType = Offset<VDimension>

Compatible Offset and value type alias.

Definition at line 77 of file itkOffset.h.

◆ OffsetValueType

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::OffsetValueType = ::itk::OffsetValueType

Definition at line 78 of file itkOffset.h.

◆ reference

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::reference = value_type &

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 285 of file itkOffset.h.

◆ reverse_iterator

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::reverse_iterator = std::reverse_iterator<iterator>

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 291 of file itkOffset.h.

◆ Self

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::Self = Offset

Standard class type aliases.

Definition at line 74 of file itkOffset.h.

◆ size_type

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::size_type = unsigned int

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 289 of file itkOffset.h.

◆ value_type

template<unsigned int VDimension = 2>
using itk::Offset< VDimension >::value_type = ::itk::OffsetValueType

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 284 of file itkOffset.h.

Member Function Documentation

◆ assign()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::assign ( const value_type newValue)
inline

Mirror behavior of the std::array manipulations See std::array for documentation on these methods

Definition at line 299 of file itkOffset.h.

◆ at() [1/2]

template<unsigned int VDimension = 2>
reference itk::Offset< VDimension >::at ( size_type  pos)
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 381 of file itkOffset.h.

◆ at() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Offset< VDimension >::at ( size_type  pos) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 388 of file itkOffset.h.

◆ back() [1/2]

template<unsigned int VDimension = 2>
reference itk::Offset< VDimension >::back ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 407 of file itkOffset.h.

◆ back() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Offset< VDimension >::back ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 413 of file itkOffset.h.

◆ begin() [1/2]

template<unsigned int VDimension = 2>
iterator itk::Offset< VDimension >::begin ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 311 of file itkOffset.h.

Referenced by itk::RectangularImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::operator<(), and itk::operator==().

◆ begin() [2/2]

template<unsigned int VDimension = 2>
const_iterator itk::Offset< VDimension >::begin ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 317 of file itkOffset.h.

◆ CopyWithCast()

template<unsigned int VDimension = 2>
template<typename TCoordRep >
void itk::Offset< VDimension >::CopyWithCast ( const FixedArray< TCoordRep, VDimension > &  point)
inline

Copy values from a FixedArray by casting each one of the components

Definition at line 262 of file itkOffset.h.

◆ CopyWithRound()

template<unsigned int VDimension = 2>
template<typename TCoordRep >
void itk::Offset< VDimension >::CopyWithRound ( const FixedArray< TCoordRep, VDimension > &  point)
inline

Copy values from a FixedArray by rounding each one of the components

Definition at line 250 of file itkOffset.h.

◆ data() [1/2]

template<unsigned int VDimension = 2>
OffsetValueType* itk::Offset< VDimension >::data ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 419 of file itkOffset.h.

Referenced by itk::ImageRegionRange< TImage >::ComputeOffset().

◆ data() [2/2]

template<unsigned int VDimension = 2>
const OffsetValueType* itk::Offset< VDimension >::data ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 425 of file itkOffset.h.

◆ empty()

template<unsigned int VDimension = 2>
constexpr bool itk::Offset< VDimension >::empty ( ) const
inlineconstexpr

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 371 of file itkOffset.h.

◆ end() [1/2]

template<unsigned int VDimension = 2>
iterator itk::Offset< VDimension >::end ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 323 of file itkOffset.h.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::operator<(), and itk::operator==().

◆ end() [2/2]

template<unsigned int VDimension = 2>
const_iterator itk::Offset< VDimension >::end ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 329 of file itkOffset.h.

◆ ExceptionThrowingBoundsCheck()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::ExceptionThrowingBoundsCheck ( size_type  pos) const
inlineprivate

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 432 of file itkOffset.h.

◆ Fill()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::Fill ( OffsetValueType  value)
inline

Set one value for the offset in all dimensions. Useful for initializing an offset to zero.

Definition at line 224 of file itkOffset.h.

◆ front() [1/2]

template<unsigned int VDimension = 2>
reference itk::Offset< VDimension >::front ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 395 of file itkOffset.h.

◆ front() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Offset< VDimension >::front ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 401 of file itkOffset.h.

◆ GetBasisOffset()

template<unsigned int VDimension>
Offset< VDimension > itk::Offset< VDimension >::GetBasisOffset ( unsigned int  dim)
static

Return a basis vector of the form [0, ..., 0, 1, 0, ... 0] where the "1" is positioned in the location specified by the parameter "dim". Valid values of "dim" are 0, ..., VDimension-1.

Definition at line 444 of file itkOffset.h.

◆ GetElement()

template<unsigned int VDimension = 2>
OffsetValueType itk::Offset< VDimension >::GetElement ( unsigned long  element) const
inline

Gets the value of one of the elements. This method is mainly intended to facilitate the access to elements from Tcl and Python where C++ notation is not very convenient.

Warning
No bound checking is performed
See also
GetIndex()
SetElement()

Definition at line 216 of file itkOffset.h.

◆ GetOffset()

template<unsigned int VDimension = 2>
const OffsetValueType* itk::Offset< VDimension >::GetOffset ( ) const
inline

Get the offset. This provides a read only pointer to the offset.

See also
SetOffset()

Definition at line 182 of file itkOffset.h.

◆ GetOffsetDimension()

template<unsigned int VDimension = 2>
static constexpr unsigned int itk::Offset< VDimension >::GetOffsetDimension ( )
inlinestaticconstexpr

Get the dimension (size) of the index.

Definition at line 85 of file itkOffset.h.

◆ max_size()

template<unsigned int VDimension = 2>
constexpr size_type itk::Offset< VDimension >::max_size ( ) const
inlineconstexpr

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 365 of file itkOffset.h.

◆ operator+() [1/2]

template<unsigned int VDimension = 2>
const Self itk::Offset< VDimension >::operator+ ( const Self vec) const
inline

Add two offsets.

Definition at line 93 of file itkOffset.h.

◆ operator+() [2/2]

template<unsigned int VDimension = 2>
const Self itk::Offset< VDimension >::operator+ ( const Size< VDimension > &  sz) const
inline

Add a size to an offset.

Definition at line 106 of file itkOffset.h.

◆ operator+=() [1/2]

template<unsigned int VDimension = 2>
const Self& itk::Offset< VDimension >::operator+= ( const Self vec)
inline

Increment offset by an offset.

Definition at line 156 of file itkOffset.h.

◆ operator+=() [2/2]

template<unsigned int VDimension = 2>
const Self& itk::Offset< VDimension >::operator+= ( const Size< VDimension > &  sz)
inline

Increment index by a size.

Definition at line 119 of file itkOffset.h.

◆ operator-()

template<unsigned int VDimension = 2>
const Self itk::Offset< VDimension >::operator- ( const Self vec)
inline

Subtract two offsets.

Definition at line 143 of file itkOffset.h.

◆ operator-=() [1/2]

template<unsigned int VDimension = 2>
const Self& itk::Offset< VDimension >::operator-= ( const Self vec)
inline

Decrement offset by an offset.

Definition at line 168 of file itkOffset.h.

◆ operator-=() [2/2]

template<unsigned int VDimension = 2>
const Self& itk::Offset< VDimension >::operator-= ( const Size< VDimension > &  sz)
inline

Decrement index by a size.

Definition at line 131 of file itkOffset.h.

◆ operator[]() [1/2]

template<unsigned int VDimension = 2>
reference itk::Offset< VDimension >::operator[] ( size_type  pos)
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 376 of file itkOffset.h.

◆ operator[]() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Offset< VDimension >::operator[] ( size_type  pos) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 378 of file itkOffset.h.

◆ rbegin() [1/2]

template<unsigned int VDimension = 2>
reverse_iterator itk::Offset< VDimension >::rbegin ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 335 of file itkOffset.h.

◆ rbegin() [2/2]

template<unsigned int VDimension = 2>
const_reverse_iterator itk::Offset< VDimension >::rbegin ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 341 of file itkOffset.h.

◆ rend() [1/2]

template<unsigned int VDimension = 2>
reverse_iterator itk::Offset< VDimension >::rend ( )
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 347 of file itkOffset.h.

◆ rend() [2/2]

template<unsigned int VDimension = 2>
const_reverse_iterator itk::Offset< VDimension >::rend ( ) const
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 353 of file itkOffset.h.

◆ SetElement()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::SetElement ( unsigned long  element,
OffsetValueType  val 
)
inline

Sets the value of one of the elements. This method is mainly intended to facilitate the access to elements from Tcl and Python where C++ notation is not very convenient.

Warning
No bound checking is performed.
See also
SetIndex()
GetElement()

Definition at line 204 of file itkOffset.h.

◆ SetOffset()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::SetOffset ( const OffsetValueType  val[VDimension])
inline

Set the index. Try to prototype this function so that val has to point to a block of memory that is the appropriate size.

See also
GetOffset()

Definition at line 192 of file itkOffset.h.

◆ size()

template<unsigned int VDimension = 2>
constexpr size_type itk::Offset< VDimension >::size ( ) const
inlineconstexpr

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 359 of file itkOffset.h.

◆ swap()

template<unsigned int VDimension = 2>
void itk::Offset< VDimension >::swap ( Offset< VDimension > &  other)
inline

Mirror the std::array type aliases and member function so that the Offset class can be treated as a container class in a way that is similar to the std::array.

Definition at line 305 of file itkOffset.h.

Member Data Documentation

◆ Dimension

template<unsigned int VDimension = 2>
constexpr unsigned int itk::Offset< VDimension >::Dimension = VDimension
staticconstexpr

Dimension constant

Definition at line 81 of file itkOffset.h.

◆ m_InternalArray

template<unsigned int VDimension = 2>
OffsetValueType itk::Offset< VDimension >::m_InternalArray[VDimension]

Offset is an "aggregate" class. Its data is public (m_InternalArray) allowing for fast and convenient instantiations/assignments. ( See main class documentation for an example of initialization)

Definition at line 243 of file itkOffset.h.

Referenced by itk::Offset< ImageDimension+1 >::GetBasisOffset(), itk::Offset< ImageDimension+1 >::operator+(), itk::Offset< ImageDimension+1 >::operator+=(), itk::Offset< ImageDimension+1 >::operator-(), itk::Index< Self::ImageDimension >::operator-(), itk::Offset< ImageDimension+1 >::operator-=(), itk::Offset< ImageDimension+1 >::swap(), and itk::swap().


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