65template <
unsigned int VDimension = 2>
66struct ITK_TEMPLATE_EXPORT
Offset final
80 static constexpr unsigned int Dimension = VDimension;
83 static constexpr unsigned int
96 for (
unsigned int i = 0; i < VDimension; ++i)
109 for (
unsigned int i = 0; i < VDimension; ++i)
111 result[i] = m_InternalArray[i] + sz[i];
120 for (
unsigned int i = 0; i < VDimension; ++i)
122 m_InternalArray[i] += sz[i];
132 for (
unsigned int i = 0; i < VDimension; ++i)
134 m_InternalArray[i] -= sz[i];
146 for (
unsigned int i = 0; i < VDimension; ++i)
157 for (
unsigned int i = 0; i < VDimension; ++i)
169 for (
unsigned int i = 0; i < VDimension; ++i)
183 return m_InternalArray;
193 std::copy_n(val, VDimension, m_InternalArray);
205 m_InternalArray[element] = val;
217 return m_InternalArray[element];
225 std::fill_n(begin(), size(), value);
242 static_assert(VDimension > 0,
"Error: Only positive value sized VDimension allowed");
247 template <
typename TCoordRep>
251 for (
unsigned int i = 0; i < VDimension; ++i)
253 m_InternalArray[i] = Math::Round<OffsetValueType>(
point[i]);
259 template <
typename TCoordRep>
263 for (
unsigned int i = 0; i < VDimension; ++i)
300 std::fill_n(begin(), size(), newValue);
309 constexpr const_iterator
312 return &m_InternalArray[0];
318 return &m_InternalArray[0];
321 constexpr const_iterator
324 return &m_InternalArray[0];
327 constexpr const_iterator
330 return &m_InternalArray[VDimension];
336 return &m_InternalArray[VDimension];
339 constexpr const_iterator
342 return &m_InternalArray[VDimension];
351 const_reverse_iterator
363 const_reverse_iterator
394 ExceptionThrowingBoundsCheck(pos);
395 return m_InternalArray[pos];
401 ExceptionThrowingBoundsCheck(pos);
402 return m_InternalArray[pos];
411 constexpr const_reference
420 return VDimension ? *(end() - 1) : *end();
423 constexpr const_reference
426 return VDimension ? *(end() - 1) : *end();
432 return &m_InternalArray[0];
438 return &m_InternalArray[0];
445 if (pos >= VDimension)
447 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
453template <
unsigned int VDimension>
462template <
unsigned int VDimension>
467 unsigned int dimlim = VDimension - 1;
468 for (
unsigned int i = 0; i < dimlim; ++i)
470 os << ind[i] <<
", ";
472 if constexpr (VDimension >= 1)
474 os << ind[VDimension - 1];
482template <
unsigned int VDimension>
489template <
unsigned int VDimension>
493 return !(one == two);
496template <
unsigned int VDimension>
500 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
503template <
unsigned int VDimension>
510template <
unsigned int VDimension>
517template <
unsigned int VDimension>
525template <
unsigned int VDimension>
Pixel-wise addition of two images.
Simulate a standard C array with copy semantics.
constexpr unsigned int Dimension
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
bool operator!=(const Offset< VDimension > &one, const Offset< VDimension > &two)
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
bool operator==(const Offset< VDimension > &one, const Offset< VDimension > &two)
bool operator>(const Offset< VDimension > &one, const Offset< VDimension > &two)
bool operator>=(const Offset< VDimension > &one, const Offset< VDimension > &two)
std::ostream & operator<<(std::ostream &os, const Offset< VDimension > &ind)
void swap(Offset< VDimension > &one, Offset< VDimension > &two)
bool operator<=(const Offset< VDimension > &one, const Offset< VDimension > &two)
bool operator<(const Offset< VDimension > &one, const Offset< VDimension > &two)
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
ptrdiff_t difference_type
constexpr reference back()
const Self operator-(const Self &vec) const
constexpr const_reference back() const
void CopyWithRound(const FixedArray< TCoordRep, VDimension > &point)
const value_type & const_reference
reverse_iterator rbegin()
constexpr bool empty() const
constexpr iterator begin()
static constexpr unsigned int GetOffsetDimension()
const Self & operator+=(const Self &vec)
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr reference front()
void SetElement(unsigned long element, OffsetValueType val)
const_reference operator[](size_type pos) const
const Self operator+(const Size< VDimension > &sz) const
const_reverse_iterator rbegin() const
static Self GetBasisOffset(unsigned int dim)
void SetOffset(const OffsetValueType val[VDimension])
itk::OffsetValueType OffsetValueType
const_reference at(size_type pos) const
const Self & operator-=(const Self &vec)
const value_type * const_iterator
constexpr const_reference front() const
constexpr const_iterator end() const
constexpr size_type max_size() const
void assign(const value_type &newValue)
const Self operator+(const Self &vec) const
void ExceptionThrowingBoundsCheck(size_type pos) const
constexpr const_iterator cbegin() const
const OffsetValueType * data() const
const Self & operator-=(const Size< VDimension > &sz)
void Fill(OffsetValueType value)
itk::OffsetValueType value_type
void CopyWithCast(const FixedArray< TCoordRep, VDimension > &point)
const_reverse_iterator rend() const
reference operator[](size_type pos)
reference at(size_type pos)
constexpr size_type size() const
OffsetValueType m_InternalArray[VDimension]
const OffsetValueType * GetOffset() const
constexpr const_iterator begin() const
constexpr const_iterator cend() const
OffsetValueType GetElement(unsigned long element) const
std::reverse_iterator< iterator > reverse_iterator
const Self & operator+=(const Size< VDimension > &sz)