ITK  5.2.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  * http://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 "itkNumericTraits.h"
24 #include "itkStaticAssert.h"
26 #include "itkEnableIf.h"
27 #include "itkIsBaseOf.h"
28 #include "itkIsNumber.h"
29 #include "itkPromoteType.h"
31 
32 namespace itk
33 {
34 
35 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
37 
92 template <typename TValue>
93 class ITK_TEMPLATE_EXPORT VariableLengthVector
94 {
95 public:
100 
113  {};
114 
129  {
130  bool
131  operator()(unsigned int itkNotUsed(newSize), unsigned int itkNotUsed(oldSize)) const
132  {
133  return true;
134  }
135  };
137 
157  {
158  bool
159  operator()(unsigned int newSize, unsigned int oldSize) const
160  {
161  (void)newSize;
162  (void)oldSize;
163  itkAssertInDebugAndIgnoreInReleaseMacro(newSize == oldSize &&
164  "SetSize is expected to never change the VariableLengthVector size...");
165  return true;
166  }
167  };
169 
188  {
189  bool
190  operator()(unsigned int newSize, unsigned int oldSize) const
191  {
192  return newSize != oldSize;
193  }
194  };
196 
224  {
225  bool
226  operator()(unsigned int newSize, unsigned int oldSize) const
227  {
228  return newSize > oldSize;
229  }
230  };
232 
252  {};
253 
276  {
277  template <typename TValue2>
278  void
279  operator()(unsigned int newSize, unsigned int oldSize, TValue2 * oldBuffer, TValue2 * newBuffer) const
280  {
281  itkAssertInDebugAndIgnoreInReleaseMacro(newBuffer);
282  const std::size_t nb = std::min(newSize, oldSize);
283  itkAssertInDebugAndIgnoreInReleaseMacro(nb == 0 || (nb > 0 && oldBuffer != nullptr));
284  std::copy_n(oldBuffer, nb, newBuffer);
285  }
286  };
288 
306  {
307  template <typename TValue2>
308  void
309  operator()(unsigned int itkNotUsed(newSize),
310  unsigned int itkNotUsed(oldSize),
311  TValue2 * itkNotUsed(oldBuffer),
312  TValue2 * itkNotUsed(newBuffer)) const
313  {}
314  };
316 
317 
318 
320  using ValueType = TValue;
321  using ComponentType = TValue;
324 
326  using ElementIdentifier = unsigned int;
327 
335 
344  explicit VariableLengthVector(unsigned int length);
345 
359  VariableLengthVector(ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
360 
380  VariableLengthVector(const ValueType * datain, unsigned int sz, bool LetArrayManageMemory = false);
381 
401  template <typename T>
403  {
404  m_NumElements = v.Size();
405  m_LetArrayManageMemory = true;
406  if (m_NumElements != 0)
407  {
408  m_Data = this->AllocateElements(m_NumElements);
409  itkAssertInDebugAndIgnoreInReleaseMacro(m_Data != nullptr);
410  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
411  {
412  this->m_Data[i] = static_cast<ValueType>(v[i]);
413  }
414  }
415  else
416  {
417  m_Data = nullptr;
418  }
419  }
421 
431 
440  void
441  Swap(Self & v) noexcept
442  {
443  itkAssertInDebugAndIgnoreInReleaseMacro(m_LetArrayManageMemory == v.m_LetArrayManageMemory);
444  using std::swap;
445  swap(v.m_Data, m_Data);
446  swap(v.m_NumElements, m_NumElements);
447  }
449 
457  VariableLengthVector(Self && v) noexcept;
458 
467  Self &
468  operator=(Self && v) noexcept;
469 
486  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
488 
508  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
509  Self &
511 
515  void
516  Fill(TValue const & v);
517 
530  template <typename T>
531  Self &
533  {
534  // No self assignment test is done. Indeed:
535  // - the operator already resists self assignment through a strong exception
536  // guarantee
537  // - the test becomes a pessimization as we never write
538  // VLV<const TValue> vcref(v.GetDataPointer(), v.GetSize());
539  // ...;
540  // v = vcref;
541  ElementIdentifier const N = v.Size();
542  this->SetSize(N, DontShrinkToFit(), DumpOldValues());
543  for (ElementIdentifier i = 0; i < N; ++i)
544  {
545  this->m_Data[i] = static_cast<ValueType>(v[i]);
546  }
547  return *this;
548  }
550 
566  Self &
567  operator=(const Self & v);
568 
577  Self &
578  FastAssign(const Self & v);
579 
587  Self &
588  operator=(TValue const & v);
589 
591  unsigned int
592  Size() const
593  {
594  return m_NumElements;
595  }
596  unsigned int
597  GetSize() const
598  {
599  return m_NumElements;
600  }
601  unsigned int
603  {
604  return m_NumElements;
605  }
607 
609  TValue & operator[](unsigned int i) { return this->m_Data[i]; }
610 
612  TValue const & operator[](unsigned int i) const { return this->m_Data[i]; }
613 
615  const TValue &
616  GetElement(unsigned int i) const
617  {
618  return m_Data[i];
619  }
620 
622  void
623  SetElement(unsigned int i, const TValue & value)
624  {
625  m_Data[i] = value;
626  }
627 
661  template <typename TReallocatePolicy, typename TKeepValuesPolicy>
662  void
663  SetSize(unsigned int sz, TReallocatePolicy reallocatePolicy, TKeepValuesPolicy keepValues);
664 
675  void
676  SetSize(unsigned int sz, bool destroyExistingData = true)
677  {
678  // Stays compatible with previous code version
679  // And works around the fact C++03 template functions can't have default
680  // arguments on template types.
681  if (destroyExistingData)
682  {
683  SetSize(sz, AlwaysReallocate(), KeepOldValues());
684  }
685  else
686  {
687  SetSize(sz, ShrinkToFit(), KeepOldValues());
688  }
689  }
691 
694  void
695  DestroyExistingData();
696 
709  void
710  SetData(TValue * datain, bool LetArrayManageMemory = false);
711 
726  void
727  SetData(TValue * datain, unsigned int sz, bool LetArrayManageMemory = false);
728 
740 
755  void
756  Reserve(ElementIdentifier size);
758 
763  TValue *
764  AllocateElements(ElementIdentifier size) const;
765 
766  const TValue *
768  {
769  return m_Data;
770  }
771 
774  Self &
776  {
777  for (ElementIdentifier i = 0; i < m_NumElements; i++)
778  {
779  this->m_Data[i] -= static_cast<ValueType>(1.0);
780  }
781  return *this;
782  }
784 
786  Self &
787  operator++() // prefix operator ++v;
788  {
789  for (ElementIdentifier i = 0; i < m_NumElements; i++)
790  {
791  this->m_Data[i] += static_cast<ValueType>(1.0);
792  }
793  return *this;
794  }
796 
799  Self
800  operator--(int) // postfix operator v--;
801  {
802  Self tmp(*this);
804 
805  --tmp;
806  return tmp;
807  }
808 
810  Self
811  operator++(int) // postfix operator v++;
812  {
813  Self tmp(*this);
815 
816  ++tmp;
817  return tmp;
818  }
819 
828  template <typename T>
829  Self &
831  {
832  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
833  for (ElementIdentifier i = 0; i < m_NumElements; i++)
834  {
835  m_Data[i] -= static_cast<ValueType>(v[i]);
836  }
837  return *this;
838  }
840 
842  Self &
843  operator-=(TValue s)
844  {
845  for (ElementIdentifier i = 0; i < m_NumElements; i++)
846  {
847  m_Data[i] -= s;
848  }
849  return *this;
850  }
852 
861  template <typename T>
862  Self &
864  {
865  itkAssertInDebugAndIgnoreInReleaseMacro(m_NumElements == v.GetSize());
866  for (ElementIdentifier i = 0; i < m_NumElements; i++)
867  {
868  m_Data[i] += static_cast<ValueType>(v[i]);
869  }
870  return *this;
871  }
873 
875  Self &
876  operator+=(TValue s)
877  {
878  for (ElementIdentifier i = 0; i < m_NumElements; i++)
879  {
880  m_Data[i] += s;
881  }
882  return *this;
883  }
885 
895  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
896  Self &
898  {
899  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
900  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
901  {
902  m_Data[i] += static_cast<ValueType>(rhs[i]);
903  }
904  return *this;
905  }
907 
917  template <typename TExpr1, typename TExpr2, typename TBinaryOp>
918  Self &
920  {
921  itkAssertInDebugAndIgnoreInReleaseMacro(rhs.Size() == Size());
922  for (ElementIdentifier i = 0; i < m_NumElements; ++i)
923  {
924  m_Data[i] -= static_cast<ValueType>(rhs[i]);
925  }
926  return *this;
927  }
929 
935  template <typename T>
936  Self &
938  {
939  const ValueType & sc = static_cast<ValueType>(s);
940  for (ElementIdentifier i = 0; i < m_NumElements; i++)
941  {
942  m_Data[i] *= sc;
943  }
944  return *this;
945  }
947 
951  Self &
952  operator*=(TValue s)
953  {
954  for (ElementIdentifier i = 0; i < m_NumElements; i++)
955  {
956  m_Data[i] *= s;
957  }
958  return *this;
959  }
961 
968  template <typename T>
969  Self &
971  {
972  const RealValueType sc = s;
973  for (ElementIdentifier i = 0; i < m_NumElements; i++)
974  {
975  m_Data[i] = static_cast<ValueType>(static_cast<RealValueType>(m_Data[i]) / sc);
976  }
977  return *this;
978  }
980 
985  Self &
986  operator-(); // negation operator
987 
988  bool
989  operator==(const Self & v) const;
990 
991  bool
992  operator!=(const Self & v) const;
993 
995  RealValueType
996  GetNorm() const;
997 
999  RealValueType
1000  GetSquaredNorm() const;
1001 
1003  bool
1004  IsAProxy() const
1005  {
1006  return !m_LetArrayManageMemory;
1007  }
1008 
1009 private:
1010  bool m_LetArrayManageMemory{ true }; // if true, the array is responsible
1011  // for memory of data
1012  TValue * m_Data; // Array to hold data
1013  ElementIdentifier m_NumElements{ 0 };
1014 };
1015 
1017 namespace mpl
1018 {
1028 template <typename T>
1029 struct IsArray : FalseType
1030 {};
1031 
1033 template <typename T>
1034 struct IsArray<itk::VariableLengthVector<T>> : TrueType
1035 {};
1036 
1037 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1038 struct IsArray<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>> : TrueType
1039 {};
1041 } // namespace mpl
1043 
1044 namespace Details
1045 {
1047 
1059 template <typename TExpr>
1060 struct GetType
1061 {
1062  using Type = TExpr;
1063 
1067  static Type
1068  Load(Type const & v, unsigned int idx)
1069  {
1070  (void)idx;
1071  return v;
1072  }
1073 };
1075 
1086 template <typename TExpr1, typename TExpr2>
1087 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>, unsigned int>::Type
1088 GetSize(TExpr1 const & lhs, TExpr2 const & rhs)
1089 {
1090  (void)rhs;
1091  itkAssertInDebugAndIgnoreInReleaseMacro(lhs.Size() == rhs.Size());
1092  return lhs.Size();
1093 }
1095 
1097 
1106 template <typename TExpr1, typename TExpr2>
1107 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr1>, mpl::Not<mpl::IsArray<TExpr2>>>, unsigned int>::Type
1108 GetSize(TExpr1 const & lhs, TExpr2 const & itkNotUsed(rhs))
1109 {
1110  return lhs.Size();
1111 }
1112 
1122 template <typename TExpr1, typename TExpr2>
1123 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr2>, mpl::Not<mpl::IsArray<TExpr1>>>, unsigned int>::Type
1124 GetSize(TExpr1 const & itkNotUsed(lhs), TExpr2 const & rhs)
1125 {
1126  return rhs.Size();
1127 }
1128 
1129 template <typename T>
1130 struct GetType<VariableLengthVector<T>>
1131 {
1132  using Type = T;
1133  static Type
1134  Load(VariableLengthVector<T> const & v, unsigned int idx)
1135  {
1136  return v[idx];
1137  }
1138 };
1139 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1140 struct GetType<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>>
1141 {
1143  static Type
1144  Load(VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp> const & v, unsigned int idx)
1145  {
1146  return v[idx];
1147  }
1148 };
1150 
1151 namespace op
1152 {
1165 template <typename TExpr1, typename TExpr2>
1167  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>,
1168  mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1169  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1170 {};
1171 
1183 template <typename TExpr1, typename TExpr2>
1185  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1186  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1187 {};
1188 
1200 template <typename TExpr1, typename TExpr2>
1201 struct CanBeDivided : mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>
1202 {};
1203 
1204 } // namespace op
1205 } // namespace Details
1207 
1232 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1234 {
1235  VariableLengthVectorExpression(TExpr1 const & lhs, TExpr2 const & rhs)
1236  : m_lhs(lhs)
1237  , m_rhs(rhs)
1238  {
1239  // Not neccessary actually as end-user/developer is not expected to
1240  // provide new BinaryOperations
1241  itkStaticAssert((itk::mpl::IsBaseOf<Details::op::BinaryOperationConcept, TBinaryOp>::Value),
1242  "The Binary Operation shall inherit from BinaryOperationConcept");
1243  }
1244 
1246  unsigned int
1247  Size() const
1248  {
1249  return Details::GetSize(m_lhs, m_rhs);
1250  }
1251 
1253  using ResType =
1254  typename mpl::PromoteType<typename Details::GetType<TExpr1>::Type, typename Details::GetType<TExpr2>::Type>::Type;
1257 
1268  ResType operator[](unsigned int idx) const
1269  {
1270  itkAssertInDebugAndIgnoreInReleaseMacro(idx < Size());
1271  return TBinaryOp::Apply(Details::GetType<TExpr1>::Load(m_lhs, idx), Details::GetType<TExpr2>::Load(m_rhs, idx));
1272  }
1274 
1276  RealValueType
1277  GetNorm() const;
1278 
1280  RealValueType
1281  GetSquaredNorm() const;
1282 
1283 private:
1284  TExpr1 const & m_lhs;
1285  TExpr2 const & m_rhs;
1286 };
1287 
1297 template <typename TExpr1, typename TExpr2>
1298 inline typename mpl::EnableIf<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>,
1300 operator+(TExpr1 const & lhs, TExpr2 const & rhs)
1301 {
1303 }
1304 
1314 template <typename TExpr1, typename TExpr2>
1315 inline typename mpl::EnableIf<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>,
1317 operator-(TExpr1 const & lhs, TExpr2 const & rhs)
1318 {
1320 }
1321 
1330 template <typename TExpr1, typename TExpr2>
1331 inline typename mpl::EnableIf<Details::op::CanBeMultiplied<TExpr1, TExpr2>,
1333 operator*(TExpr1 const & lhs, TExpr2 const & rhs)
1334 {
1336 }
1337 
1345 template <typename TExpr1, typename TExpr2>
1346 inline typename mpl::EnableIf<Details::op::CanBeDivided<TExpr1, TExpr2>,
1348 operator/(TExpr1 const & lhs, TExpr2 const & rhs)
1349 {
1351 }
1352 
1356 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1357 std::ostream &
1359 {
1360  os << "[";
1361  if (v.Size() != 0)
1362  {
1363  os << v[0];
1364  for (unsigned int i = 1, N = v.Size(); i != N; ++i)
1365  {
1366  os << ", " << v[i];
1367  }
1368  }
1369  return os << "]";
1370 }
1372 
1378 template <typename TExpr>
1379 inline typename mpl::EnableIf<mpl::IsArray<TExpr>, typename TExpr::RealValueType>::Type
1380 GetNorm(TExpr const & v)
1381 {
1382  return static_cast<typename TExpr::RealValueType>(std::sqrt(static_cast<double>(GetSquaredNorm(v))));
1383 }
1384 
1390 template <typename TExpr>
1391 inline typename mpl::EnableIf<mpl::IsArray<TExpr>, typename TExpr::RealValueType>::Type
1392 GetSquaredNorm(TExpr const & v)
1393 {
1394  using RealValueType = typename TExpr::RealValueType;
1395  RealValueType sum = 0.0;
1396  for (unsigned int i = 0, N = v.Size(); i < N; ++i)
1397  {
1398  const RealValueType value = v[i];
1399  sum += value * value;
1400  }
1401  return sum;
1402 }
1404 
1407 
1411 template <typename TValue>
1412 std::ostream &
1413 operator<<(std::ostream & os, const VariableLengthVector<TValue> & arr)
1414 {
1415  const unsigned int length = arr.Size();
1416  const signed int last = (unsigned int)length - 1;
1418 
1419  os << "[";
1420  for (signed int i = 0; i < last; ++i)
1421  {
1422  os << arr[i] << ", ";
1423  }
1424  if (length >= 1)
1425  {
1426  os << arr[last];
1427  }
1428  os << "]";
1429  return os;
1430 }
1432 
1435 
1453 template <typename T>
1454 inline void
1456 {
1457  l_.Swap(r_);
1458 }
1460 
1461 
1462 } // namespace itk
1463 
1465 
1466 #ifndef ITK_MANUAL_INSTANTIATION
1467 # include "itkVariableLengthVector.hxx"
1468 #endif
1469 
1470 #endif
itk::VariableLengthVector::operator+=
Self & operator+=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:863
itk::VariableLengthVector::AlwaysReallocate::operator()
bool operator()(unsigned int, unsigned int) const
Definition: itkVariableLengthVector.h:131
itk::VariableLengthVector::GetDataPointer
const TValue * GetDataPointer() const
Definition: itkVariableLengthVector.h:767
Details::op::CanBeAddedOrSubtracted
Definition: itkVariableLengthVector.h:1166
itk::VariableLengthVector::operator/=
Self & operator/=(T s)
Definition: itkVariableLengthVector.h:970
VariableLengthVectorExpression::Size
unsigned int Size() const
Returns the size of the vector expression.
Definition: itkVariableLengthVector.h:1247
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:1233
itk::VariableLengthVector::operator+=
Self & operator+=(TValue s)
Definition: itkVariableLengthVector.h:876
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::VariableLengthVector::operator*
mpl::EnableIf< Details::op::CanBeMultiplied< TExpr1, TExpr2 >, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Mult > >::Type operator*(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1333
VariableLengthVectorExpression::m_rhs
const TExpr2 & m_rhs
Definition: itkVariableLengthVector.h:1285
itkEnableIf.h
itkPromoteType.h
itk::VariableLengthVector::DontShrinkToFit
Definition: itkVariableLengthVector.h:223
VariableLengthVectorExpression::operator[]
ResType operator[](unsigned int idx) const
Definition: itkVariableLengthVector.h:1268
itk::VariableLengthVector::operator/
mpl::EnableIf< Details::op::CanBeDivided< TExpr1, TExpr2 >, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Div > >::Type operator/(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1348
itk::VariableLengthVector::ShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:190
itkIsBaseOf.h
itk::VariableLengthVector::DontShrinkToFit::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:226
itk::swap
void swap(Array< T > &a, Array< T > &b)
Definition: itkArray.h:244
itk::operator-
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
Definition: itkConstNeighborhoodIterator.h:679
itk::VariableLengthVector::GetSize
unsigned int GetSize() const
Definition: itkVariableLengthVector.h:597
itk::VariableLengthVector::operator-
mpl::EnableIf< Details::op::CanBeAddedOrSubtracted< TExpr1, TExpr2 >, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Sub > >::Type operator-(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1317
itkBinaryOperationConcept.h
itkStaticAssert
#define itkStaticAssert(expr, str)
Definition: itkStaticAssert.h:66
itk::VariableLengthVector::KeepOldValues
Definition: itkVariableLengthVector.h:275
itk::VariableLengthVector::operator[]
TValue & operator[](unsigned int i)
Definition: itkVariableLengthVector.h:609
itkMetaProgrammingLibrary.h
itk::VariableLengthVector::Swap
void Swap(Self &v) noexcept
Definition: itkVariableLengthVector.h:441
Details
Definition: itkVariableLengthVector.h:1044
itk::VariableLengthVector::operator+=
Self & operator+=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:897
VariableLengthVectorExpression::RealValueType
typename NumericTraits< ResType >::RealType RealValueType
Real type of the elements.
Definition: itkVariableLengthVector.h:1256
itk::VariableLengthVector::KeepValuesRootPolicy
Definition: itkVariableLengthVector.h:251
itk::VariableLengthVector::NeverReallocate::operator()
bool operator()(unsigned int newSize, unsigned int oldSize) const
Definition: itkVariableLengthVector.h:159
itk::VariableLengthVector::ValueType
TValue ValueType
Definition: itkVariableLengthVector.h:320
itk::VariableLengthVector::operator-=
Self & operator-=(VariableLengthVectorExpression< TExpr1, TExpr2, TBinaryOp > const &rhs)
Definition: itkVariableLengthVector.h:919
itk::VariableLengthVectorExpression::GetSquaredNorm
mpl::EnableIf< mpl::IsArray< TExpr >, typename TExpr::RealValueType >::Type GetSquaredNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1392
itkIsNumber.h
itk::VariableLengthVector::NeverReallocate
Definition: itkVariableLengthVector.h:156
itk::VariableLengthVector::operator-=
Self & operator-=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:830
itk::VariableLengthVector::operator[]
const TValue & operator[](unsigned int i) const
Definition: itkVariableLengthVector.h:612
itk::VariableLengthVector::Size
unsigned int Size() const
Definition: itkVariableLengthVector.h:592
itk::VariableLengthVector::GetNumberOfElements
unsigned int GetNumberOfElements() const
Definition: itkVariableLengthVector.h:602
itk::VariableLengthVector::AllocateRootPolicy
Definition: itkVariableLengthVector.h:112
Details::op::CanBeDivided
Definition: itkVariableLengthVector.h:1201
Details::op::CanBeMultiplied
Definition: itkVariableLengthVector.h:1184
itk::VariableLengthVector::m_Data
TValue * m_Data
Definition: itkVariableLengthVector.h:1012
itk::VariableLengthVector::operator--
Self & operator--()
Definition: itkVariableLengthVector.h:775
itk::VariableLengthVector::operator--
Self operator--(int)
Definition: itkVariableLengthVector.h:800
itk::operator==
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
Definition: itkIndex.h:532
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:676
itk::VariableLengthVector::IsAProxy
bool IsAProxy() const
Definition: itkVariableLengthVector.h:1004
itk::VariableLengthVector::swap
void swap(VariableLengthVector< T > &l_, VariableLengthVector< T > &r_) noexcept
Definition: itkVariableLengthVector.h:1455
itk::VariableLengthVector::ElementIdentifier
unsigned int ElementIdentifier
Definition: itkVariableLengthVector.h:326
itk::VariableLengthVector::KeepOldValues::operator()
void operator()(unsigned int newSize, unsigned int oldSize, TValue2 *oldBuffer, TValue2 *newBuffer) const
Definition: itkVariableLengthVector.h:279
itk::VariableLengthVector::ShrinkToFit
Definition: itkVariableLengthVector.h:187
itk::operator!=
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
Definition: itkIndex.h:539
itk::VariableLengthVector::DumpOldValues::operator()
void operator()(unsigned int, unsigned int, TValue2 *, TValue2 *) const
Definition: itkVariableLengthVector.h:309
itk::VariableLengthVector::operator-=
Self & operator-=(TValue s)
Definition: itkVariableLengthVector.h:843
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:623
itkNumericTraitsVariableLengthVectorPixel.h
VariableLengthVectorExpression::m_lhs
const TExpr1 & m_lhs
Definition: itkVariableLengthVector.h:1284
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:1254
itk::VariableLengthVectorExpression::GetNorm
mpl::EnableIf< mpl::IsArray< TExpr >, typename TExpr::RealValueType >::Type GetNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1380
VariableLengthVectorExpression::VariableLengthVectorExpression
VariableLengthVectorExpression(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1235
itkNumericTraits.h
itk::VariableLengthVector::VariableLengthVector
VariableLengthVector(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:402
itk::VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:36
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::VariableLengthVector::RealValueType
typename NumericTraits< ValueType >::RealType RealValueType
Definition: itkVariableLengthVector.h:322
itk::VariableLengthVector::operator=
Self & operator=(const VariableLengthVector< T > &v)
Definition: itkVariableLengthVector.h:532
itk::VariableLengthVector::operator++
Self operator++(int)
Definition: itkVariableLengthVector.h:811
itk::VariableLengthVector::GetElement
const TValue & GetElement(unsigned int i) const
Definition: itkVariableLengthVector.h:616
itk::VariableLengthVector::ComponentType
TValue ComponentType
Definition: itkVariableLengthVector.h:321
itk::VariableLengthVector::operator*=
Self & operator*=(T s)
Definition: itkVariableLengthVector.h:937
itkStaticAssert.h
itk::VariableLengthVector::AlwaysReallocate
Definition: itkVariableLengthVector.h:128
itk::VariableLengthVector::DumpOldValues
Definition: itkVariableLengthVector.h:305
itk::VariableLengthVector::operator*=
Self & operator*=(TValue s)
Definition: itkVariableLengthVector.h:952
itk::VariableLengthVector::operator+
mpl::EnableIf< Details::op::CanBeAddedOrSubtracted< TExpr1, TExpr2 >, VariableLengthVectorExpression< TExpr1, TExpr2, Details::op::Plus > >::Type operator+(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1300
itk::VariableLengthVector::operator++
Self & operator++()
Definition: itkVariableLengthVector.h:787