Create A Vector

Synopsis

Create a Vector

Results

Output:

v: [1, 2, 3]

Code

C++

#include "itkVector.h"

int
main(int, char *[])
{
  constexpr unsigned int Dimension = 3;
  using CoordType = double;

  using VectorType = itk::Vector<CoordType, Dimension>;

  VectorType v;
  v[0] = 1.0;
  v[1] = 2.0;
  v[2] = 3.0;
  std::cout << "v: " << v << std::endl;

  return EXIT_SUCCESS;
}

Python

#!/usr/bin/env python
#
# ==========================================================================*/

import itk

Dimension = 3
CoordType = itk.D

VectorType = itk.Vector[CoordType, Dimension]

v = VectorType()
v[0] = 1.0
v[1] = 2.0
v[2] = 3.0
print("v: " + str(v))

Classes demonstrated