MCPcopy Create free account
hub / github.com/MITK/MITK / Vector

Class Vector

Modules/Core/include/mitkVector.h:38–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 */
37 template <class TCoordRep, unsigned int NVectorDimension = 3>
38 class Vector : public itk::Vector<TCoordRep, NVectorDimension>
39 {
40 public:
41 /** \brief Default constructor. */
42 explicit Vector() : itk::Vector<TCoordRep, NVectorDimension>() {}
43
44 /** \brief Copy constructor. */
45 explicit Vector(const mitk::Vector<TCoordRep, NVectorDimension> &r)
46 : itk::Vector<TCoordRep, NVectorDimension>(r)
47 {
48 }
49
50 /** Pass-through assignment operator for the Vector base class. */
51 Vector<TCoordRep, NVectorDimension> & operator=(const Vector<TCoordRep, NVectorDimension> & r)
52 {
53 itk::Vector<TCoordRep, NVectorDimension>::operator=(r);
54 return *this;
55 }
56
57 /**
58 * \brief Constructor to convert from itk::Vector to mitk::Vector.
59 */
60 Vector(const itk::Vector<TCoordRep, NVectorDimension> &r)
61 : itk::Vector<TCoordRep, NVectorDimension>(r)
62 {
63 }
64
65 /**
66 * \brief Constructor to convert an array to mitk::Vector.
67 * \param[in] r The array.
68 * \attention Must have NVectorDimension valid arguments!
69 */
70 Vector(const TCoordRep r[NVectorDimension])
71 : itk::Vector<TCoordRep, NVectorDimension>(r)
72 {
73 }
74
75 /**
76 * Constructor to initialize entire vector to one value.
77 */
78 Vector(const TCoordRep &v) : itk::Vector<TCoordRep, NVectorDimension>(v) {}
79 /**
80 * \brief Constructor for vnl_vectors.
81 * \throws mitk::Exception If vnl_vector.size() != NVectorDimension.
82 */
83 Vector(const vnl_vector<TCoordRep> &vnlVector)
84 : itk::Vector<TCoordRep, NVectorDimension>()
85 {
86 if (vnlVector.size() != NVectorDimension)
87 mitkThrow() << "when constructing mitk::Vector from vnl_vector: sizes didn't match: mitk::Vector "
88 << NVectorDimension << "; vnl_vector " << vnlVector.size();
89
90 for (unsigned int var = 0; (var < NVectorDimension) && (var < vnlVector.size()); ++var)
91 {
92 this->SetElement(var, vnlVector.get(var));
93 }
94 }
95

Calls

no outgoing calls