#include <itkOffset.h>
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.
Definition at line 66 of file itkOffset.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 | OffsetType = Offset<VDimension> |
using | OffsetValueType = itk::OffsetValueType |
using | reference = value_type & |
using | reverse_iterator = std::reverse_iterator<iterator> |
using | Self = Offset |
using | size_type = unsigned int |
using | value_type = itk::OffsetValueType |
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 const_iterator | cbegin () const |
constexpr const_iterator | cend () const |
template<typename TCoordinate> | |
void | CopyWithCast (const FixedArray< TCoordinate, VDimension > &point) |
template<typename TCoordinate> | |
void | CopyWithRound (const FixedArray< TCoordinate, VDimension > &point) |
OffsetValueType * | data () |
const OffsetValueType * | data () const |
constexpr bool | empty () const |
constexpr iterator | end () |
constexpr const_iterator | end () const |
void | Fill (OffsetValueType value) |
constexpr reference | front () |
constexpr const_reference | front () const |
OffsetValueType | GetElement (unsigned long element) const |
const OffsetValueType * | GetOffset () const |
constexpr size_type | max_size () const |
const Self | operator+ (const Self &vec) const |
const Self | operator+ (const Size< VDimension > &sz) const |
const Self & | operator+= (const Self &vec) |
const Self & | operator+= (const Size< VDimension > &sz) |
const Self | operator- (const Self &vec) const |
const Self & | operator-= (const Self &vec) |
const Self & | operator-= (const Size< VDimension > &sz) |
reference | operator[] (size_type pos) |
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, OffsetValueType val) |
void | SetOffset (const OffsetValueType val[VDimension]) |
constexpr size_type | size () const |
void | swap (Offset &other) noexcept |
Static Public Member Functions | |
static Self | GetBasisOffset (unsigned int dim) |
static constexpr unsigned int | GetOffsetDimension () |
Public Attributes | |
OffsetValueType | m_InternalArray [VDimension] |
Static Public Attributes | |
static constexpr unsigned int | Dimension = VDimension |
Private Member Functions | |
void | ExceptionThrowingBoundsCheck (size_type pos) const |
using itk::Offset< VDimension >::const_iterator = const value_type * |
Definition at line 279 of file itkOffset.h.
using itk::Offset< VDimension >::const_reference = const value_type & |
Definition at line 277 of file itkOffset.h.
using itk::Offset< VDimension >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 283 of file itkOffset.h.
using itk::Offset< VDimension >::difference_type = ptrdiff_t |
Definition at line 281 of file itkOffset.h.
using itk::Offset< VDimension >::iterator = value_type * |
Definition at line 278 of file itkOffset.h.
using itk::Offset< VDimension >::OffsetType = Offset<VDimension> |
Compatible Offset and value type alias.
Definition at line 76 of file itkOffset.h.
using itk::Offset< VDimension >::OffsetValueType = itk::OffsetValueType |
Definition at line 77 of file itkOffset.h.
using itk::Offset< VDimension >::reference = value_type & |
Definition at line 276 of file itkOffset.h.
using itk::Offset< VDimension >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 282 of file itkOffset.h.
using itk::Offset< VDimension >::Self = Offset |
Standard class type aliases.
Definition at line 73 of file itkOffset.h.
using itk::Offset< VDimension >::size_type = unsigned int |
Definition at line 280 of file itkOffset.h.
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 275 of file itkOffset.h.
|
inline |
Mirror behavior of the std::array manipulations See std::array for documentation on these methods
Definition at line 290 of file itkOffset.h.
|
inline |
Definition at line 392 of file itkOffset.h.
|
inline |
Definition at line 399 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 418 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 424 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 308 of file itkOffset.h.
Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::RectangularImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::operator<(), and itk::operator==().
|
inlineconstexpr |
Definition at line 314 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 302 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 320 of file itkOffset.h.
|
inline |
Copy values from a FixedArray by casting each one of the components
Definition at line 254 of file itkOffset.h.
|
inline |
Copy values from a FixedArray by rounding each one of the components
Definition at line 243 of file itkOffset.h.
|
inline |
Definition at line 430 of file itkOffset.h.
Referenced by itk::ImageRegionRange< InputImageType >::ComputeOffset().
|
inline |
Definition at line 436 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 374 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 326 of file itkOffset.h.
Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets(), itk::operator<(), and itk::operator==().
|
inlineconstexpr |
Definition at line 332 of file itkOffset.h.
|
inlineprivate |
Definition at line 443 of file itkOffset.h.
|
inline |
Set one value for the offset in all dimensions. Useful for initializing an offset to zero.
Definition at line 218 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 406 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 412 of file itkOffset.h.
|
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 455 of file itkOffset.h.
|
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.
Definition at line 210 of file itkOffset.h.
|
inline |
Get the offset. This provides a read only pointer to the offset.
Definition at line 176 of file itkOffset.h.
|
inlinestaticconstexpr |
Get the dimension (size) of the index.
Definition at line 84 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 368 of file itkOffset.h.
|
inline |
Add two offsets.
Definition at line 92 of file itkOffset.h.
|
inline |
Add a size to an offset.
Definition at line 105 of file itkOffset.h.
|
inline |
Increment offset by an offset.
Definition at line 153 of file itkOffset.h.
|
inline |
Increment index by a size.
Definition at line 118 of file itkOffset.h.
|
inline |
Subtract two offsets.
Definition at line 140 of file itkOffset.h.
|
inline |
Decrement offset by an offset.
Definition at line 164 of file itkOffset.h.
|
inline |
Decrement index by a size.
Definition at line 129 of file itkOffset.h.
|
inline |
Definition at line 380 of file itkOffset.h.
|
inline |
Definition at line 386 of file itkOffset.h.
|
inline |
Definition at line 338 of file itkOffset.h.
|
inline |
Definition at line 344 of file itkOffset.h.
|
inline |
Definition at line 350 of file itkOffset.h.
|
inline |
Definition at line 356 of file itkOffset.h.
|
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.
Definition at line 198 of file itkOffset.h.
|
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.
Definition at line 186 of file itkOffset.h.
|
inlineconstexpr |
Definition at line 362 of file itkOffset.h.
|
inlinenoexcept |
Definition at line 296 of file itkOffset.h.
|
staticconstexpr |
Dimension constant
Definition at line 80 of file itkOffset.h.
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 238 of file itkOffset.h.
Referenced by operator+(), operator+=(), itk::Index< VDimension >::operator-(), operator-(), and operator-=().