20 #include <itkVector.h>
21 #include <vnl/vnl_vector.h>
22 #include <vnl/vnl_vector_fixed.h>
31 template <
class TCoordRep,
unsigned int NVectorDimension = 3>
32 class Vector :
public itk::Vector<TCoordRep, NVectorDimension>
43 : itk::Vector<TCoordRep, NVectorDimension>(r)
51 : itk::Vector<TCoordRep, NVectorDimension>(r)
61 : itk::Vector<TCoordRep, NVectorDimension>(r)
74 : itk::Vector<TCoordRep, NVectorDimension>()
76 if (vnlVector.size() != NVectorDimension)
77 mitkThrow() <<
"when constructing mitk::Vector from vnl_vector: sizes didn't match: mitk::Vector "
78 << NVectorDimension <<
"; vnl_vector " << vnlVector.size();
80 for (
unsigned int var = 0; (var < NVectorDimension) && (var < vnlVector.size()); ++var)
82 this->SetElement(var, vnlVector.get(var));
90 : itk::Vector<TCoordRep, NVectorDimension>()
92 for (
unsigned int var = 0; var < NVectorDimension; ++var)
94 this->SetElement(var, vnlVectorFixed[var]);
104 template <
typename ArrayType>
107 itk::FixedArray<TCoordRep, NVectorDimension> *thisP =
108 dynamic_cast<itk::FixedArray<TCoordRep, NVectorDimension> *
>(
this);
109 mitk::FillArray<ArrayType, TCoordRep, NVectorDimension>(*thisP, array);
117 template <
typename ArrayType>
120 mitk::ToArray<ArrayType, TCoordRep, NVectorDimension>(array, *
this);
128 operator vnl_vector<TCoordRep>()
const {
return this->GetVnlVector(); }
151 template <
typename TCoordRep,
unsigned int NPo
intDimension>
152 inline bool Equal(
const itk::Vector<TCoordRep, NPointDimension> &vector1,
153 const itk::Vector<TCoordRep, NPointDimension> &vector2,
155 bool verbose =
false)
159 for (
unsigned int i = 0; i < NPointDimension; i++)
185 bool verbose =
false)
189 for (
unsigned int i = 0; i < diff.size(); i++)
212 template <
typename TCoordRep,
unsigned int NPo
intDimension>
213 inline bool Equal(
const vnl_vector_fixed<TCoordRep, NPointDimension> &vector1,
214 const vnl_vector_fixed<TCoordRep, NPointDimension> &vector2,
216 bool verbose =
false)
218 vnl_vector_fixed<TCoordRep, NPointDimension> diff = vector1 - vector2;
220 for (
unsigned int i = 0; i < diff.size(); i++)
void ConditionalOutputOfDifference(ElementToOutput1 elem1, ElementToOutput2 elem2, mitk::ScalarType eps, bool verbose, bool isEqual)
void ToArray(ArrayType array) const
vnl_vector< ScalarType > VnlVector
DataCollection - Class to facilitate loading/accessing structured data.
Vector< ScalarType, 4 > Vector4D
itk::Vector< float, 3 > VectorType
void FillVector(const ArrayType &array)
Vector< ScalarType, 2 > Vector2D
Vector< ScalarType, 3 > Vector3D
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon=mitk::eps)