ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::Size< VDimension > Struct Template Referencefinal

#include <itkSize.h>

Detailed Description

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

Represent a n-dimensional size (bounds) of a n-dimensional image.

Size is a templated class to represent multi-dimensional array bounds, i.e. (I,J,K,...). Size is templated over the dimension of the bounds. ITK assumes the first element of a size (bounds) is the fastest moving index.

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

Size 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:

Size<3> var{{ 256, 256, 20 }}; // Also prevent narrowing conversions Size<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
Examples/Segmentation/HoughTransform2DLinesImageFilter.cxx.

Definition at line 69 of file itkSize.h.

Public Types

using const_iterator = const value_type *
 
using const_reference = const value_type &
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 
using difference_type = ptrdiff_t
 
using iterator = value_type *
 
using reference = value_type &
 
using reverse_iterator = std::reverse_iterator<iterator>
 
using Self = Size
 
using size_type = unsigned int
 
using SizeType = Size<VDimension>
 
using SizeValueType = itk::SizeValueType
 
using value_type = itk::SizeValueType
 

Public Member Functions

void assign (const value_type &newValue)
 
reference at (size_type pos)
 
const_reference at (size_type pos) const
 
constexpr reference back ()
 
constexpr const_reference back () const
 
constexpr iterator begin ()
 
constexpr const_iterator begin () const
 
constexpr SizeValueType CalculateProductOfElements () const
 
constexpr const_iterator cbegin () const
 
constexpr const_iterator cend () const
 
SizeValueTypedata ()
 
const SizeValueTypedata () const
 
constexpr bool empty () const
 
constexpr iterator end ()
 
constexpr const_iterator end () const
 
void Fill (SizeValueType value)
 
constexpr reference front ()
 
constexpr const_reference front () const
 
SizeValueType GetElement (unsigned long element) const
 
const SizeValueTypeGetSize () const
 
constexpr size_type max_size () const
 
const Self operator* (const Self &vec) const
 
const Selfoperator*= (const Self &vec)
 
const Self operator+ (const Self &vec) const
 
const Selfoperator+= (const Self &vec)
 
const Self operator- (const Self &vec) const
 
const Selfoperator-= (const Self &vec)
 
constexpr reference operator[] (size_type pos)
 
constexpr const_reference operator[] (size_type pos) const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void SetElement (unsigned long element, SizeValueType val)
 
void SetSize (const SizeValueType val[VDimension])
 
constexpr size_type size () const
 
void swap (Size &other) noexcept
 

Static Public Member Functions

static constexpr Self Filled (const SizeValueType value)
 
static constexpr unsigned int GetSizeDimension ()
 

Public Attributes

SizeValueType m_InternalArray [VDimension]
 

Static Public Attributes

static constexpr unsigned int Dimension = VDimension
 

Private Member Functions

void ExceptionThrowingBoundsCheck (size_type pos) const
 

Member Typedef Documentation

◆ const_iterator

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

Definition at line 254 of file itkSize.h.

◆ const_reference

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

Definition at line 252 of file itkSize.h.

◆ const_reverse_iterator

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

Definition at line 258 of file itkSize.h.

◆ difference_type

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

Definition at line 256 of file itkSize.h.

◆ iterator

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

Definition at line 253 of file itkSize.h.

◆ reference

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

Definition at line 251 of file itkSize.h.

◆ reverse_iterator

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

Definition at line 257 of file itkSize.h.

◆ Self

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

Standard class type aliases.

Definition at line 76 of file itkSize.h.

◆ size_type

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

Definition at line 255 of file itkSize.h.

◆ SizeType

template<unsigned int VDimension = 2>
using itk::Size< VDimension >::SizeType = Size<VDimension>

Compatible Size and value type alias

Definition at line 79 of file itkSize.h.

◆ SizeValueType

template<unsigned int VDimension = 2>
using itk::Size< VDimension >::SizeValueType = itk::SizeValueType

Definition at line 80 of file itkSize.h.

◆ value_type

template<unsigned int VDimension = 2>
using itk::Size< VDimension >::value_type = itk::SizeValueType

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

Definition at line 250 of file itkSize.h.

Member Function Documentation

◆ assign()

template<unsigned int VDimension = 2>
void itk::Size< 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 265 of file itkSize.h.

◆ at() [1/2]

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

Definition at line 367 of file itkSize.h.

◆ at() [2/2]

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

Definition at line 374 of file itkSize.h.

◆ back() [1/2]

template<unsigned int VDimension = 2>
reference itk::Size< VDimension >::back ( )
inlineconstexpr

Definition at line 393 of file itkSize.h.

◆ back() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Size< VDimension >::back ( ) const
inlineconstexpr

Definition at line 399 of file itkSize.h.

◆ begin() [1/2]

template<unsigned int VDimension = 2>
iterator itk::Size< VDimension >::begin ( )
inlineconstexpr

Definition at line 283 of file itkSize.h.

Referenced by itk::operator<(), and itk::operator==().

◆ begin() [2/2]

template<unsigned int VDimension = 2>
const_iterator itk::Size< VDimension >::begin ( ) const
inlineconstexpr

Definition at line 289 of file itkSize.h.

◆ CalculateProductOfElements()

template<unsigned int VDimension = 2>
SizeValueType itk::Size< VDimension >::CalculateProductOfElements ( ) const
inlinenodiscardconstexpr

Multiplies all elements. Yields the number of pixels of an image of this size.

Definition at line 216 of file itkSize.h.

◆ cbegin()

template<unsigned int VDimension = 2>
const_iterator itk::Size< VDimension >::cbegin ( ) const
inlineconstexpr

Definition at line 277 of file itkSize.h.

◆ cend()

template<unsigned int VDimension = 2>
const_iterator itk::Size< VDimension >::cend ( ) const
inlineconstexpr

Definition at line 295 of file itkSize.h.

◆ data() [1/2]

template<unsigned int VDimension = 2>
SizeValueType * itk::Size< VDimension >::data ( )
inline

Definition at line 405 of file itkSize.h.

◆ data() [2/2]

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

Definition at line 411 of file itkSize.h.

◆ empty()

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

Definition at line 349 of file itkSize.h.

◆ end() [1/2]

template<unsigned int VDimension = 2>
iterator itk::Size< VDimension >::end ( )
inlineconstexpr

Definition at line 301 of file itkSize.h.

Referenced by itk::operator<(), and itk::operator==().

◆ end() [2/2]

template<unsigned int VDimension = 2>
const_iterator itk::Size< VDimension >::end ( ) const
inlineconstexpr

Definition at line 307 of file itkSize.h.

◆ ExceptionThrowingBoundsCheck()

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

Definition at line 418 of file itkSize.h.

◆ Fill()

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

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

Definition at line 209 of file itkSize.h.

◆ Filled()

template<unsigned int VDimension = 2>
static constexpr Self itk::Size< VDimension >::Filled ( const SizeValueType value)
inlinestaticconstexpr

Returns a Size object, filled with the specified value for each element.

Definition at line 430 of file itkSize.h.

◆ front() [1/2]

template<unsigned int VDimension = 2>
reference itk::Size< VDimension >::front ( )
inlineconstexpr

Definition at line 381 of file itkSize.h.

◆ front() [2/2]

template<unsigned int VDimension = 2>
const_reference itk::Size< VDimension >::front ( ) const
inlineconstexpr

Definition at line 387 of file itkSize.h.

◆ GetElement()

template<unsigned int VDimension = 2>
SizeValueType itk::Size< 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
GetSize()
SetElement()

Definition at line 201 of file itkSize.h.

◆ GetSize()

template<unsigned int VDimension = 2>
const SizeValueType * itk::Size< VDimension >::GetSize ( ) const
inline

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

See also
SetSize
Examples
Examples/Segmentation/HoughTransform2DLinesImageFilter.cxx.

Definition at line 167 of file itkSize.h.

◆ GetSizeDimension()

template<unsigned int VDimension = 2>
static constexpr unsigned int itk::Size< VDimension >::GetSizeDimension ( )
inlinestaticconstexpr

Get the dimension.

Definition at line 87 of file itkSize.h.

◆ max_size()

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

Definition at line 343 of file itkSize.h.

◆ operator*()

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

Multiply two sizes (elementwise product).

Definition at line 142 of file itkSize.h.

◆ operator*=()

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

Multiply two sizes (elementwise product).

Definition at line 155 of file itkSize.h.

◆ operator+()

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

Add two sizes.

Definition at line 94 of file itkSize.h.

◆ operator+=()

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

Increment size by a size.

Definition at line 107 of file itkSize.h.

◆ operator-()

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

Subtract two sizes.

Definition at line 118 of file itkSize.h.

◆ operator-=()

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

Decrement size by a size.

Definition at line 131 of file itkSize.h.

◆ operator[]() [1/2]

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

Definition at line 355 of file itkSize.h.

◆ operator[]() [2/2]

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

Definition at line 361 of file itkSize.h.

◆ rbegin() [1/2]

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

Definition at line 313 of file itkSize.h.

◆ rbegin() [2/2]

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

Definition at line 319 of file itkSize.h.

◆ rend() [1/2]

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

Definition at line 325 of file itkSize.h.

◆ rend() [2/2]

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

Definition at line 331 of file itkSize.h.

◆ SetElement()

template<unsigned int VDimension = 2>
void itk::Size< VDimension >::SetElement ( unsigned long element,
SizeValueType 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
SetSize()
GetElement()

Definition at line 189 of file itkSize.h.

◆ SetSize()

template<unsigned int VDimension = 2>
void itk::Size< VDimension >::SetSize ( const SizeValueType val[VDimension])
inline

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

See also
GetSize

Definition at line 177 of file itkSize.h.

◆ size()

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

Definition at line 337 of file itkSize.h.

◆ swap()

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

Definition at line 271 of file itkSize.h.

Member Data Documentation

◆ Dimension

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

Dimension constant

Definition at line 83 of file itkSize.h.

◆ m_InternalArray


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