|
ITK
6.0.0
Insight Toolkit
|
Go to the documentation of this file.
65 template <
unsigned int VDimension = 2>
66 struct 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 TCoordinate>
251 for (
unsigned int i = 0; i < VDimension; ++i)
253 m_InternalArray[i] = Math::Round<OffsetValueType>(
point[i]);
259 template <
typename TCoordinate>
263 for (
unsigned int i = 0; i < VDimension; ++i)
265 m_InternalArray[i] = static_cast<OffsetValueType>(
point[i]);
274 GetBasisOffset(
unsigned int dim);
300 std::fill_n(begin(), size(), newValue);
306 std::swap(m_InternalArray, other.m_InternalArray);
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
390 return m_InternalArray[pos];
396 return m_InternalArray[pos];
402 ExceptionThrowingBoundsCheck(pos);
403 return m_InternalArray[pos];
409 ExceptionThrowingBoundsCheck(pos);
410 return m_InternalArray[pos];
419 constexpr const_reference
428 return VDimension ? *(end() - 1) : *end();
431 constexpr const_reference
434 return VDimension ? *(end() - 1) : *end();
440 return &m_InternalArray[0];
446 return &m_InternalArray[0];
453 if (pos >= VDimension)
455 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
461 template <
unsigned int VDimension>
470 template <
unsigned int VDimension>
475 const unsigned int dimlim = VDimension - 1;
476 for (
unsigned int i = 0; i < dimlim; ++i)
478 os << ind[i] <<
", ";
480 if constexpr (VDimension >= 1)
482 os << ind[VDimension - 1];
490 template <
unsigned int VDimension>
497 template <
unsigned int VDimension>
501 return !(one == two);
504 template <
unsigned int VDimension>
508 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
511 template <
unsigned int VDimension>
518 template <
unsigned int VDimension>
525 template <
unsigned int VDimension>
533 template <
unsigned int VDimension>
537 std::swap(one.m_InternalArray, two.m_InternalArray);
const Self & operator-=(const Self &vec)
const OffsetValueType * GetOffset() const
void Fill(OffsetValueType value)
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr const_reference back() const
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
Represent a n-dimensional size (bounds) of a n-dimensional image.
constexpr iterator begin()
void SetOffset(const OffsetValueType val[VDimension])
reverse_iterator rbegin()
const_reference operator[](size_type pos) const
void swap(Offset &other) noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
static Self GetBasisOffset(unsigned int dim)
constexpr bool empty() const
constexpr reference front()
const value_type & const_reference
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
const_reverse_iterator rend() const
void CopyWithCast(const FixedArray< TCoordinate, VDimension > &point)
itk::OffsetValueType value_type
reference operator[](size_type pos)
static constexpr unsigned int GetOffsetDimension()
const Self & operator-=(const Size< VDimension > &sz)
std::reverse_iterator< iterator > reverse_iterator
void swap(Offset< VDimension > &one, Offset< VDimension > &two) noexcept
const OffsetValueType * data() const
constexpr const_iterator begin() const
constexpr const_iterator cbegin() const
ptrdiff_t difference_type
*par Constraints *The filter requires an 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
constexpr size_type size() const
const Self & operator+=(const Self &vec)
void CopyWithRound(const FixedArray< TCoordinate, VDimension > &point)
const Self & operator+=(const Size< VDimension > &sz)
void assign(const value_type &newValue)
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr const_iterator cend() const
constexpr size_type max_size() const
OffsetValueType m_InternalArray[VDimension]
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
Simulate a standard C array with copy semantics.
const Self operator-(const Self &vec) const
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
itk::OffsetValueType OffsetValueType
const Self operator+(const Size< VDimension > &sz) const
const Self operator+(const Self &vec) const
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
void swap(Array< T > &a, Array< T > &b) noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
const_reverse_iterator rbegin() const
reference at(size_type pos)
constexpr reference back()
OffsetValueType GetElement(unsigned long element) const
void ExceptionThrowingBoundsCheck(size_type pos) const
const_reference at(size_type pos) const
constexpr const_reference front() const
constexpr unsigned int Dimension
constexpr const_iterator end() const
const value_type * const_iterator
void SetElement(unsigned long element, OffsetValueType val)