65 template <
unsigned int VDimension = 2>
66 struct ITK_TEMPLATE_EXPORT
Index final
87 static constexpr
unsigned int Dimension = VDimension;
101 for(
unsigned int i = 0; i < VDimension; i++ )
103 result[i] = m_InternalArray[i] +
static_cast<IndexValueType>( sz[i] );
111 for(
unsigned int i = 0; i < VDimension; i++ )
125 for(
unsigned int i = 0; i < VDimension; i++ )
127 result[i] = m_InternalArray[i] -
static_cast<IndexValueType>( sz[i] );
135 for(
unsigned int i = 0; i < VDimension; i++ )
148 for(
unsigned int i = 0; i < VDimension; i++ )
150 result[i] = m_InternalArray[i] + offset[i];
158 for(
unsigned int i = 0; i < VDimension; i++ )
160 m_InternalArray[i] += offset[i];
169 for(
unsigned int i = 0; i < VDimension; i++ )
171 m_InternalArray[i] -= offset[i];
182 for(
unsigned int i = 0; i < VDimension; i++ )
194 for(
unsigned int i = 0; i < VDimension; i++ )
208 for(
unsigned int i = 0; i < VDimension; i++ )
219 return m_InternalArray;
241 m_InternalArray[element] = val;
252 return m_InternalArray[element];
259 std::fill_n(begin(), size(), value);
276 static_assert( VDimension > 0,
"Error: Only positive value sized VDimension allowed" );
281 template <
typename TCoordRep>
284 for(
unsigned int i = 0; i < VDimension; ++i )
286 m_InternalArray[i] = Math::Round<IndexValueType>(point[i]);
292 template <
typename TCoordRep>
295 for(
unsigned int i = 0; i < VDimension; ++i )
305 static Self GetBasisIndex(
unsigned int dim);
330 std::fill_n(begin(), size(), newValue);
335 std::swap_ranges(begin(), end(), other.
begin() );
340 return iterator(&m_InternalArray[0]);
350 return iterator(&m_InternalArray[VDimension]);
395 return m_InternalArray[pos];
400 return m_InternalArray[pos];
405 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
410 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
425 return VDimension ? *(end() - 1) : *end();
430 return VDimension ? *(end() - 1) : *end();
435 return &m_InternalArray[0];
440 return &m_InternalArray[0];
446 if( pos >= VDimension )
448 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
454 template <
unsigned int VDimension>
465 template <
unsigned int VDimension>
466 std::ostream & operator<<(std::ostream & os, const Index<VDimension> & obj)
469 for(
unsigned int i = 0; i + 1 < VDimension; ++i )
471 os << obj[i] <<
", ";
473 if( VDimension >= 1 )
475 os << obj[VDimension - 1];
483 template <
unsigned int VDimension>
490 template <
unsigned int VDimension>
494 return !(one == two);
497 template <
unsigned int VDimension>
501 return std::lexicographical_compare(one.begin(), one.end(),
502 two.begin(), two.end() );
505 template <
unsigned int VDimension>
512 template <
unsigned int VDimension>
519 template <
unsigned int VDimension>
527 template <
unsigned int VDimension>
535 template<
unsigned int VDimension >
std::reverse_iterator< const_iterator > const_reverse_iterator
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
std::reverse_iterator< iterator > reverse_iterator
Represent a n-dimensional index in a n-dimensional image.
constexpr bool empty() const
const Self & operator-=(const SizeType &sz)
std::ptrdiff_t difference_type
SizeValueType m_InternalArray[VDimension]
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
const OffsetType operator-(const Self &vec) const
::itk::OffsetValueType OffsetValueType
static constexpr unsigned int GetIndexDimension()
const Self & operator+=(const SizeType &sz)
reverse_iterator rbegin()
const value_type * const_iterator
const_reverse_iterator rend() const
void SetElement(unsigned long element, IndexValueType val)
constexpr unsigned int Dimension
Simulate a standard C array with copy semnatics.
const Self operator-(const SizeType &sz) const
const_reverse_iterator rbegin() const
IndexValueType m_InternalArray[VDimension]
void swap(Array< T > &a, Array< T > &b)
static Self GetBasisIndex(unsigned int dim)
const Self operator+(const OffsetType &offset) const
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr size_type max_size() const
const_iterator begin() const
const_reference operator[](size_type pos) const
const Self & operator-=(const OffsetType &offset)
signed long IndexValueType
Represent a n-dimensional size (bounds) of a n-dimensional image.
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image...
const Self operator*(const SizeType &vec) const
void ExceptionThrowingBoundsCheck(size_type pos) const
::itk::IndexValueType IndexValueType
void SetIndex(const IndexValueType val[VDimension])
const Self operator+(const SizeType &sz) const
const Self & operator+=(const OffsetType &offset)
constexpr size_type size() const
const_iterator end() const
void CopyWithCast(const FixedArray< TCoordRep, VDimension > &point)
const IndexValueType * data() const
void Fill(IndexValueType value)
void CopyWithRound(const FixedArray< TCoordRep, VDimension > &point)
const_reference back() const
const_reference front() const
IndexValueType GetElement(unsigned long element) const
reference at(size_type pos)
const IndexValueType * GetIndex() const
const_reference at(size_type pos) const
reference operator[](size_type pos)
::itk::IndexValueType value_type
signed long OffsetValueType
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)
const Self operator-(const OffsetType &off) const
void assign(const value_type &newValue)
const value_type & const_reference
OffsetValueType m_InternalArray[VDimension]