ITK  5.3.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  ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self);
992 
994  RealValueType
995  GetNorm() const;
996 
998  RealValueType
999  GetSquaredNorm() const;
1000 
1002  bool
1003  IsAProxy() const
1004  {
1005  return !m_LetArrayManageMemory;
1006  }
1007 
1008 private:
1009  bool m_LetArrayManageMemory{ true }; // if true, the array is responsible
1010  // for memory of data
1011  TValue * m_Data; // Array to hold data
1012  ElementIdentifier m_NumElements{ 0 };
1013 };
1014 
1016 namespace mpl
1017 {
1027 template <typename T>
1028 struct IsArray : FalseType
1029 {};
1030 
1032 template <typename T>
1033 struct IsArray<itk::VariableLengthVector<T>> : TrueType
1034 {};
1035 
1036 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1037 struct IsArray<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>> : TrueType
1038 {};
1040 } // namespace mpl
1042 
1043 namespace Details
1044 {
1046 
1058 template <typename TExpr>
1059 struct GetType
1060 {
1061  using Type = TExpr;
1062 
1066  static Type
1067  Load(Type const & v, unsigned int idx)
1068  {
1069  (void)idx;
1070  return v;
1071  }
1072 };
1074 
1085 template <typename TExpr1, typename TExpr2>
1086 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>, unsigned int>::Type
1087 GetSize(TExpr1 const & lhs, TExpr2 const & rhs)
1088 {
1089  (void)rhs;
1090  itkAssertInDebugAndIgnoreInReleaseMacro(lhs.Size() == rhs.Size());
1091  return lhs.Size();
1092 }
1094 
1096 
1105 template <typename TExpr1, typename TExpr2>
1106 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr1>, mpl::Not<mpl::IsArray<TExpr2>>>, unsigned int>::Type
1107 GetSize(TExpr1 const & lhs, TExpr2 const & itkNotUsed(rhs))
1108 {
1109  return lhs.Size();
1110 }
1111 
1121 template <typename TExpr1, typename TExpr2>
1122 inline typename mpl::EnableIf<mpl::And<mpl::IsArray<TExpr2>, mpl::Not<mpl::IsArray<TExpr1>>>, unsigned int>::Type
1123 GetSize(TExpr1 const & itkNotUsed(lhs), TExpr2 const & rhs)
1124 {
1125  return rhs.Size();
1126 }
1127 
1128 template <typename T>
1129 struct GetType<VariableLengthVector<T>>
1130 {
1131  using Type = T;
1132  static Type
1133  Load(VariableLengthVector<T> const & v, unsigned int idx)
1134  {
1135  return v[idx];
1136  }
1137 };
1138 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1139 struct GetType<VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp>>
1140 {
1142  static Type
1143  Load(VariableLengthVectorExpression<TExpr1, TExpr2, TBinaryOp> const & v, unsigned int idx)
1144  {
1145  return v[idx];
1146  }
1147 };
1149 
1150 namespace op
1151 {
1164 template <typename TExpr1, typename TExpr2>
1166  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsArray<TExpr2>>,
1167  mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1168  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1169 {};
1170 
1182 template <typename TExpr1, typename TExpr2>
1184  : mpl::Or<mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>,
1185  mpl::And<mpl::IsNumber<TExpr1>, mpl::IsArray<TExpr2>>>
1186 {};
1187 
1199 template <typename TExpr1, typename TExpr2>
1200 struct CanBeDivided : mpl::And<mpl::IsArray<TExpr1>, mpl::IsNumber<TExpr2>>
1201 {};
1202 
1203 } // namespace op
1204 } // namespace Details
1206 
1231 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1233 {
1234  VariableLengthVectorExpression(TExpr1 const & lhs, TExpr2 const & rhs)
1235  : m_lhs(lhs)
1236  , m_rhs(rhs)
1237  {
1238  // Not neccessary actually as end-user/developer is not expected to
1239  // provide new BinaryOperations
1240  itkStaticAssert((itk::mpl::IsBaseOf<Details::op::BinaryOperationConcept, TBinaryOp>::Value),
1241  "The Binary Operation shall inherit from BinaryOperationConcept");
1242  }
1243 
1245  unsigned int
1246  Size() const
1247  {
1248  return Details::GetSize(m_lhs, m_rhs);
1249  }
1250 
1252  using ResType =
1253  typename mpl::PromoteType<typename Details::GetType<TExpr1>::Type, typename Details::GetType<TExpr2>::Type>::Type;
1256 
1267  ResType operator[](unsigned int idx) const
1268  {
1269  itkAssertInDebugAndIgnoreInReleaseMacro(idx < Size());
1270  return TBinaryOp::Apply(Details::GetType<TExpr1>::Load(m_lhs, idx), Details::GetType<TExpr2>::Load(m_rhs, idx));
1271  }
1273 
1275  RealValueType
1276  GetNorm() const;
1277 
1279  RealValueType
1280  GetSquaredNorm() const;
1281 
1282 private:
1283  TExpr1 const & m_lhs;
1284  TExpr2 const & m_rhs;
1285 };
1286 
1296 template <typename TExpr1, typename TExpr2>
1297 inline typename mpl::EnableIf<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>,
1299 operator+(TExpr1 const & lhs, TExpr2 const & rhs)
1300 {
1302 }
1303 
1313 template <typename TExpr1, typename TExpr2>
1314 inline typename mpl::EnableIf<Details::op::CanBeAddedOrSubtracted<TExpr1, TExpr2>,
1316 operator-(TExpr1 const & lhs, TExpr2 const & rhs)
1317 {
1319 }
1320 
1329 template <typename TExpr1, typename TExpr2>
1330 inline typename mpl::EnableIf<Details::op::CanBeMultiplied<TExpr1, TExpr2>,
1332 operator*(TExpr1 const & lhs, TExpr2 const & rhs)
1333 {
1335 }
1336 
1344 template <typename TExpr1, typename TExpr2>
1345 inline typename mpl::EnableIf<Details::op::CanBeDivided<TExpr1, TExpr2>,
1347 operator/(TExpr1 const & lhs, TExpr2 const & rhs)
1348 {
1350 }
1351 
1355 template <typename TExpr1, typename TExpr2, typename TBinaryOp>
1356 std::ostream &
1358 {
1359  os << "[";
1360  if (v.Size() != 0)
1361  {
1362  os << v[0];
1363  for (unsigned int i = 1, N = v.Size(); i != N; ++i)
1364  {
1365  os << ", " << v[i];
1366  }
1367  }
1368  return os << "]";
1369 }
1371 
1377 template <typename TExpr>
1378 inline typename mpl::EnableIf<mpl::IsArray<TExpr>, typename TExpr::RealValueType>::Type
1379 GetNorm(TExpr const & v)
1380 {
1381  return static_cast<typename TExpr::RealValueType>(std::sqrt(static_cast<double>(GetSquaredNorm(v))));
1382 }
1383 
1389 template <typename TExpr>
1390 inline typename mpl::EnableIf<mpl::IsArray<TExpr>, typename TExpr::RealValueType>::Type
1391 GetSquaredNorm(TExpr const & v)
1392 {
1393  using RealValueType = typename TExpr::RealValueType;
1394  RealValueType sum = 0.0;
1395  for (unsigned int i = 0, N = v.Size(); i < N; ++i)
1396  {
1397  const RealValueType value = v[i];
1398  sum += value * value;
1399  }
1400  return sum;
1401 }
1403 
1406 
1410 template <typename TValue>
1411 std::ostream &
1412 operator<<(std::ostream & os, const VariableLengthVector<TValue> & arr)
1413 {
1414  const unsigned int length = arr.Size();
1415  const signed int last = (unsigned int)length - 1;
1417 
1418  os << "[";
1419  for (signed int i = 0; i < last; ++i)
1420  {
1421  os << arr[i] << ", ";
1422  }
1423  if (length >= 1)
1424  {
1425  os << arr[last];
1426  }
1427  os << "]";
1428  return os;
1429 }
1431 
1434 
1452 template <typename T>
1453 inline void
1455 {
1456  l_.Swap(r_);
1457 }
1459 
1460 
1461 } // namespace itk
1462 
1464 
1465 #ifndef ITK_MANUAL_INSTANTIATION
1466 # include "itkVariableLengthVector.hxx"
1467 #endif
1468 
1469 #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:1165
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:1246
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
VariableLengthVectorExpression
Definition: itkVariableLengthVector.h:1232
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:1332
VariableLengthVectorExpression::m_rhs
const TExpr2 & m_rhs
Definition: itkVariableLengthVector.h:1284
itkEnableIf.h
itkPromoteType.h
itk::VariableLengthVector::DontShrinkToFit
Definition: itkVariableLengthVector.h:223
VariableLengthVectorExpression::operator[]
ResType operator[](unsigned int idx) const
Definition: itkVariableLengthVector.h:1267
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:1347
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:672
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:1316
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:1043
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:1255
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:1391
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:1200
Details::op::CanBeMultiplied
Definition: itkVariableLengthVector.h:1183
itk::VariableLengthVector::m_Data
TValue * m_Data
Definition: itkVariableLengthVector.h:1011
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:1003
itk::VariableLengthVector::swap
void swap(VariableLengthVector< T > &l_, VariableLengthVector< T > &r_) noexcept
Definition: itkVariableLengthVector.h:1454
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::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:1283
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:1253
itk::VariableLengthVectorExpression::GetNorm
mpl::EnableIf< mpl::IsArray< TExpr >, typename TExpr::RealValueType >::Type GetNorm(TExpr const &v)
Definition: itkVariableLengthVector.h:1379
VariableLengthVectorExpression::VariableLengthVectorExpression
VariableLengthVectorExpression(TExpr1 const &lhs, TExpr2 const &rhs)
Definition: itkVariableLengthVector.h:1234
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:1299
itk::VariableLengthVector::operator++
Self & operator++()
Definition: itkVariableLengthVector.h:787