ANIMA  4.0
animaVectorOperations.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkVector.h>
4 #include <itkVariableLengthVector.h>
5 #include <itkPoint.h>
6 #include <vnl/vnl_vector.h>
7 #include <vnl/vnl_vector_fixed.h>
8 #include <vector>
9 
10 namespace anima
11 {
12 
13 /******* Main function ComputeEuclideanDistance *******/
14 // Main
15 template <class VectorType> double ComputeEuclideanDistance(const VectorType &x1, const VectorType &x2, const unsigned int NDimension);
16 // For itkVector
17 template <class ScalarType, unsigned int NDimension> double ComputeEuclideanDistance(const itk::Vector <ScalarType,NDimension> &x1, const itk::Vector <ScalarType,NDimension> &x2);
18 // For itkVariableLengthVector
19 template <class ScalarType> double ComputeEuclideanDistance(const itk::VariableLengthVector <ScalarType> &x1, const itk::VariableLengthVector <ScalarType> &x2);
20 // For itkPoint
21 template <class ScalarType, unsigned int NDimension> double ComputeEuclideanDistance(const itk::Point <ScalarType,NDimension> &x1, const itk::Point <ScalarType,NDimension> &x2);
22 // For vnl_vector
23 template <class ScalarType> double ComputeEuclideanDistance(const vnl_vector <ScalarType> &x1, const vnl_vector <ScalarType> &x2);
24 // For vnl_vector_fixed
25 template <class ScalarType, unsigned int NDimension> double ComputeEuclideanDistance(const vnl_vector_fixed <ScalarType,NDimension> &x1, const vnl_vector_fixed <ScalarType,NDimension> &x2);
26 // For std::vector
27 template <class ScalarType> double ComputeEuclideanDistance(const std::vector <ScalarType> &x1, const std::vector <ScalarType> &x2);
28 /******************************************************/
29 
30 template <class VectorType> double ComputePointToSetDistance(const VectorType &x, const std::vector <VectorType> &s);
31 template <class VectorType> double ComputeDirectedHausdorffDistance(const std::vector <VectorType> &s1, const std::vector <VectorType> &s2);
32 template <class VectorType> double ComputeHausdorffDistance(const std::vector <VectorType> &s1, const std::vector <VectorType> &s2);
33 template <class VectorType> double ComputeModifiedDirectedHausdorffDistance(const std::vector <VectorType> &s1, const std::vector <VectorType> &s2);
34 template <class VectorType> double ComputeModifiedHausdorffDistance(const std::vector <VectorType> &s1, const std::vector <VectorType> &s2);
35 
36 /******* Main function ExponentialSum *******/
37 // Main
38 template <class VectorType> double ExponentialSum(const VectorType &x, const unsigned int NDimension);
39 // For itkVector
40 template <class ScalarType, unsigned int NDimension> double ExponentialSum(const itk::Vector <ScalarType,NDimension> &x);
41 // For itkVariableLengthVector
42 template <class ScalarType> double ExponentialSum(const itk::VariableLengthVector <ScalarType> &x);
43 // For itkPoint
44 template <class ScalarType, unsigned int NDimension> double ExponentialSum(const itk::Point <ScalarType,NDimension> &x);
45 // For vnl_vector
46 template <class ScalarType> double ExponentialSum(const vnl_vector <ScalarType> &x);
47 // For vnl_vector_fixed
48 template <class ScalarType, unsigned int NDimension> double ExponentialSum(const vnl_vector_fixed <ScalarType,NDimension> &x);
49 // For std::vector
50 template <class ScalarType> double ExponentialSum(const std::vector <ScalarType> &x);
51 /********************************************/
52 
53 /******* Main function ComputeScalarProduct *******/
54 // Main
55 template <class VectorType> double ComputeScalarProduct(const VectorType &v1, const VectorType &v2, const unsigned int NDimension);
56 // For itkVector
57 template <class ScalarType, unsigned int NDimension> double ComputeScalarProduct(const itk::Vector <ScalarType,NDimension> &v1, const itk::Vector <ScalarType,NDimension> &v2);
58 // For itkVariableLengthVector
59 template <class ScalarType> double ComputeScalarProduct(const itk::VariableLengthVector <ScalarType> &v1, const itk::VariableLengthVector <ScalarType> &v2);
60 // For itkPoint
61 template <class ScalarType, unsigned int NDimension> double ComputeScalarProduct(const itk::Point <ScalarType,NDimension> &v1, const itk::Point <ScalarType,NDimension> &v2);
62 // For vnl_vector
63 template <class ScalarType> double ComputeScalarProduct(const vnl_vector <ScalarType> &v1, const vnl_vector <ScalarType> &v2);
64 // For vnl_vector_fixed
65 template <class ScalarType, unsigned int NDimension> double ComputeScalarProduct(const vnl_vector_fixed <ScalarType,NDimension> &v1, const vnl_vector_fixed <ScalarType,NDimension> &v2);
66 // For std::vector
67 template <class ScalarType> double ComputeScalarProduct(const std::vector <ScalarType> &v1, const std::vector <ScalarType> &v2);
68 /**************************************************/
69 
70 /******* Function ComputeCrossProduct *******/
71 // Main
72 template <class VectorType> void ComputeCrossProduct(const VectorType &v1, const VectorType &v2, const unsigned int NDimension, VectorType &resVec);
73 // For itkVector
74 template <class ScalarType, unsigned int NDimension> void ComputeCrossProduct(const itk::Vector <ScalarType,NDimension> &v1, const itk::Vector <ScalarType,NDimension> &v2, itk::Vector <ScalarType,NDimension> &resVec);
75 // For itkVariableLengthVector
76 template <class ScalarType> void ComputeCrossProduct(const itk::VariableLengthVector <ScalarType> &v1, const itk::VariableLengthVector <ScalarType> &v2, itk::VariableLengthVector <ScalarType> &resVec);
77 // For itkPoint
78 template <class ScalarType, unsigned int NDimension> void ComputeCrossProduct(const itk::Point <ScalarType,NDimension> &v1, const itk::Point <ScalarType,NDimension> &v2, itk::Point <ScalarType,NDimension> &resVec);
79 // For vnl_vector
80 template <class ScalarType> void ComputeCrossProduct(const vnl_vector <ScalarType> &v1, const vnl_vector <ScalarType> &v2, vnl_vector <ScalarType> &resVec);
81 // For vnl_vector_fixed
82 template <class ScalarType, unsigned int NDimension> void ComputeCrossProduct(const vnl_vector_fixed <ScalarType,NDimension> &v1, const vnl_vector_fixed <ScalarType,NDimension> &v2, vnl_vector_fixed <ScalarType,NDimension> &resVec);
83 // For std::vector
84 template <class ScalarType> void ComputeCrossProduct(const std::vector <ScalarType> &v1, const std::vector <ScalarType> &v2, std::vector <ScalarType> &resVec);
85 /********************************************/
86 
87 template <class VectorType> double ComputeNorm(const VectorType &v);
88 
89 /******* Function Normalize *******/
90 // Main
91 template <class VectorType> void Normalize(const VectorType &v, const unsigned int NDimension, VectorType &resVec);
92 // For itkVector
93 template <class ScalarType, unsigned int NDimension> void Normalize(const itk::Vector <ScalarType,NDimension> &v, itk::Vector <ScalarType,NDimension> &resVec);
94 // For itkVariableLengthVector
95 template <class ScalarType> void Normalize(const itk::VariableLengthVector <ScalarType> &v, itk::VariableLengthVector <ScalarType> &resVec);
96 // For itkPoint
97 template <class ScalarType, unsigned int NDimension> void Normalize(const itk::Point <ScalarType,NDimension> &v, itk::Point <ScalarType,NDimension> &resVec);
98 // For vnl_vector
99 template <class ScalarType> void Normalize(const vnl_vector <ScalarType> &v, vnl_vector <ScalarType> &resVec);
100 // For vnl_vector_fixed
101 template <class ScalarType, unsigned int NDimension> void Normalize(const vnl_vector_fixed <ScalarType, NDimension> &v, vnl_vector_fixed <ScalarType, NDimension> &resVec);
102 // For std::vector
103 template <class ScalarType> void Normalize(const std::vector <ScalarType> &v, std::vector <ScalarType> &resVec);
104 /**********************************/
105 
106 /******* Householder vector functions *******/
107 // Main
108 template <class VectorType> void ComputeHouseholderVector(const VectorType &inputVector, VectorType &outputVector, double &beta, unsigned int dimension);
109 // For std::vector
110 template <class ScalarType> void ComputeHouseholderVector(const std::vector <ScalarType> &inputVector, std::vector <ScalarType> &outputVector, double &beta);
111 // For std::vector in place
112 template <class ScalarType> void ComputeHouseholderVector(std::vector <ScalarType> &vector, double &beta);
113 /**********************************/
114 
115 template <class VectorType> double ComputeAngle(const VectorType &v1, const VectorType &v2);
116 template <class VectorType> double ComputeOrientationAngle(const VectorType &v1, const VectorType &v2);
117 
118 template <class VectorType> void Revert(const VectorType &v, const unsigned int vSize, VectorType &resVec);
119 template <class ScalarType> void Revert(const std::vector <ScalarType> &v, std::vector<ScalarType> &resVec);
120 template <class ScalarType> void Revert(const itk::Point <ScalarType> &v, itk::Point <ScalarType> &resVec);
121 template <class ScalarType, unsigned int NDimension> void Revert(const vnl_vector_fixed <ScalarType, NDimension> &v,
122  vnl_vector_fixed <ScalarType, NDimension> &resVec);
123 
124 template <class VectorType> void TransformCartesianToSphericalCoordinates(const VectorType &v, VectorType &resVec);
125 template <class VectorType> void TransformSphericalToCartesianCoordinates(const VectorType &v, VectorType &resVec);
126 template <class VectorType> void TransformSphericalToCartesianCoordinates(double theta, double phi, double vectorNorm, VectorType &resVec);
127 template <class T1, class T2, class T3> void ProjectOnOrthogonalPlane(const std::vector <T1> &v, const std::vector <T2> &normalVec, std::vector <T3> &resVec);
128 
129 template <class T1, class T2, class T3, class T4> void RotateAroundAxis(const std::vector <T1> &v, const T2 &phi, const std::vector <T3> &normalVec, std::vector <T4> &resVec);
130 template <class Vector3DType, class ScalarType> void RotateAroundAxis(const Vector3DType &v, const ScalarType &phi, const Vector3DType &normalVec, Vector3DType &resVec);
131 
132 } // end of namespace anima
133 
134 #include "animaVectorOperations.hxx"
void Revert(const VectorType &v, const unsigned int vSize, VectorType &resVec)
double ExponentialSum(const VectorType &x, const unsigned int NDimension)
void TransformSphericalToCartesianCoordinates(const VectorType &v, VectorType &resVec)
double ComputeEuclideanDistance(const VectorType &x1, const VectorType &x2, const unsigned int NDimension)
double ComputeNorm(const VectorType &v)
void RotateAroundAxis(const std::vector< T1 > &v, const T2 &phi, const std::vector< T3 > &normalVec, std::vector< T4 > &resVec)
double ComputeAngle(const VectorType &v1, const VectorType &v2)
double ComputeModifiedHausdorffDistance(const std::vector< VectorType > &s1, const std::vector< VectorType > &s2)
double ComputeHausdorffDistance(const std::vector< VectorType > &s1, const std::vector< VectorType > &s2)
double ComputePointToSetDistance(const VectorType &x, const std::vector< VectorType > &s)
double ComputeOrientationAngle(const VectorType &v1, const VectorType &v2)
void Normalize(const VectorType &v, const unsigned int NDimension, VectorType &resVec)
double ComputeModifiedDirectedHausdorffDistance(const std::vector< VectorType > &s1, const std::vector< VectorType > &s2)
double ComputeDirectedHausdorffDistance(const std::vector< VectorType > &s1, const std::vector< VectorType > &s2)
double ComputeScalarProduct(const VectorType &v1, const VectorType &v2, const unsigned int NDimension)
void ComputeHouseholderVector(const VectorType &inputVector, VectorType &outputVector, double &beta, unsigned int dimension)
void ProjectOnOrthogonalPlane(const std::vector< T1 > &v, const std::vector< T2 > &normalVec, std::vector< T3 > &resVec)
void TransformCartesianToSphericalCoordinates(const VectorType &v, VectorType &resVec)
void ComputeCrossProduct(const VectorType &v1, const VectorType &v2, const unsigned int NDimension, VectorType &resVec)