66 template <
unsigned int VDimension = 2>
67 struct ITK_TEMPLATE_EXPORT
Offset final
81 static constexpr
unsigned int Dimension = VDimension;
95 for(
unsigned int i = 0; i < VDimension; i++ )
107 for(
unsigned int i = 0; i < VDimension; i++ )
109 result[i] = m_InternalArray[i] + sz[i];
117 for(
unsigned int i = 0; i < VDimension; i++ )
119 m_InternalArray[i] += sz[i];
128 for(
unsigned int i = 0; i < VDimension; i++ )
130 m_InternalArray[i] -= sz[i];
141 for(
unsigned int i = 0; i < VDimension; i++ )
151 for(
unsigned int i = 0; i < VDimension; i++ )
162 for(
unsigned int i = 0; i < VDimension; i++ )
175 return m_InternalArray;
197 m_InternalArray[element] = val;
208 return m_InternalArray[element];
215 std::fill_n(begin(), size(), value);
232 static_assert( VDimension > 0,
"Error: Only positive value sized VDimension allowed" );
237 template <
typename TCoordRep>
240 for(
unsigned int i = 0; i < VDimension; ++i )
242 m_InternalArray[i] = Math::Round<OffsetValueType>(point[i]);
248 template <
typename TCoordRep>
251 for(
unsigned int i = 0; i < VDimension; ++i )
261 static Self GetBasisOffset(
unsigned int dim);
286 std::fill_n(begin(), size(), newValue);
291 std::swap_ranges(begin(), end(), other.
begin() );
296 return iterator(&m_InternalArray[0]);
306 return iterator(&m_InternalArray[VDimension]);
351 return m_InternalArray[pos];
356 return m_InternalArray[pos];
361 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
366 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
381 return VDimension ? *(end() - 1) : *end();
386 return VDimension ? *(end() - 1) : *end();
391 return &m_InternalArray[0];
396 return &m_InternalArray[0];
402 if( pos >= VDimension )
404 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
410 template <
unsigned int VDimension>
422 template <
unsigned int VDimension>
423 std::ostream & operator<<(std::ostream & os, const Offset<VDimension> & ind)
426 unsigned int dimlim = VDimension - 1;
427 for(
unsigned int i = 0; i < dimlim; ++i )
429 os << ind[i] <<
", ";
431 if( VDimension >= 1 )
433 os << ind[VDimension - 1];
441 template <
unsigned int VDimension>
448 template <
unsigned int VDimension>
452 return !(one == two);
455 template <
unsigned int VDimension>
459 return std::lexicographical_compare(one.begin(), one.end(),
460 two.begin(), two.end() );
463 template <
unsigned int VDimension>
470 template <
unsigned int VDimension>
477 template <
unsigned int VDimension>
485 template <
unsigned int VDimension>
493 template<
unsigned int VDimension >
const Self operator+(const Self &vec) const
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
void ExceptionThrowingBoundsCheck(size_type pos) const
std::reverse_iterator< const_iterator > const_reverse_iterator
void SetOffset(const OffsetValueType val[VDimension])
const_iterator begin() const
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
std::ptrdiff_t difference_type
constexpr bool empty() const
const OffsetValueType * GetOffset() const
const_reference at(size_type pos) const
const value_type * const_iterator
const OffsetValueType * data() const
constexpr unsigned int Dimension
const_reverse_iterator rbegin() const
Simulate a standard C array with copy semnatics.
reference at(size_type pos)
void swap(Array< T > &a, Array< T > &b)
const_iterator end() const
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
const_reverse_iterator rend() const
void assign(const value_type &newValue)
const Self & operator-=(const Self &vec)
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 Size< VDimension > &sz) const
const_reference back() const
reverse_iterator rbegin()
void CopyWithRound(const FixedArray< TCoordRep, VDimension > &point)
const value_type & const_reference
const_reference operator[](size_type pos) const
void CopyWithCast(const FixedArray< TCoordRep, VDimension > &point)
OffsetValueType GetElement(unsigned long element) const
const_reference front() const
static constexpr unsigned int GetOffsetDimension()
const Self operator-(const Self &vec)
reference operator[](size_type pos)
std::reverse_iterator< iterator > reverse_iterator
static Self GetBasisOffset(unsigned int dim)
::itk::OffsetValueType OffsetValueType
void Fill(OffsetValueType value)
const Self & operator-=(const Size< VDimension > &sz)
constexpr size_type max_size() const
void SetElement(unsigned long element, OffsetValueType val)
const Self & operator+=(const Self &vec)
constexpr size_type size() const
signed long OffsetValueType
const Self & operator+=(const Size< VDimension > &sz)
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)
::itk::OffsetValueType value_type
OffsetValueType m_InternalArray[VDimension]