16 #include <itkVector.h>
17 #include <vnl/vnl_vector.h>
18 #include <vnl/vnl_vector_fixed.h>
27 template <
class TCoordRep,
unsigned int NVectorDimension = 3>
28 class Vector :
public itk::Vector<TCoordRep, NVectorDimension>
39 :
itk::
Vector<TCoordRep, NVectorDimension>(r)
46 itk::Vector<TCoordRep, NVectorDimension>::operator=(r);
54 :
itk::
Vector<TCoordRep, NVectorDimension>(r)
64 :
itk::
Vector<TCoordRep, NVectorDimension>(r)
77 :
itk::
Vector<TCoordRep, NVectorDimension>()
79 if (vnlVector.size() != NVectorDimension)
80 mitkThrow() <<
"when constructing mitk::Vector from vnl_vector: sizes didn't match: mitk::Vector "
81 << NVectorDimension <<
"; vnl_vector " << vnlVector.size();
83 for (
unsigned int var = 0; (var < NVectorDimension) && (var < vnlVector.size()); ++var)
85 this->SetElement(var, vnlVector.get(var));
93 :
itk::
Vector<TCoordRep, NVectorDimension>()
95 for (
unsigned int var = 0; var < NVectorDimension; ++var)
97 this->SetElement(var, vnlVectorFixed[var]);
107 template <
typename ArrayType>
110 itk::FixedArray<TCoordRep, NVectorDimension> *thisP =
111 dynamic_cast<itk::FixedArray<TCoordRep, NVectorDimension> *
>(
this);
112 mitk::FillArray<ArrayType, TCoordRep, NVectorDimension>(*thisP, array);
120 template <
typename ArrayType>
123 mitk::ToArray<ArrayType, TCoordRep, NVectorDimension>(array, *
this);
131 operator vnl_vector<TCoordRep>()
const {
return this->GetVnlVector(); }
154 template <
typename TCoordRep,
unsigned int NPo
intDimension>
155 inline bool Equal(
const itk::Vector<TCoordRep, NPointDimension> &vector1,
156 const itk::Vector<TCoordRep, NPointDimension> &vector2,
158 bool verbose =
false)
161 typename itk::Vector<TCoordRep, NPointDimension>::VectorType diff = vector1 - vector2;
162 for (
unsigned int i = 0; i < NPointDimension; i++)
188 bool verbose =
false)
192 for (
unsigned int i = 0; i < diff.size(); i++)
215 template <
typename TCoordRep,
unsigned int NPo
intDimension>
216 inline bool Equal(
const vnl_vector_fixed<TCoordRep, NPointDimension> &vector1,
217 const vnl_vector_fixed<TCoordRep, NPointDimension> &vector2,
219 bool verbose =
false)
221 vnl_vector_fixed<TCoordRep, NPointDimension> diff = vector1 - vector2;
223 for (
unsigned int i = 0; i < diff.size(); i++)