ITK  5.4.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  };
155  {
156  bool
157  operator()(unsigned int newSize, unsigned int oldSize) const
158  {
159  (void)newSize;
160  (void)oldSize;
161  itkAssertInDebugAndIgnoreInReleaseMacro(newSize == oldSize &&
162  "SetSize is expected to never change the VariableLengthVector size...");
163  return true;
164  }
165  };
186  {
187  bool
188  operator()(unsigned int newSize, unsigned int oldSize) const
189  {
190  return newSize != oldSize;
191  }
192  };
222  {
223  bool
224  operator()(unsigned int newSize, unsigned int oldSize) const
225  {
226  return newSize > oldSize;
227  }
228  };
250  {};
251 
274  {
275  template <typename TValue2>
276  void
277  operator()(unsigned int newSize, unsigned int oldSize, TValue2 * oldBuffer, TValue2 * newBuffer) const
278  {
279  itkAssertInDebugAndIgnoreInReleaseMacro(newBuffer);
280  const size_t nb = std::min(newSize, oldSize);
281  itkAssertInDebugAndIgnoreInReleaseMacro(nb == 0 || (nb > 0 && oldBuffer != nullptr));
282  std::copy_n(oldBuffer, nb, newBuffer);
283  }
284  };
304  {
305  template <typename TValue2>
306  void
307  operator()(unsigned int itkNotUsed(newSize),
308  unsigned int itkNotUsed(oldSize),
309  TValue2 * itkNotUsed(oldBuffer),
310  TValue2 * itkNotUsed(newBuffer)) const
311  {}
312  };
314 
318  using ValueType = TValue;
319  using ComponentType = TValue;
322 
324  using ElementIdentifier = unsigned int;
325 
332  VariableLengthVector() = default;
333 
342  explicit VariableLengthVector(unsigned int length);
343 
357  VariableLengthVector(ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
358 
378  VariableLengthVector(const ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
379 
399  template <typename T>
401  {
402  m_NumElements = v.Size();
403  m_LetArrayManageMemory = true;
404  if (m_NumElements != 0)
405  {
406  m_Data = this->AllocateElements(m_NumElements);
407  itkAssertInDebugAndIgnoreInReleaseMacro(m_Data != nullptr);
408  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
409  {
410  this->m_Data[i] = static_cast<ValueType>(v[i]);
411  }
412  }
413  else
414  {
415  m_Data = nullptr;
416  }
417  }
429 
438  void
439  Swap(Self & v) noexcept
440  {
441  itkAssertInDebugAndIgnoreInReleaseMacro(m_LetArrayManageMemory == v.m_LetArrayManageMemory);
442  using std::swap;
443  swap(v.m_Data, m_Data);
444  swap(v.m_NumElements, m_NumElements);
445  }
455  VariableLengthVector(Self && v) noexcept;
456 
465  Self &
466  operator=(Self && v) noexcept;
467 
484  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
486 
506  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
507  Self &
509 
513  void
514  Fill(TValue const & v);
515 
528  template <typename T>
529  Self &
531  {
532  // No self assignment test is done. Indeed:
533  // - the operator already resists self assignment through a strong exception
534  // guarantee
535  // - the test becomes a pessimization as we never write
536  // VLV<const TValue> vcref(v.GetDataPointer(), v.GetSize());
537  // ...;
538  // v = vcref;
539  ElementIdentifier const N = v.Size();
540  this->SetSize(N, DontShrinkToFit(), DumpOldValues());
541  for (ElementIdentifier i = 0; i < N; ++i)
542  {
543  this->m_Data[i] = static_cast<ValueType>(v[i]);
544  }
545  return *this;
546  }
564  Self &
565  operator=(const Self & v);
566 
575  Self &
576  FastAssign(const Self & v);
577 
585  Self &
586  operator=(TValue const & v);
587 
589  unsigned int
590  Size() const
591  {
592  return m_NumElements;
593  }
594  unsigned int
595  GetSize() const
596  {
597  return m_NumElements;
598  }
599  unsigned int
601  {
602  return m_NumElements;
603  }
607  TValue & operator[](unsigned int i) { return this->m_Data[i]; }
608 
610  TValue const & operator[](unsigned int i) const { return this->m_Data[i]; }
611 
613  const TValue &
614  GetElement(unsigned int i) const
615  {
616  return m_Data[i];
617  }
618 
620  void
621  SetElement(unsigned int i, const TValue & value)
622  {
623  m_Data[i] = value;
624  }
625 
659  template <typename TReallocatePolicy, typename TKeepValuesPolicy>
660  void
661  SetSize(unsigned int sz, TReallocatePolicy reallocatePolicy, TKeepValuesPolicy keepValues);
662 
673  void
674  SetSize(unsigned int sz, bool destroyExistingData = true)
675  {
676  // Stays compatible with previous code version
677  // And works around the fact C++03 template functions can't have default
678  // arguments on template types.
679  if (destroyExistingData)
680  {
681  SetSize(sz, AlwaysReallocate(), KeepOldValues());
682  }
683  else
684  {
685  SetSize(sz, ShrinkToFit(), KeepOldValues());
686  }
687  }
692  void
693  DestroyExistingData();
694 
707  void
708  SetData(TValue * datain, bool LetArrayManageMemory = false);
709 
724  void
725  SetData(TValue * datain, unsigned int sz, bool LetArrayManageMemory = false);
726 
738 
753  void
754  Reserve(ElementIdentifier size);
761  TValue *
762  AllocateElements(ElementIdentifier size) const;
763 
764  const TValue *
766  {
767  return m_Data;
768  }
769 
772  Self &
774  {
775  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
776  {
777  this->m_Data[i] -= static_cast<ValueType>(1.0);
778  }
779  return *this;
780  }
784  Self &
785  operator++() // prefix operator ++v;
786  {
787  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
788  {
789  this->m_Data[i] += static_cast<ValueType>(1.0);
790  }
791  return *this;
792  }
797  Self
798  operator--(int) // postfix operator v--;
799  {
800  Self tmp(*this);
803  --tmp;
804  return tmp;
805  }
806 
808  Self
809  operator++(int) // postfix operator v++;
810  {
811  Self tmp(*this);
814  ++tmp;
815  return tmp;
816  }
817 
826  template <typename T>
827  Self &
829  {
830  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
831  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
832  {
833  m_Data[i] -= static_cast<ValueType>(v[i]);
834  }
835  return *this;
836  }
840  Self &
841  operator-=(TValue s)
842  {
843  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
844  {
845  m_Data[i] -= s;
846  }
847  return *this;
848  }
859  template <typename T>
860  Self &
862  {
863  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
864  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
865  {
866  m_Data[i] += static_cast<ValueType>(v[i]);
867  }
868  return *this;
869  }
873  Self &
874  operator+=(TValue s)
875  {
876  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
877  {
878  m_Data[i] += s;
879  }
880  return *this;
881  }
893  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
894  Self &
896  {
897  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
898  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
899  {
900  m_Data[i] += static_cast<ValueType>(rhs[i]);
901  }
902  return *this;
903  }
915  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
916  Self &
918  {
919  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
920  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
921  {
922  m_Data[i] -= static_cast<ValueType>(rhs[i]);
923  }
924  return *this;
925  }
933  template <typename T>
934  Self &
936  {
937  const ValueType & sc = static_cast<ValueType>(s);
938  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
939  {
940  m_Data[i] *= sc;
941  }
942  return *this;
943  }
949  Self &
950  operator*=(TValue s)
951  {
952  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
953  {
954  m_Data[i] *= s;
955  }
956  return *this;
957  }
966  template <typename T>
967  Self &
969  {
970  const RealValueType sc = s;
971  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
972  {
973  m_Data[i] = static_cast<ValueType>(static_cast<RealValueType>(m_Data[i]) / sc);
974  }
975  return *this;
976  }
983  Self &
984  operator-(); // negation operator
985 
986  bool
987  operator==(const Self & v) const;
988 
989  ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self);
990 
992  RealValueType
993  GetNorm() const;
994 
996  RealValueType
997  GetSquaredNorm() const;
998 
1000  bool
1001  IsAProxy() const
1002  {
1003  return !m_LetArrayManageMemory;
1004  }
1005 
1006 private:
1007  bool m_LetArrayManageMemory{ true }; // if true, the array is responsible
1008  // for memory of data
1009  TValue * m_Data{}; // Array to hold data
1010  ElementIdentifier m_NumElements{ 0 };
1011 };
1012 
1014 namespace mpl
1015 {
1025 template <typename T>
1026 struct IsArray : FalseType
1027 {};
1028 
1030 template <typename T>
1031 struct IsArray<itk::VariableLengthVector<T>> : TrueType
1032 {};
1033 
1034 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1035 struct IsArray<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>> : TrueType
1036 {};
1038 } // namespace mpl
1040 
1041 namespace Details
1042 {
1044 
1056 template <typename TExpr>
1057 struct GetType
1058 {
1059  using Type = TExpr;
1060 
1064  static Type
1065  Load(Type const & v, unsigned int idx)
1066  {
1067  (void)idx;
1068  return v;
1069  }
1070 };
1083 template <typename TExpr1, typename TExpr2>
1084 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>::Value, unsigned int>
1085 GetSize(TExpr1 const & lhs, TExpr2 const & rhs)
1086 {
1087  (void)rhs;
1088  itkAssertInDebugAndIgnoreInReleaseMacro(lhs.Size() == rhs.Size());
1089  return lhs.Size();
1090 }
1093 
1103 template <typename TExpr1, typename TExpr2>
1104 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr1>, mpl::Not<mpl::IsArray<TExpr2>>>::Value, unsigned int>
1105 GetSize(TExpr1 const & lhs, TExpr2 const & itkNotUsed(rhs))
1106 {
1107  return lhs.Size();
1108 }
1109 
1119 template <typename TExpr1, typename TExpr2>
1120 inline std::enable_if_t<mpl::And<mpl::IsArray<TExpr2>, mpl::Not<mpl::IsArray<TExpr1>>>::Value, unsigned int>
1121 GetSize(TExpr1 const & itkNotUsed(lhs), TExpr2 const & rhs)
1122 {
1123  return rhs.Size();
1124 }
1125 
1126 template <typename T>
1127 struct GetType<VariableLengthVector<T>>
1128 {
1129  using Type = T;
1130  static Type
1131  Load(VariableLengthVector<T> const & v, unsigned int idx)
1132  {
1133  return v[idx];
1134  }
1135 };
1136 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1137 struct GetType<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>>
1138 {
1140  static Type
1141  Load(VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp> const & v, unsigned int idx)
1142  {
1143  return v[idx];
1144  }
1145 };
1147 
1148 namespace op
1149 {
1162 template <typename TExpr1, typename TExpr2>
1164  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>,
1165  mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1166  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1167 {};
1168 
1180 template <typename TExpr1, typename TExpr2>
1182  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1183  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1184 {};
1185 
1197 template <typename TExpr1, typename TExpr2>
1198 struct CanBeDivided : mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>
1199 {};
1200 
1201 } // namespace op
1202 } // namespace Details
1204 
1229 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1231 {
1232  VariableLengthVectorExpression(TExpr1 const & lhs, TExpr2 const & rhs)
1233  : m_lhs(lhs)
1234  , m_rhs(rhs)
1235  {
1236  // Not necessary actually as end-user/developer is not expected to
1237  // provide new BinaryOperations
1238  static_assert(std::is_base_of_v<Details::op::BinaryOperationConcept, TBinaryOp>,
1239  "The Binary Operation shall inherit from BinaryOperationConcept");
1240  }
1241 
1243  unsigned int
1244  Size() const
1245  {
1246  return Details::GetSize(m_lhs, m_rhs);
1247  }
1248 
1250  using ResType =
1251  typename mpl::PromoteType<typename Details::GetType<TExpr1>::Type, typename Details::GetType<TExpr2>::Type>::Type;
1254 
1265  ResType operator[](unsigned int idx) const
1266  {
1267  itkAssertInDebugAndIgnoreInReleaseMacro(idx < Size());
1268  return TBinaryOp::Apply(Details::GetType<TExpr1>::Load(m_lhs, idx), Details::GetType<TExpr2>::Load(m_rhs, idx));
1269  }
1273  RealValueType
1274  GetNorm() const;
1275 
1277  RealValueType
1278  GetSquaredNorm() const;
1279 
1280 private:
1281  TExpr1 const & m_lhs;
1282  TExpr2 const & m_rhs;
1283 };
1284 
1294 template <typename TExpr1, typename TExpr2>
1295 inline std::enable_if_t<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>::Value,
1297 operator+(TExpr1 const & lhs, TExpr2 const & rhs)
1298 {
1300 }
1301 
1311 template <typename TExpr1, typename TExpr2>
1312 inline std::enable_if_t<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>::Value,
1314 operator-(TExpr1 const & lhs, TExpr2 const & rhs)
1315 {
1317 }
1318 
1327 template <typename TExpr1, typename TExpr2>
1328 inline std::enable_if_t<Details::op::CanBeMultiplied<TExpr1, TExpr2>::Value,
1330 operator*(TExpr1 const & lhs, TExpr2 const & rhs)
1331 {
1333 }
1334 
1342 template <typename TExpr1, typename TExpr2>
1343 inline std::enable_if_t<Details::op::CanBeDivided<TExpr1, TExpr2>::Value,
1345 operator/(TExpr1 const & lhs, TExpr2 const & rhs)
1346 {
1348 }
1349 
1353 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1354 std::ostream &
1356 {
1357  os << '[';
1358  if (v.Size() != 0)
1359  {
1360  os << v[0];
1361  for (unsigned int i = 1, N = v.Size(); i != N; ++i)
1362  {
1363  os << ", " << v[i];
1364  }
1365  }
1366  return os << ']';
1367 }
1375 template <typename TExpr>
1376 inline std::enable_if_t<mpl::IsArray<TExpr>::Value, typename TExpr::RealValueType>
1377 GetNorm(TExpr const & v)
1378 {
1379  return static_cast<typename TExpr::RealValueType>(std::sqrt(static_cast<double>(GetSquaredNorm(v))));
1380 }
1381 
1387 template <typename TExpr>
1388 inline std::enable_if_t<mpl::IsArray<TExpr>::Value, typename TExpr::RealValueType>
1389 GetSquaredNorm(TExpr const & v)
1390 {
1391  using RealValueType = typename TExpr::RealValueType;
1392  RealValueType sum = 0.0;
1393  for (unsigned int i = 0, N = v.Size(); i < N; ++i)
1394  {
1395  const RealValueType value = v[i];
1396  sum += value * value;
1397  }
1398  return sum;
1399 }
1404 
1408 template <typename TValue>
1409 std::ostream &
1410 operator<<(std::ostream & os, const VariableLengthVector<TValue> & arr)
1411 {
1412  const unsigned int length = arr.Size();
1413  const int last = static_cast<unsigned int>(length) - 1;
1416  os << '[';
1417  for (int i = 0; i < last; ++i)
1418  {
1419  os << arr[i] << ", ";
1420  }
1421  if (length >= 1)
1422  {
1423  os << arr[last];
1424  }
1425  os << ']';
1426  return os;
1427 }
1429 
1432 
1450 template <typename T>
1451 inline void
1453 {
1454  l_.Swap(r_);
1455 }
1457 
1459 } // namespace itk
1460 
1462 
1463 #ifndef ITK_MANUAL_INSTANTIATION
1464 # include "itkVariableLengthVector.hxx"
1465 #endif
1466 
1467 #endif
itk::VariableLengthVector::operator+=
Self & operator+=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:861
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:765
Details::op::CanBeAddedOrSubtracted
Definition: itkVariableLengthVector.h:1163
itk::VariableLengthVector::operator/=
Self & operator/=(T s)
Definition: itkVariableLengthVector.h:968
VariableLengthVectorExpression::Size
unsigned int Size() const
Returns the size of the vector expression.
Definition: itkVariableLengthVector.h:1244
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:71
VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:1230
itk::VariableLengthVector::operator+=
Self & operator+=(TValue s)
Definition: itkVariableLengthVector.h:874
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216
VariableLengthVectorExpression::m_rhs
const TExpr2 & m_rhs
Definition: itkVariableLengthVector.h:1282
itkPromoteType.h
itk::VariableLengthVector::DontShrinkToFit
Definition: itkVariableLengthVector.h:221
VariableLengthVectorExpression::operator[]
ResType operator[](unsigned int idx) const
Definition: itkVariableLengthVector.h:1265
itk::VariableLengthVector::ShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:188
itk::VariableLengthVector::DontShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:224
itk::swap
void swap(Array< T > &a, Array< T > &b)
Definition: itkArray.h:242
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:1314
itk::VariableLengthVector::GetSize
unsigned int GetSize() const
Definition: itkVariableLengthVector.h:595
itkBinaryOperationConcept.h
itk::VariableLengthVector::KeepOldValues
Definition: itkVariableLengthVector.h:273
itk::VariableLengthVector::operator[]
TValue & operator[](unsigned int i)
Definition: itkVariableLengthVector.h:607
itkMetaProgrammingLibrary.h
itk::VariableLengthVector::Swap
void Swap(Self &v) noexcept
Definition: itkVariableLengthVector.h:439
Details
Definition: itkVariableLengthVector.h:1041
itk::VariableLengthVector::operator+=
Self & operator+=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:895
VariableLengthVectorExpression::RealValueType
typename NumericTraits< ResType >::RealType RealValueType
Real type of the elements.
Definition: itkVariableLengthVector.h:1253
itk::VariableLengthVectorExpression::GetSquaredNorm
std::enable_if_t< mpl::IsArray< TExpr >::Value, typename TExpr::RealValueType > GetSquaredNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1389
itk::VariableLengthVector::KeepValuesRootPolicy
Definition: itkVariableLengthVector.h:249
itk::VariableLengthVector::NeverReallocate::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:157
itk::VariableLengthVector::ValueType
TValue ValueType
Definition: itkVariableLengthVector.h:318
itk::VariableLengthVector::operator-=
Self & operator-=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:917
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:1345
itkIsNumber.h
itk::VariableLengthVector::NeverReallocate
Definition: itkVariableLengthVector.h:154
itk::VariableLengthVector::operator-=
Self & operator-=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:828
itk::VariableLengthVector::operator[]
const TValue & operator[](unsigned int i) const
Definition: itkVariableLengthVector.h:610
itk::VariableLengthVector::Size
unsigned int Size() const
Definition: itkVariableLengthVector.h:590
itk::VariableLengthVector::GetNumberOfElements
unsigned int GetNumberOfElements() const
Definition: itkVariableLengthVector.h:600
itk::VariableLengthVector::AllocateRootPolicy
Definition: itkVariableLengthVector.h:110
Details::op::CanBeDivided
Definition: itkVariableLengthVector.h:1198
Details::op::CanBeMultiplied
Definition: itkVariableLengthVector.h:1181
itk::VariableLengthVector::operator--
Self & operator--()
Definition: itkVariableLengthVector.h:773
itk::VariableLengthVector::operator--
Self operator--(int)
Definition: itkVariableLengthVector.h:798
itk::operator==
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
Definition: itkIndex.h:545
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:674
itk::VariableLengthVector::IsAProxy
bool IsAProxy() const
Definition: itkVariableLengthVector.h:1001
itk::VariableLengthVector::swap
void swap(VariableLengthVector< T > &l_, VariableLengthVector< T > &r_) noexcept
Definition: itkVariableLengthVector.h:1452
itk::VariableLengthVector::ElementIdentifier
unsigned int ElementIdentifier
Definition: itkVariableLengthVector.h:324
itk::VariableLengthVector::KeepOldValues::operator()
void operator()(unsigned int newSize, unsigned int oldSize, TValue2 *oldBuffer, TValue2 *newBuffer) const
Definition: itkVariableLengthVector.h:277
itk::VariableLengthVector::ShrinkToFit
Definition: itkVariableLengthVector.h:185
itk::VariableLengthVector::DumpOldValues::operator()
void operator()(unsigned int, unsigned int, TValue2 *, TValue2 *) const
Definition: itkVariableLengthVector.h:307
itk::VariableLengthVector::operator-=
Self & operator-=(TValue s)
Definition: itkVariableLengthVector.h:841
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VariableLengthVector::SetElement
void SetElement(unsigned int i, const TValue &value)
Definition: itkVariableLengthVector.h:621
itkNumericTraitsVariableLengthVectorPixel.h
VariableLengthVectorExpression::m_lhs
const TExpr1 & m_lhs
Definition: itkVariableLengthVector.h:1281
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:1251
VariableLengthVectorExpression::VariableLengthVectorExpression
VariableLengthVectorExpression(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1232
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:1297
itk::VariableLengthVector::VariableLengthVector
VariableLengthVector(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:400
itk::VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:34
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:85
itk::VariableLengthVector::RealValueType
typename NumericTraits< ValueType >::RealType RealValueType
Definition: itkVariableLengthVector.h:320
itk::VariableLengthVector::operator=
Self & operator=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:530
itk::VariableLengthVector::operator++
Self operator++(int)
Definition: itkVariableLengthVector.h:809
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::VariableLengthVector::GetElement
const TValue & GetElement(unsigned int i) const
Definition: itkVariableLengthVector.h:614
itk::VariableLengthVector::ComponentType
TValue ComponentType
Definition: itkVariableLengthVector.h:319
itk::VariableLengthVector::operator*=
Self & operator*=(T s)
Definition: itkVariableLengthVector.h:935
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:1330
itk::VariableLengthVector::AlwaysReallocate
Definition: itkVariableLengthVector.h:126
itk::VariableLengthVector::DumpOldValues
Definition: itkVariableLengthVector.h:303
itk::VariableLengthVector::operator*=
Self & operator*=(TValue s)
Definition: itkVariableLengthVector.h:950
itk::VariableLengthVectorExpression::GetNorm
std::enable_if_t< mpl::IsArray< TExpr >::Value, typename TExpr::RealValueType > GetNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1377
itk::VariableLengthVector::operator++
Self & operator++()
Definition: itkVariableLengthVector.h:785