diff --git a/Core/Code/DataManagement/mitkTypeConversions.h b/Core/Code/DataManagement/mitkArray.h similarity index 69% rename from Core/Code/DataManagement/mitkTypeConversions.h rename to Core/Code/DataManagement/mitkArray.h index 911206f7a4..55cf9a92c0 100644 --- a/Core/Code/DataManagement/mitkTypeConversions.h +++ b/Core/Code/DataManagement/mitkArray.h @@ -1,98 +1,141 @@ /* - * mitkTypeConversions.h + * mitkArray.h * * Created on: Nov 11, 2013 * Author: wirkert */ -#ifndef MITKTYPECONVERSIONS_H_ -#define MITKTYPECONVERSIONS_H_ +#ifndef MITKARRAY_H_ +#define MITKARRAY_H_ +#include #include "mitkConstants.h" +#include "mitkEqual.h" namespace mitk { /** - * Now methods to copy from and into ArrayTypes. + * Methods to copy from itk::FixedArray s (like mitk::Vector and mitk::Point) into ArrayTypes and vice versa. * ArrayTypes here are all types who implement operator[]. * The two templated methods were made free floating so you may specialize them * for your concrete type. */ /** * @brief Copies elements of an array to this Vector * @param[in] array the array whose values will be copied into the Vector. Must be of a type which overrides the [] operator * @param[out] toArray the FixedArrray (e.g., mitk::Vector or mitk::Point) which should hold the elements of array. * @attention array must be of dimension NVectorDimension! * @attention this method implicitly converts between data types. */ template void FromArray(itk::FixedArray& toArray, const ArrayType& array) { itk::FixedArray vectorOrPoint; for (unsigned short int var = 0; var < NVectorDimension; ++var) { toArray[var] = array[var]; } } /** * @brief Copies elements of an array to this Vector * @param[in] array the array whose values will be copied into the Vector. Must be of a type which overrides the [] operator * @param return the FixedArrray (e.g., mitk::Vector or mitk::Point) which should hold the elements of array. * @attention array must be of dimension NVectorDimension! * @attention this method implicitly converts between data types. */ template itk::FixedArray FromArray(const ArrayType& array) { itk::FixedArray vectorOrPoint; mitk::FromArray(vectorOrPoint, array); return vectorOrPoint; } /** * @brief Copies the elements of this into an array * @param[in] vectorOrPoint the itk::FixedArray which shall be copied into the array. Can e.g. be of type mitk::Vector or mitk::Point * @param[out] array the array which will hold the elements. Must be of a type which overrides the [] operator. * @attention array must be of dimension NVectorDimension! * @attention this method implicitly converts between data types. */ template void ToArray(ArrayType& array, const itk::FixedArray& vectorOrPoint) { for (unsigned short int var = 0; var < NVectorDimension; ++var) { array[var] = vectorOrPoint[var]; } } /** * @brief Copies the elements of this into an array * @param[in] vectorOrPoint the itk::FixedArray which shall be copied into the array. Can e.g. be of type mitk::Vector or mitk::Point * @return the array which will hold the elements. Must be of a type which overrides the [] operator. * @attention array must be of dimension NVectorDimension! * @attention this method implicitly converts between data types. */ template ArrayType ToArray(const itk::FixedArray& vectorOrPoint) { ArrayType result; mitk::ToArray(result, vectorOrPoint); return result; } + + // The FillVector3D and FillVector4D methods are implemented for all common array types here + + template + inline void FillVector3D(Tout& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z) + { + out[0] = x; + out[1] = y; + out[2] = z; + } + + template + inline void FillVector4D(Tout& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z, mitk::ScalarType t) + { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = t; + } + + + + /** + * Compares two ArrayTypes of size size. + * ArrayTypes are all Objects/Types who have a [] operator. Pay attention not to set size higher + * than the actual size of the ArrayType. For POD arrays like float array[4] this will lead to unexpected results. + */ + template + inline bool EqualArray(TArrayType1& arrayType1, TArrayType2& arrayType2, int size, ScalarType eps = mitk::eps, bool verbose = false) + { + bool isEqual = true; + for (int var = 0; var < size; ++var) + { + isEqual = isEqual && Equal(arrayType1[var], arrayType2[var], eps); + } + + ConditionalOutputOfDifference(arrayType1, arrayType2, eps, verbose, isEqual); + + return isEqual; + } + } -#endif /* MITKTYPECONVERSIONS_H_ */ +#endif /* MITKARRAY_H_ */ diff --git a/Core/Code/DataManagement/mitkEqual.h b/Core/Code/DataManagement/mitkEqual.h index 81adc166d4..750e4ee07e 100644 --- a/Core/Code/DataManagement/mitkEqual.h +++ b/Core/Code/DataManagement/mitkEqual.h @@ -1,71 +1,72 @@ /* * mitkEqual.h * * Created on: Apr 14, 2014 * Author: wirkert */ #ifndef MITKEQUAL_H_ #define MITKEQUAL_H_ +#include #include "mitkConstants.h" #include "mitkLogMacros.h" namespace mitk { /** * Helper method to check if the difference is bigger or equal to a given epsilon * * @param diff the difference to be checked against the epsilon * @param the epsilon. The absolute difference needs to be smaller than this. * @return true if abs(diff) >= eps */ template inline bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon = mitk::eps) { return fabs(diff) >= epsilon; } /** * outputs elem1, elem2 and eps in case verbose and !isEqual. * Elem can e.g. be a mitk::Vector or an mitk::Point. * * @param elem1 first element to be output * @param elem2 second * @param eps the epsilon which their difference was bigger than * @param verbose tells the function if something shall be output * @param isEqual function will only output something if the two elements are not equal */ template inline void ConditionalOutputOfDifference(ElementToOutput1 elem1, ElementToOutput2 elem2, mitk::ScalarType eps, bool verbose, bool isEqual) { if(verbose && !isEqual) { MITK_INFO << typeid(ElementToOutput1).name() << " and " << typeid(ElementToOutput2).name() << " not equal. Lefthandside " << std::setprecision(12) << elem1 << " - Righthandside " << elem2 << " - epsilon " << eps; } } /** * @ingroup MITKTestingAPI * * @param scalar1 Scalar value to compare. * @param scalar2 Scalar value to compare. * @param eps Tolerance for floating point comparison. * @param verbose Flag indicating detailed console output. * @return True if scalars are equal. */ inline bool Equal(ScalarType scalar1, ScalarType scalar2, ScalarType eps=mitk::eps, bool verbose=false) { bool isEqual( !DifferenceBiggerOrEqualEps(scalar1-scalar2, eps)); ConditionalOutputOfDifference(scalar1, scalar2, eps, verbose, isEqual); return isEqual; } } #endif /* MITKEQUAL_H_ */ diff --git a/Core/Code/DataManagement/mitkMatrix.h b/Core/Code/DataManagement/mitkMatrix.h index 4b738ecdde..0c183e4942 100644 --- a/Core/Code/DataManagement/mitkMatrix.h +++ b/Core/Code/DataManagement/mitkMatrix.h @@ -1,86 +1,171 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKMATRIX_H_ #define MITKMATRIX_H_ -#include "mitkConstants.h" #include +#include "mitkConstants.h" +#include "mitkArray.h" +#include "mitkEqual.h" + namespace mitk { template< class T, unsigned int NRows = 3, unsigned int NColumns = 3 > class Matrix : public itk::Matrix { public: /** Standard class typedefs. */ typedef Matrix Self; typedef typename itk::Matrix::InternalMatrixType InternalMatrixType; /** Default constructor. */ Matrix() : itk::Matrix() {} /** Copy constructor. */ Matrix(const Matrix & matrix) : itk::Matrix(matrix) {} /** Copy constructor for itk compatibility */ Matrix(const itk::Matrix & matrix) : itk::Matrix(matrix) {} /**For every operator=, there should be an equivalent copy constructor. */ inline Matrix(const vnl_matrix< T > & matrix) : itk::Matrix(matrix) {} /**For every operator=, there should be an equivalent copy constructor. */ inline explicit Matrix(InternalMatrixType & matrix) : itk::Matrix(matrix) {} /** * Necessary because otherwise operator= is default operator= from Matrix. */ using itk::Matrix::operator=; /** * Warning: Array must have same dimension as Matrix */ void CopyToArray(ScalarType const array_p[NRows][NColumns]) const { for (int i = 0; i < this->GetPointDimension(); i++) { array_p[i] = this->GetElement(i); } } }; typedef Matrix Matrix2D; typedef Matrix Matrix3D; typedef Matrix Matrix4D; // other matrix types used in mitk code typedef vnl_matrix_fixed VnlMatrix3D; + + /*! + \brief Check for matrix equality with a user defined accuracy. As an equality metric the root mean squared error (RMS) of all elements is calculated. + \param matrix1 first vnl matrix + \param matrix2 second vnl matrix + \param epsilon user defined accuracy bounds + */ + template + inline bool MatrixEqualRMS(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) + { + if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) + { + vnl_matrix_fixed differenceMatrix = matrix1-matrix2; + if (differenceMatrix.rms() + inline bool MatrixEqualRMS(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) + { + return mitk::MatrixEqualRMS(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); + } + + /*! + \brief Check for element-wise matrix equality with a user defined accuracy. + \param matrix1 first vnl matrix + \param matrix2 second vnl matrix + \param epsilon user defined accuracy bounds + */ + template + inline bool MatrixEqualElementWise(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) + { + if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) + { + for( unsigned int r=0; r + inline bool MatrixEqualElementWise(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) + { + return mitk::MatrixEqualElementWise(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); + } + } #endif /* MITKMATRIX_H_ */ diff --git a/Core/Code/DataManagement/mitkPoint.h b/Core/Code/DataManagement/mitkPoint.h index 26c65db0ed..97ae2fdad6 100644 --- a/Core/Code/DataManagement/mitkPoint.h +++ b/Core/Code/DataManagement/mitkPoint.h @@ -1,127 +1,142 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKPOINT_H #define MITKPOINT_H #include -#include "mitkConstants.h" +#include "mitkConstants.h" +#include "mitkArray.h" +#include "mitkEqual.h" namespace mitk { //##Documentation //##@brief enumeration of the type a point can be enum PointSpecificationType { PTUNDEFINED = 0, PTSTART, PTCORNER, PTEDGE, PTEND }; template class Point : public itk::Point { public: /** Default constructor has nothing to do. */ Point() : itk::Point() {} /** Pass-through constructors for the Array base class. */ template< typename TPointValueType > Point(const Point< TPointValueType, NPointDimension > & r):itk::Point(r) {} template< typename TPointValueType > Point(const TPointValueType r[NPointDimension]):itk::Point(r) {} template< typename TPointValueType > Point(const TPointValueType & v):itk::Point(v) {} Point(const mitk::Point& r) : itk::Point(r) {} Point(const TCoordRep r[NPointDimension]):itk::Point(r) {} Point(const TCoordRep & v):itk::Point(v) {} Point(const itk::Point & p) : itk::Point(p) {} /** Pass-through assignment operator for the Array base class. */ /** * Assignment Operator */ Point< TCoordRep, NPointDimension > & operator=(const Point & r) { itk::Point::operator=(r); return *this; } /** * Assignment from a plain array */ Point< TCoordRep, NPointDimension > & operator=(const TCoordRep r[NPointDimension]) { itk::Point::operator=(r); return *this; } /** * Warning: Array must have same dimension as Point */ void CopyToArray(ScalarType array_p[NPointDimension]) const { for (unsigned int i = 0; i < this->GetPointDimension(); i++) { array_p[i] = this->GetElement(i); } } }; typedef Point Point2D; typedef Point Point3D; typedef Point Point4D; typedef Point Point2I; typedef Point Point3I; typedef Point Point4I; -/** - inline void FillVector3D(Point& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z) - { - out[0] = x; - out[1] = y; - out[2] = z; - } - inline void FillVector4D(Point& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z, mitk::ScalarType t) + + /** + * @ingroup MITKTestingAPI + * + * @param point1 Point to compare. + * @param point2 Point to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if points are equal. + */ + template + inline bool Equal(const itk::Point& point1, const itk::Point& point2, TCoordRep eps=mitk::eps, bool verbose=false) { - out[0] = x; - out[1] = y; - out[2] = z; - out[4] = t; + bool isEqual = true; + typename itk::Point::VectorType diff = point1-point2; + for (unsigned int i=0; i #include #include #include #include #include #include #include #include -#include + #include "mitkConstants.h" #include "mitkQuaternion.h" #include "mitkPoint.h" // TODO SW: should not be included here, maybe generate one "general datatype include" like mitkPrimitives.h #include "mitkVector.h" #include "mitkMatrix.h" #include "mitkEqual.h" #include "mitkOldTypeConversions.h" -#ifndef DOXYGEN_SKIP - -namespace mitk { - - - -/*! -\brief Check for matrix equality with a user defined accuracy. As an equality metric the root mean squared error (RMS) of all elements is calculated. -\param matrix1 first vnl matrix -\param matrix2 second vnl matrix -\param epsilon user defined accuracy bounds -*/ -template -inline bool MatrixEqualRMS(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) -{ - if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) - { - vnl_matrix_fixed differenceMatrix = matrix1-matrix2; - if (differenceMatrix.rms() -inline bool MatrixEqualRMS(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) -{ - return mitk::MatrixEqualRMS(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); -} - -/*! -\brief Check for element-wise matrix equality with a user defined accuracy. -\param matrix1 first vnl matrix -\param matrix2 second vnl matrix -\param epsilon user defined accuracy bounds -*/ -template -inline bool MatrixEqualElementWise(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) -{ - if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) - { - for( unsigned int r=0; r -inline bool MatrixEqualElementWise(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) -{ - return mitk::MatrixEqualElementWise(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); -} - -/** - * @ingroup MITKTestingAPI - * - * @param vector1 Vector to compare. - * @param vector2 Vector to compare. - * @param eps Tolerance for floating point comparison. - * @param verbose Flag indicating detailed console output. - * @return True if vectors are equal. - */ -template -inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2, TCoordRep eps=mitk::eps, bool verbose=false) -{ - bool isEqual = true; - typename itk::Vector::VectorType diff = vector1-vector2; - for (unsigned int i=0; i - inline bool Equal(const itk::Point& point1, const itk::Point& point2, TCoordRep eps=mitk::eps, bool verbose=false) -{ - bool isEqual = true; - typename itk::Point::VectorType diff = point1-point2; - for (unsigned int i=0; i - inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2, TCoordRep eps=mitk::eps, bool verbose=false) -{ - vnl_vector_fixed diff = vector1-vector2; - bool isEqual = true; - for( unsigned int i=0; i - inline bool EqualArray(TArrayType1& arrayType1, TArrayType2& arrayType2, int size, ScalarType eps = mitk::eps, bool verbose = false) -{ - bool isEqual = true; - for (int var = 0; var < size; ++var) - { - isEqual = isEqual && Equal(arrayType1[var], arrayType2[var], eps); - } - - ConditionalOutputOfDifference(arrayType1, arrayType2, eps, verbose, isEqual); - - return isEqual; -} - - - - - -} // namespace mitk - -#endif //DOXYGEN_SKIP - /* * This part of the code has been shifted here to avoid compiler clashes * caused by including before the declaration of * the Equal() methods above. This problem occurs when using MSVC and is * probably related to a compiler bug. */ #include namespace mitk { typedef itk::AffineGeometryFrame::TransformType AffineTransform3D; } #define mitkSetConstReferenceMacro(name,type) \ virtual void Set##name (const type & _arg) \ { \ itkDebugMacro("setting " << #name " to " << _arg ); \ if (this->m_##name != _arg) \ { \ this->m_##name = _arg; \ this->Modified(); \ } \ } #define mitkSetVectorMacro(name,type) \ mitkSetConstReferenceMacro(name,type) #define mitkGetVectorMacro(name,type) \ itkGetConstReferenceMacro(name,type) #endif /* MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/DataManagement/mitkVector.h b/Core/Code/DataManagement/mitkVector.h index 2376dd9f5a..888c01406e 100644 --- a/Core/Code/DataManagement/mitkVector.h +++ b/Core/Code/DataManagement/mitkVector.h @@ -1,228 +1,250 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKVECTOR_H_ #define MITKVECTOR_H_ #include #include #include #include "mitkConstants.h" -#include "mitkTypeConversions.h" +#include "mitkArray.h" +#include "mitkEqual.h" #include "mitkExceptionMacro.h" namespace mitk { template class Vector : public itk::Vector { public: /** * @brief Default constructor has nothing to do. */ explicit Vector() : itk::Vector() {} /** * @brief Copy constructor. */ explicit Vector(const mitk::Vector& r) : itk::Vector(r) {} /** * @brief Constructor to convert from itk::Vector to mitk::Vector. */ Vector(const itk::Vector& r) : itk::Vector(r) {} /** * @brief Constructor to convert an array to mitk::Vector * @param r the array. * @attention must have NVectorDimension valid arguments! */ Vector(const TCoordRep r[NVectorDimension]) : itk::Vector(r) {} /** * Constructor to initialize entire vector to one value. */ Vector(const TCoordRep & v) : itk::Vector(v) {} /** * @brief Constructor for vnl_vectors. * @throws mitk::Exception if vnl_vector.size() != NVectorDimension. */ Vector(const vnl_vector& vnlVector) : itk::Vector() { if (vnlVector.size() != NVectorDimension) mitkThrow() << "when constructing mitk::Vector from vnl_vector: sizes didn't match: mitk::Vector " << NVectorDimension << "; vnl_vector " << vnlVector.size(); for (unsigned int var = 0; (var < NVectorDimension) && (var < vnlVector.size()); ++var) { this->SetElement(var, vnlVector.get(var)); } } /** * @brief Constructor for vnl_vector_fixed. */ Vector(const vnl_vector_fixed& vnlVectorFixed) : itk::Vector() { for (unsigned int var = 0; var < NVectorDimension; ++var) { this->SetElement(var, vnlVectorFixed[var]); } }; /** * Copies the elements from array array to this. * Note that this method will assign doubles to floats without complaining! * * @param array the array whose values shall be copied. Must overload [] operator. */ template void FromArray(const ArrayType& array) { itk::FixedArray* thisP = dynamic_cast* >(this); mitk::FromArray(*thisP, array); } /** * Copies the elements of this vector to an array of type ArrayType * Note that this method will assign doubles to floats without complaining! * * @return the array holding the elements of this. Only requierement is that it overloads the [] operator */ template ArrayType ToArray() { ArrayType result = mitk::ToArray(*this); return result; } /** * Copies the values stored in this vector into the array array. * This method has to be used over the version returning the array when * copying to pod arrays. * Furthermore, the syntax may be a little bit nicer because ArrayType can be * inferred from the parameter. * * @param array the array which should store the values of this. */ template void ToArray(ArrayType array) { mitk::ToArray(array, *this); } /** * @brief User defined conversion of mitk::Vector to vnl_vector. * Note: the conversion to mitk::Vector to vnl_vector_fixed has not been implemented since this * would collide with the conversion vnl_vector to vnl_vector_fixed provided by vnl. */ operator vnl_vector () const { return this->GetVnlVector(); } }; // end mitk::Vector // convenience typedefs for often used mitk::Vector representations. typedef Vector Vector2D; typedef Vector Vector3D; typedef Vector Vector4D; // other vector types used in MITK typedef vnl_vector VnlVector; typedef vnl_vector_ref VnlVectorRef; - // The FillVector3D and FillVector4D methods are implemented for all common vector types here - // (mitk::Vector, vnl_vector and vnl_vector_ref) - - template - inline void FillVector3D(Tout& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z) + // The equal methods to compare vectors for equality are below: + + /** + * @ingroup MITKTestingAPI + * + * @param vector1 Vector to compare. + * @param vector2 Vector to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if vectors are equal. + */ + template + inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2, TCoordRep eps=mitk::eps, bool verbose=false) { - out[0] = x; - out[1] = y; - out[2] = z; - } + bool isEqual = true; + typename itk::Vector::VectorType diff = vector1-vector2; + for (unsigned int i=0; i - inline void FillVector4D(Tout& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z, mitk::ScalarType t) - { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = t; - } + ConditionalOutputOfDifference(vector1, vector2, eps, verbose, isEqual); -/* - inline void FillVector3D(Vector& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z) - { - out[0] = x; - out[1] = y; - out[2] = z; + return isEqual; } - inline void FillVector4D(Vector& out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z, mitk::ScalarType t) + /** + * @ingroup MITKTestingAPI + * + * @param vector1 Vector to compare. + * @param vector2 Vector to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if vectors are equal. + */ + inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2, ScalarType eps=mitk::eps, bool verbose=false) { - out[0] = x; - out[1] = y; - out[2] = z; - out[4] = t; - } + bool isEqual = true; + mitk::VnlVector diff = vector1-vector2; + for (unsigned int i=0; i + inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2, TCoordRep eps=mitk::eps, bool verbose=false) { - FillVector3D(out, x, y, z); - out[4] = t; - } - */ + vnl_vector_fixed diff = vector1-vector2; + bool isEqual = true; + for( unsigned int i=0; i