#include <itkIndex.h>
Index is a templated class to represent a multi-dimensional index, i.e. (i,j,k,...). Index is templated over the dimension of the index. ITK assumes the first element of an index is the fastest moving index.
For efficiency sake, Index does not define a default constructor, a copy constructor, or an operator=. We rely on the compiler to provide efficient bitwise copies.
Index is an "aggregate" class. Its data is public (m_Index) allowing for fast and convenient instantiations/assignments.
The following syntax for assigning an index is allowed/suggested:
Index<3> index = {{5, 2, 7}};
The double braces {{ and }} are needed to prevent a compiler warning about a partly bracketed initializer.
Definition at line 67 of file itkIndex.h.
Public Types | |
typedef Index< VIndexDimension > | IndexType |
typedef long | IndexValueType |
typedef Functor::IndexLexicographicCompare < VIndexDimension > | LexicographicCompare |
typedef Offset< VIndexDimension > | OffsetType |
typedef OffsetType::OffsetValueType | OffsetValueType |
typedef Index | Self |
typedef Size< VIndexDimension > | SizeType |
Public Member Functions | |
void | Fill (IndexValueType value) |
IndexValueType | GetElement (unsigned long element) |
const IndexValueType * | GetIndex () const |
IndexValueType | operator[] (unsigned int dim) const |
IndexValueType & | operator[] (unsigned int dim) |
void | SetElement (unsigned long element, IndexValueType val) |
void | SetIndex (const IndexValueType val[VIndexDimension]) |
template<class TCoordRep> | |
void | CopyWithCast (const FixedArray< TCoordRep, VIndexDimension > &point) |
template<class TCoordRep> | |
void | CopyWithRound (const FixedArray< TCoordRep, VIndexDimension > &point) |
bool | operator!= (const Self &vec) const |
const Self | operator* (const SizeType &vec) const |
const Self | operator+ (const OffsetType &offset) const |
const Self | operator+ (const SizeType &size) const |
const Self & | operator+= (const OffsetType &offset) |
const Self & | operator+= (const SizeType &size) |
const OffsetType | operator- (const Self &vec) const |
const Self | operator- (const OffsetType &off) const |
const Self | operator- (const SizeType &size) const |
const Self & | operator-= (const OffsetType &offset) |
const Self & | operator-= (const SizeType &size) |
bool | operator== (const Self &vec) const |
Static Public Member Functions | |
static Self | GetBasisIndex (unsigned int dim) |
static unsigned int | GetIndexDimension () |
Public Attributes | |
IndexValueType | m_Index [VIndexDimension] |
typedef Index<VIndexDimension> itk::Index< VIndexDimension >::IndexType |
Compatible Index and value typedef
Definition at line 73 of file itkIndex.h.
typedef long itk::Index< VIndexDimension >::IndexValueType |
Definition at line 74 of file itkIndex.h.
typedef Functor::IndexLexicographicCompare<VIndexDimension> itk::Index< VIndexDimension >::LexicographicCompare |
Lexicographic ordering functor type.
Definition at line 87 of file itkIndex.h.
typedef Offset<VIndexDimension> itk::Index< VIndexDimension >::OffsetType |
Compatible Offset and Offset value typedef.
Definition at line 83 of file itkIndex.h.
typedef OffsetType::OffsetValueType itk::Index< VIndexDimension >::OffsetValueType |
Definition at line 84 of file itkIndex.h.
typedef Index itk::Index< VIndexDimension >::Self |
Standard class typedefs.
Definition at line 70 of file itkIndex.h.
typedef Size<VIndexDimension> itk::Index< VIndexDimension >::SizeType |
Compatible Size typedef.
Definition at line 80 of file itkIndex.h.
void itk::Index< VIndexDimension >::CopyWithCast | ( | const FixedArray< TCoordRep, VIndexDimension > & | point | ) | [inline] |
Copy values from a FixedArray by casting each one of the components
Definition at line 307 of file itkIndex.h.
void itk::Index< VIndexDimension >::CopyWithRound | ( | const FixedArray< TCoordRep, VIndexDimension > & | point | ) | [inline] |
Copy values from a FixedArray by rounding each one of the components
Definition at line 289 of file itkIndex.h.
void itk::Index< VIndexDimension >::Fill | ( | IndexValueType | value | ) | [inline] |
Set one value for the index in all dimensions. Useful for initializing an offset to zero.
Definition at line 265 of file itkIndex.h.
Referenced by itk::ImageIORegionAdaptor< VDimension >::Convert().
Index< VIndexDimension > itk::Index< VIndexDimension >::GetBasisIndex | ( | unsigned int | dim | ) | [inline, 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, ..., VIndexDimension-1.
Definition at line 360 of file itkIndex.h.
References itk::Index< VIndexDimension >::m_Index.
IndexValueType itk::Index< VIndexDimension >::GetElement | ( | unsigned long | element | ) | [inline] |
Gets the value of one of the elements in the index. 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 255 of file itkIndex.h.
const IndexValueType* itk::Index< VIndexDimension >::GetIndex | ( | void | ) | const [inline] |
Get the index. This provides a read only reference to the index.
Definition at line 231 of file itkIndex.h.
static unsigned int itk::Index< VIndexDimension >::GetIndexDimension | ( | ) | [inline, static] |
Get the dimension (size) of the index.
Definition at line 77 of file itkIndex.h.
bool itk::Index< VIndexDimension >::operator!= | ( | const Self & | vec | ) | const [inline] |
Compare two indices.
Definition at line 209 of file itkIndex.h.
const Self itk::Index< VIndexDimension >::operator* | ( | const SizeType & | vec | ) | const [inline] |
Multiply an index by a size (elementwise product). This method models a random access Index.
Definition at line 187 of file itkIndex.h.
const Self itk::Index< VIndexDimension >::operator+ | ( | const OffsetType & | offset | ) | const [inline] |
Add an offset to an index.
Definition at line 133 of file itkIndex.h.
const Self itk::Index< VIndexDimension >::operator+ | ( | const SizeType & | size | ) | const [inline] |
Add a size to an index. This method models a random access Index.
Definition at line 91 of file itkIndex.h.
const Self& itk::Index< VIndexDimension >::operator+= | ( | const OffsetType & | offset | ) | [inline] |
Increment index by an offset. This method models a random access Index.
Definition at line 144 of file itkIndex.h.
const Self& itk::Index< VIndexDimension >::operator+= | ( | const SizeType & | size | ) | [inline] |
Increment index by a size. This method models a random access Index.
Definition at line 102 of file itkIndex.h.
const OffsetType itk::Index< VIndexDimension >::operator- | ( | const Self & | vec | ) | const [inline] |
Subtract two indices. This method models a random access Index.
Definition at line 175 of file itkIndex.h.
const Self itk::Index< VIndexDimension >::operator- | ( | const OffsetType & | off | ) | const [inline] |
Subtract an offset from an index.
Definition at line 164 of file itkIndex.h.
const Self itk::Index< VIndexDimension >::operator- | ( | const SizeType & | size | ) | const [inline] |
Subtract a size from an index. This method models a random access Index.
Definition at line 112 of file itkIndex.h.
const Self& itk::Index< VIndexDimension >::operator-= | ( | const OffsetType & | offset | ) | [inline] |
Decrement index by an offset. This method models a random access Index.
Definition at line 154 of file itkIndex.h.
const Self& itk::Index< VIndexDimension >::operator-= | ( | const SizeType & | size | ) | [inline] |
Decrement index by a size. This method models a random access Index.
Definition at line 123 of file itkIndex.h.
bool itk::Index< VIndexDimension >::operator== | ( | const Self & | vec | ) | const [inline] |
Compare two indices.
Definition at line 198 of file itkIndex.h.
IndexValueType itk::Index< VIndexDimension >::operator[] | ( | unsigned int | dim | ) | const [inline] |
Access an element of the index. Elements are numbered 0, ..., VIndexDimension-1. This version can only be an rvalue. No bounds checking is performed.
Definition at line 226 of file itkIndex.h.
IndexValueType& itk::Index< VIndexDimension >::operator[] | ( | unsigned int | dim | ) | [inline] |
Access an element of the index. Elements are numbered 0, ..., VIndexDimension-1. No bounds checking is performed.
Definition at line 220 of file itkIndex.h.
void itk::Index< VIndexDimension >::SetElement | ( | unsigned long | element, | |
IndexValueType | val | |||
) | [inline] |
Sets the value of one of the elements in the index. 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 246 of file itkIndex.h.
void itk::Index< VIndexDimension >::SetIndex | ( | const IndexValueType | val[VIndexDimension] | ) | [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 237 of file itkIndex.h.
IndexValueType itk::Index< VIndexDimension >::m_Index[VIndexDimension] |
Index is an "aggregate" class. Its data is public (m_Index) allowing for fast and convenient instantiations/assignments.
The following syntax for assigning an index is allowed/suggested: Index<3> index = {5, 2, 7};
Definition at line 273 of file itkIndex.h.
Referenced by itk::Index< itkGetStaticConstMacro(Dimension)>::CopyWithCast(), itk::Index< itkGetStaticConstMacro(Dimension)>::CopyWithRound(), itk::Index< itkGetStaticConstMacro(Dimension)>::Fill(), itk::Index< VIndexDimension >::GetBasisIndex(), itk::Index< itkGetStaticConstMacro(Dimension)>::GetElement(), itk::Index< itkGetStaticConstMacro(Dimension)>::GetIndex(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator!=(), itk::Functor::IndexLexicographicCompare< VIndexDimension >::operator()(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator*(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator+(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator+=(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator-(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator-=(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator==(), itk::Index< itkGetStaticConstMacro(Dimension)>::operator[](), itk::Index< itkGetStaticConstMacro(Dimension)>::SetElement(), and itk::Index< itkGetStaticConstMacro(Dimension)>::SetIndex().