ITK  6.0.0
Insight Toolkit
itkVariableLengthVector.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkVariableLengthVector_h
19 #define itkVariableLengthVector_h
20 
21 #include <cassert>
22 #include <algorithm>
23 #include <type_traits>
24 #include "itkNumericTraits.h"
26 #include "itkIsNumber.h"
27 #include "itkPromoteType.h"
29 
30 namespace itk
31 {
32 
33 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
35 
90 template <typename TValue>
91 class ITK_TEMPLATE_EXPORT VariableLengthVector
92 {
93 public:
98 
111  {};
112 
127  {
128  bool
129  operator()(unsigned int itkNotUsed(newSize), unsigned int itkNotUsed(oldSize)) const
130  {
131  return true;
132  }
133  };
154  {
155  bool
156  operator()([[maybe_unused]] unsigned int newSize, [[maybe_unused]] unsigned int oldSize) const
157  {
158  itkAssertInDebugAndIgnoreInReleaseMacro(newSize == oldSize &&
159  "SetSize is expected to never change the VariableLengthVector size...");
160  return true;
161  }
162  };
183  {
184  bool
185  operator()(unsigned int newSize, unsigned int oldSize) const
186  {
187  return newSize != oldSize;
188  }
189  };
219  {
220  bool
221  operator()(unsigned int newSize, unsigned int oldSize) const
222  {
223  return newSize > oldSize;
224  }
225  };
247  {};
248 
271  {
272  template <typename TValue2>
273  void
274  operator()(unsigned int newSize, unsigned int oldSize, TValue2 * oldBuffer, TValue2 * newBuffer) const
275  {
276  itkAssertInDebugAndIgnoreInReleaseMacro(newBuffer);
277  const size_t nb = std::min(newSize, oldSize);
278  itkAssertInDebugAndIgnoreInReleaseMacro(nb == 0 || (nb > 0 && oldBuffer != nullptr));
279  std::copy_n(oldBuffer, nb, newBuffer);
280  }
281  };
301  {
302  template <typename TValue2>
303  void
304  operator()(unsigned int itkNotUsed(newSize),
305  unsigned int itkNotUsed(oldSize),
306  TValue2 * itkNotUsed(oldBuffer),
307  TValue2 * itkNotUsed(newBuffer)) const
308  {}
309  };
311 
315  using ValueType = TValue;
316  using ComponentType = TValue;
319 
321  using ElementIdentifier = unsigned int;
322 
329  VariableLengthVector() = default;
330 
339  explicit VariableLengthVector(unsigned int length);
340 
354  VariableLengthVector(ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
355 
375  VariableLengthVector(const ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
376 
396  template <typename T>
398  {
399  m_NumElements = v.Size();
400  m_LetArrayManageMemory = true;
401  if (m_NumElements != 0)
402  {
403  m_Data = this->AllocateElements(m_NumElements);
404  itkAssertInDebugAndIgnoreInReleaseMacro(m_Data != nullptr);
405  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
406  {
407  this->m_Data[i] = static_cast<ValueType>(v[i]);
408  }
409  }
410  else
411  {
412  m_Data = nullptr;
413  }
414  }
426 
435  void
436  Swap(Self & v) noexcept
437  {
438  itkAssertInDebugAndIgnoreInReleaseMacro(m_LetArrayManageMemory == v.m_LetArrayManageMemory);
439  using std::swap;
440  swap(v.m_Data, m_Data);
441  swap(v.m_NumElements, m_NumElements);
442  }
452  VariableLengthVector(Self && v) noexcept;
453 
462  Self &
463  operator=(Self && v) noexcept;
464 
481  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
483 
503  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
504  Self &
506 
510  void
511  Fill(TValue const & v);
512 
525  template <typename T>
526  Self &
528  {
529  // No self assignment test is done. Indeed:
530  // - the operator already resists self assignment through a strong exception
531  // guarantee
532  // - the test becomes a pessimization as we never write
533  // VLV<const TValue> vcref(v.GetDataPointer(), v.GetSize());
534  // ...;
535  // v = vcref;
536  ElementIdentifier const N = v.Size();
537  this->SetSize(N, DontShrinkToFit(), DumpOldValues());
538  for (ElementIdentifier i = 0; i < N; ++i)
539  {
540  this->m_Data[i] = static_cast<ValueType>(v[i]);
541  }
542  return *this;
543  }
561  Self &
562  operator=(const Self & v);
563 
572  Self &
573  FastAssign(const Self & v);
574 
582  Self &
583  operator=(TValue const & v);
584 
586  unsigned int
587  Size() const
588  {
589  return m_NumElements;
590  }
591  unsigned int
592  GetSize() const
593  {
594  return m_NumElements;
595  }
596  unsigned int
598  {
599  return m_NumElements;
600  }
604  TValue & operator[](unsigned int i) { return this->m_Data[i]; }
605 
607  TValue const & operator[](unsigned int i) const { return this->m_Data[i]; }
608 
610  const TValue &
611  GetElement(unsigned int i) const
612  {
613  return m_Data[i];
614  }
615 
617  void
618  SetElement(unsigned int i, const TValue & value)
619  {
620  m_Data[i] = value;
621  }
622 
656  template <typename TReallocatePolicy, typename TKeepValuesPolicy>
657  void
658  SetSize(unsigned int sz, TReallocatePolicy reallocatePolicy, TKeepValuesPolicy keepValues);
659 
670  void
671  SetSize(unsigned int sz, bool destroyExistingData = true)
672  {
673  // Stays compatible with previous code version
674  // And works around the fact C++03 template functions can't have default
675  // arguments on template types.
676  if (destroyExistingData)
677  {
678  SetSize(sz, AlwaysReallocate(), KeepOldValues());
679  }
680  else
681  {
682  SetSize(sz, ShrinkToFit(), KeepOldValues());
683  }
684  }
689  void
690  DestroyExistingData();
691 
704  void
705  SetData(TValue * datain, bool LetArrayManageMemory = false);
706 
721  void
722  SetData(TValue * datain, unsigned int sz, bool LetArrayManageMemory = false);
723 
735 
750  void
751  Reserve(ElementIdentifier size);
758  TValue *
759  AllocateElements(ElementIdentifier size) const;
760 
761  const TValue *
763  {
764  return m_Data;
765  }
766 
769  Self &
771  {
772  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
773  {
774  this->m_Data[i] -= static_cast<ValueType>(1.0);
775  }
776  return *this;
777  }
781  Self &
782  operator++() // prefix operator ++v;
783  {
784  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
785  {
786  this->m_Data[i] += static_cast<ValueType>(1.0);
787  }
788  return *this;
789  }
794  Self
795  operator--(int) // postfix operator v--;
796  {
797  Self tmp(*this);
800  --tmp;
801  return tmp;
802  }
803 
805  Self
806  operator++(int) // postfix operator v++;
807  {
808  Self tmp(*this);
811  ++tmp;
812  return tmp;
813  }
814 
823  template <typename T>
824  Self &
826  {
827  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
828  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
829  {
830  m_Data[i] -= static_cast<ValueType>(v[i]);
831  }
832  return *this;
833  }
837  Self &
838  operator-=(TValue s)
839  {
840  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
841  {
842  m_Data[i] -= s;
843  }
844  return *this;
845  }
856  template <typename T>
857  Self &
859  {
860  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
861  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
862  {
863  m_Data[i] += static_cast<ValueType>(v[i]);
864  }
865  return *this;
866  }
870  Self &
871  operator+=(TValue s)
872  {
873  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
874  {
875  m_Data[i] += s;
876  }
877  return *this;
878  }
890  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
891  Self &
893  {
894  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
895  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
896  {
897  m_Data[i] += static_cast<ValueType>(rhs[i]);
898  }
899  return *this;
900  }
912  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
913  Self &
915  {
916  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
917  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
918  {
919  m_Data[i] -= static_cast<ValueType>(rhs[i]);
920  }
921  return *this;
922  }
930  template <typename T>
931  Self &
933  {
934  const ValueType & sc = static_cast<ValueType>(s);
935  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
936  {
937  m_Data[i] *= sc;
938  }
939  return *this;
940  }
946  Self &
947  operator*=(TValue s)
948  {
949  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
950  {
951  m_Data[i] *= s;
952  }
953  return *this;
954  }
963  template <typename T>
964  Self &
966  {
967  const RealValueType sc = s;
968  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
969  {
970  m_Data[i] = static_cast<ValueType>(static_cast<RealValueType>(m_Data[i]) / sc);
971  }
972  return *this;
973  }
980  Self &
981  operator-(); // negation operator
982 
983  bool
984  operator==(const Self & v) const;
985 
986  ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self);
987 
989  RealValueType
990  GetNorm() const;
991 
993  RealValueType
994  GetSquaredNorm() const;
995 
997  bool
998  IsAProxy() const
999  {
1000  return !m_LetArrayManageMemory;
1001  }
1002 
1003 private:
1004  bool m_LetArrayManageMemory{ true }; // if true, the array is responsible
1005  // for memory of data
1006  TValue * m_Data{}; // Array to hold data
1007  ElementIdentifier m_NumElements{ 0 };
1008 };
1009 
1011 namespace mpl
1012 {
1022 template <typename T>
1023 struct IsArray : FalseType
1024 {};
1025 
1027 template <typename T>
1028 struct IsArray<itk::VariableLengthVector<T>> : TrueType
1029 {};
1030 
1031 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1032 struct IsArray<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>> : TrueType
1033 {};
1035 } // namespace mpl
1037 
1038 namespace Details
1039 {
1041 
1053 template <typename TExpr>
1054 struct GetType
1055 {
1056  using Type = TExpr;
1057 
1061  static Type
1062  Load(Type const & v, unsigned int itkNotUsed(idx))
1063  {
1064  return v;
1065  }
1066 };
1079 template <typename TExpr1, typename TExpr2>
1080 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>::Value, unsigned int>
1081 GetSize(TExpr1 const & lhs, [[maybe_unused]] TExpr2 const & rhs)
1082 {
1083  itkAssertInDebugAndIgnoreInReleaseMacro(lhs.Size() == rhs.Size());
1084  return lhs.Size();
1085 }
1088 
1098 template <typename TExpr1, typename TExpr2>
1099 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr1>, mpl::Not<mpl::IsArray<TExpr2>>>::Value, unsigned int>
1100 GetSize(TExpr1 const & lhs, TExpr2 const & itkNotUsed(rhs))
1101 {
1102  return lhs.Size();
1103 }
1104 
1114 template <typename TExpr1, typename TExpr2>
1115 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr2>, mpl::Not<mpl::IsArray<TExpr1>>>::Value, unsigned int>
1116 GetSize(TExpr1 const & itkNotUsed(lhs), TExpr2 const & rhs)
1117 {
1118  return rhs.Size();
1119 }
1120 
1121 template <typename T>
1122 struct GetType<VariableLengthVector<T>>
1123 {
1124  using Type = T;
1125  static Type
1126  Load(VariableLengthVector<T> const & v, unsigned int idx)
1127  {
1128  return v[idx];
1129  }
1130 };
1131 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1132 struct GetType<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>>
1133 {
1135  static Type
1136  Load(VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp> const & v, unsigned int idx)
1137  {
1138  return v[idx];
1139  }
1140 };
1142 
1143 namespace op
1144 {
1157 template <typename TExpr1, typename TExpr2>
1159  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>,
1160  mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1161  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1162 {};
1163 
1175 template <typename TExpr1, typename TExpr2>
1177  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1178  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1179 {};
1180 
1192 template <typename TExpr1, typename TExpr2>
1193 struct CanBeDivided : mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>
1194 {};
1195 
1196 } // namespace op
1197 } // namespace Details
1199 
1224 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1226 {
1227  VariableLengthVectorExpression(TExpr1 const & lhs, TExpr2 const & rhs)
1228  : m_lhs(lhs)
1229  , m_rhs(rhs)
1230  {
1231  // Not necessary actually as end-user/developer is not expected to
1232  // provide new BinaryOperations
1233  static_assert(std::is_base_of_v<Details::op::BinaryOperationConcept, TBinaryOp>,
1234  "The Binary Operation shall inherit from BinaryOperationConcept");
1235  }
1236 
1238  unsigned int
1239  Size() const
1240  {
1241  return Details::GetSize(m_lhs, m_rhs);
1242  }
1243 
1245  using ResType =
1246  typename mpl::PromoteType<typename Details::GetType<TExpr1>::Type, typename Details::GetType<TExpr2>::Type>::Type;
1249 
1260  ResType operator[](unsigned int idx) const
1261  {
1262  itkAssertInDebugAndIgnoreInReleaseMacro(idx < Size());
1263  return TBinaryOp::Apply(Details::GetType<TExpr1>::Load(m_lhs, idx), Details::GetType<TExpr2>::Load(m_rhs, idx));
1264  }
1268  RealValueType
1269  GetNorm() const;
1270 
1272  RealValueType
1273  GetSquaredNorm() const;
1274 
1275 private:
1276  TExpr1 const & m_lhs;
1277  TExpr2 const & m_rhs;
1278 };
1279 
1289 template <typename TExpr1, typename TExpr2>
1290 inline std::enable_if_t<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>::Value,
1292 operator+(TExpr1 const & lhs, TExpr2 const & rhs)
1293 {
1295 }
1296 
1306 template <typename TExpr1, typename TExpr2>
1307 inline std::enable_if_t<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>::Value,
1309 operator-(TExpr1 const & lhs, TExpr2 const & rhs)
1310 {
1312 }
1313 
1322 template <typename TExpr1, typename TExpr2>
1323 inline std::enable_if_t<Details::op::CanBeMultiplied<TExpr1, TExpr2>::Value,
1325 operator*(TExpr1 const & lhs, TExpr2 const & rhs)
1326 {
1328 }
1329 
1337 template <typename TExpr1, typename TExpr2>
1338 inline std::enable_if_t<Details::op::CanBeDivided<TExpr1, TExpr2>::Value,
1340 operator/(TExpr1 const & lhs, TExpr2 const & rhs)
1341 {
1343 }
1344 
1348 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1349 std::ostream &
1351 {
1352  os << '[';
1353  if (v.Size() != 0)
1354  {
1355  os << v[0];
1356  for (unsigned int i = 1, N = v.Size(); i != N; ++i)
1357  {
1358  os << ", " << v[i];
1359  }
1360  }
1361  return os << ']';
1362 }
1370 template <typename TExpr>
1371 inline std::enable_if_t<mpl::IsArray<TExpr>::Value, typename TExpr::RealValueType>
1372 GetNorm(TExpr const & v)
1373 {
1374  return static_cast<typename TExpr::RealValueType>(std::sqrt(static_cast<double>(GetSquaredNorm(v))));
1375 }
1376 
1382 template <typename TExpr>
1383 inline std::enable_if_t<mpl::IsArray<TExpr>::Value, typename TExpr::RealValueType>
1384 GetSquaredNorm(TExpr const & v)
1385 {
1386  using RealValueType = typename TExpr::RealValueType;
1387  RealValueType sum = 0.0;
1388  for (unsigned int i = 0, N = v.Size(); i < N; ++i)
1389  {
1390  const RealValueType value = v[i];
1391  sum += value * value;
1392  }
1393  return sum;
1394 }
1399 
1403 template <typename TValue>
1404 std::ostream &
1405 operator<<(std::ostream & os, const VariableLengthVector<TValue> & arr)
1406 {
1407  const unsigned int length = arr.Size();
1408  const int last = static_cast<unsigned int>(length) - 1;
1411  os << '[';
1412  for (int i = 0; i < last; ++i)
1413  {
1414  os << arr[i] << ", ";
1415  }
1416  if (length >= 1)
1417  {
1418  os << arr[last];
1419  }
1420  os << ']';
1421  return os;
1422 }
1424 
1427 
1445 template <typename T>
1446 inline void
1448 {
1449  l_.Swap(r_);
1450 }
1452 
1454 } // namespace itk
1455 
1457 
1458 #ifndef ITK_MANUAL_INSTANTIATION
1459 # include "itkVariableLengthVector.hxx"
1460 #endif
1461 
1462 #endif
itk::VariableLengthVector::operator+=
Self & operator+=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:858
itk::VariableLengthVector::AlwaysReallocate::operator()
bool operator()(unsigned int, unsigned int) const
Definition: itkVariableLengthVector.h:129
itk::VariableLengthVector::GetDataPointer
const TValue * GetDataPointer() const
Definition: itkVariableLengthVector.h:762
Details::op::CanBeAddedOrSubtracted
Definition: itkVariableLengthVector.h:1158
itk::VariableLengthVector::operator/=
Self & operator/=(T s)
Definition: itkVariableLengthVector.h:965
VariableLengthVectorExpression::Size
unsigned int Size() const
Returns the size of the vector expression.
Definition: itkVariableLengthVector.h:1239
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:1225
itk::VariableLengthVector::operator+=
Self & operator+=(TValue s)
Definition: itkVariableLengthVector.h:871
VariableLengthVectorExpression::m_rhs
const TExpr2 & m_rhs
Definition: itkVariableLengthVector.h:1277
itkPromoteType.h
itk::VariableLengthVector::DontShrinkToFit
Definition: itkVariableLengthVector.h:218
VariableLengthVectorExpression::operator[]
ResType operator[](unsigned int idx) const
Definition: itkVariableLengthVector.h:1260
itk::VariableLengthVector::ShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:185
itk::VariableLengthVector::DontShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:221
itk::operator-
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
Definition: itkConstNeighborhoodIterator.h:672
itk::VariableLengthVector::operator-
std::enable_if_t< Details::op::CanBeAddedOrSubtracted< TExpr1, TExpr2 >::Value, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Sub > > operator-(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1309
itk::VariableLengthVector::GetSize
unsigned int GetSize() const
Definition: itkVariableLengthVector.h:592
itkBinaryOperationConcept.h
itk::operator<<
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
itk::VariableLengthVector::KeepOldValues
Definition: itkVariableLengthVector.h:270
itk::VariableLengthVector::operator[]
TValue & operator[](unsigned int i)
Definition: itkVariableLengthVector.h:604
itkMetaProgrammingLibrary.h
itk::VariableLengthVector::Swap
void Swap(Self &v) noexcept
Definition: itkVariableLengthVector.h:436
Details
Definition: itkVariableLengthVector.h:1038
itk::VariableLengthVector::operator+=
Self & operator+=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:892
VariableLengthVectorExpression::RealValueType
typename NumericTraits< ResType >::RealType RealValueType
Real type of the elements.
Definition: itkVariableLengthVector.h:1248
itk::VariableLengthVectorExpression::GetSquaredNorm
std::enable_if_t< mpl::IsArray< TExpr >::Value, typename TExpr::RealValueType > GetSquaredNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1384
itk::VariableLengthVector::KeepValuesRootPolicy
Definition: itkVariableLengthVector.h:246
itk::VariableLengthVector::NeverReallocate::operator()
bool operator()([[maybe_unused]] unsigned int newSize, [[maybe_unused]] unsigned int oldSize) const
Definition: itkVariableLengthVector.h:156
itk::VariableLengthVector::ValueType
TValue ValueType
Definition: itkVariableLengthVector.h:315
itk::VariableLengthVector::operator-=
Self & operator-=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:914
itk::VariableLengthVector::operator/
std::enable_if_t< Details::op::CanBeDivided< TExpr1, TExpr2 >::Value, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Div > > operator/(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1340
itkIsNumber.h
itk::VariableLengthVector::NeverReallocate
Definition: itkVariableLengthVector.h:153
itk::VariableLengthVector::operator-=
Self & operator-=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:825
itk::VariableLengthVector::operator[]
const TValue & operator[](unsigned int i) const
Definition: itkVariableLengthVector.h:607
itk::VariableLengthVector::Size
unsigned int Size() const
Definition: itkVariableLengthVector.h:587
itk::VariableLengthVector::GetNumberOfElements
unsigned int GetNumberOfElements() const
Definition: itkVariableLengthVector.h:597
itk::VariableLengthVector::AllocateRootPolicy
Definition: itkVariableLengthVector.h:110
Details::op::CanBeDivided
Definition: itkVariableLengthVector.h:1193
Details::op::CanBeMultiplied
Definition: itkVariableLengthVector.h:1176
itk::VariableLengthVector::operator--
Self & operator--()
Definition: itkVariableLengthVector.h:770
itk::VariableLengthVector::operator--
Self operator--(int)
Definition: itkVariableLengthVector.h:795
itk::operator==
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
Definition: itkIndex.h:543
itk::VariableLengthVector
Represents an array whose length can be defined at run-time.
Definition: itkConstantBoundaryCondition.h:28
itk::VariableLengthVector::SetSize
void SetSize(unsigned int sz, bool destroyExistingData=true)
Definition: itkVariableLengthVector.h:671
itk::VariableLengthVector::IsAProxy
bool IsAProxy() const
Definition: itkVariableLengthVector.h:998
itk::VariableLengthVector::swap
void swap(VariableLengthVector< T > &l_, VariableLengthVector< T > &r_) noexcept
Definition: itkVariableLengthVector.h:1447
itk::VariableLengthVector::ElementIdentifier
unsigned int ElementIdentifier
Definition: itkVariableLengthVector.h:321
itk::VariableLengthVector::KeepOldValues::operator()
void operator()(unsigned int newSize, unsigned int oldSize, TValue2 *oldBuffer, TValue2 *newBuffer) const
Definition: itkVariableLengthVector.h:274
itk::VariableLengthVector::ShrinkToFit
Definition: itkVariableLengthVector.h:182
itk::VariableLengthVector::DumpOldValues::operator()
void operator()(unsigned int, unsigned int, TValue2 *, TValue2 *) const
Definition: itkVariableLengthVector.h:304
itk::VariableLengthVector::operator-=
Self & operator-=(TValue s)
Definition: itkVariableLengthVector.h:838
itk::swap
void swap(Array< T > &a, Array< T > &b) noexcept
Definition: itkArray.h:242
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::VariableLengthVector::SetElement
void SetElement(unsigned int i, const TValue &value)
Definition: itkVariableLengthVector.h:618
itkNumericTraitsVariableLengthVectorPixel.h
VariableLengthVectorExpression::m_lhs
const TExpr1 & m_lhs
Definition: itkVariableLengthVector.h:1276
VariableLengthVectorExpression::ResType
typename mpl::PromoteType< typename Details::GetType< TExpr1 >::Type, typename Details::GetType< TExpr2 >::Type >::Type ResType
Vector type of the Result Expression.
Definition: itkVariableLengthVector.h:1246
VariableLengthVectorExpression::VariableLengthVectorExpression
VariableLengthVectorExpression(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1227
itkNumericTraits.h
itk::VariableLengthVector::operator+
std::enable_if_t< Details::op::CanBeAddedOrSubtracted< TExpr1, TExpr2 >::Value, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Plus > > operator+(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1292
itk::VariableLengthVector::VariableLengthVector
VariableLengthVector(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:397
itk::VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:34
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
itk::VariableLengthVector::RealValueType
typename NumericTraits< ValueType >::RealType RealValueType
Definition: itkVariableLengthVector.h:317
itk::VariableLengthVector::operator=
Self & operator=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:527
itk::VariableLengthVector::operator++
Self operator++(int)
Definition: itkVariableLengthVector.h:806
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::VariableLengthVector::GetElement
const TValue & GetElement(unsigned int i) const
Definition: itkVariableLengthVector.h:611
itk::VariableLengthVector::ComponentType
TValue ComponentType
Definition: itkVariableLengthVector.h:316
itk::VariableLengthVector::operator*=
Self & operator*=(T s)
Definition: itkVariableLengthVector.h:932
itk::VariableLengthVector::operator*
std::enable_if_t< Details::op::CanBeMultiplied< TExpr1, TExpr2 >::Value, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Mult > > operator*(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1325
itk::VariableLengthVector::AlwaysReallocate
Definition: itkVariableLengthVector.h:126
itk::VariableLengthVector::DumpOldValues
Definition: itkVariableLengthVector.h:300
itk::VariableLengthVector::operator*=
Self & operator*=(TValue s)
Definition: itkVariableLengthVector.h:947
itk::VariableLengthVectorExpression::GetNorm
std::enable_if_t< mpl::IsArray< TExpr >::Value, typename TExpr::RealValueType > GetNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1372
itk::VariableLengthVector::operator++
Self & operator++()
Definition: itkVariableLengthVector.h:782