Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/LinearAlgebra.h @ 165:8d50e6be565d wasm
LinearAlgebra toolbox
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Feb 2018 13:51:29 +0100 |
parents | 8c5b24892ed2 |
children | 4f661e2f7b6c |
comparison
equal
deleted
inserted
replaced
164:432b1f812d14 | 165:8d50e6be565d |
---|---|
50 bool ParseVector(Vector& target, | 50 bool ParseVector(Vector& target, |
51 const Orthanc::DicomMap& dataset, | 51 const Orthanc::DicomMap& dataset, |
52 const Orthanc::DicomTag& tag); | 52 const Orthanc::DicomTag& tag); |
53 | 53 |
54 void AssignVector(Vector& v, | 54 void AssignVector(Vector& v, |
55 double v1); | |
56 | |
57 void AssignVector(Vector& v, | |
55 double v1, | 58 double v1, |
56 double v2); | 59 double v2); |
57 | 60 |
58 void AssignVector(Vector& v, | 61 void AssignVector(Vector& v, |
59 double v1, | 62 double v1, |
63 void AssignVector(Vector& v, | 66 void AssignVector(Vector& v, |
64 double v1, | 67 double v1, |
65 double v2, | 68 double v2, |
66 double v3, | 69 double v3, |
67 double v4); | 70 double v4); |
71 | |
72 Vector CreateVector(double v1); | |
73 | |
74 Vector CreateVector(double v1, | |
75 double v2); | |
76 | |
77 Vector CreateVector(double v1, | |
78 double v2, | |
79 double v3); | |
80 | |
81 Vector CreateVector(double v1, | |
82 double v2, | |
83 double v3, | |
84 double v4); | |
68 | 85 |
69 inline bool IsNear(double x, | 86 inline bool IsNear(double x, |
70 double y, | 87 double y, |
71 double threshold) | 88 double threshold) |
72 { | 89 { |
96 size_t size, | 113 size_t size, |
97 const double values[]); | 114 const double values[]); |
98 | 115 |
99 void Convert(Matrix& target, | 116 void Convert(Matrix& target, |
100 const Vector& source); | 117 const Vector& source); |
118 | |
119 inline Matrix Transpose(const Matrix& a) | |
120 { | |
121 return boost::numeric::ublas::trans(a); | |
122 } | |
123 | |
124 | |
125 inline Matrix IdentityMatrix(size_t size) | |
126 { | |
127 return boost::numeric::ublas::identity_matrix<double>(size); | |
128 } | |
129 | |
130 | |
131 inline Matrix ZeroMatrix(size_t size1, | |
132 size_t size2) | |
133 { | |
134 return boost::numeric::ublas::zero_matrix<double>(size1, size2); | |
135 } | |
136 | |
137 | |
138 inline Matrix Product(const Matrix& a, | |
139 const Matrix& b) | |
140 { | |
141 return boost::numeric::ublas::prod(a, b); | |
142 } | |
143 | |
144 | |
145 inline Vector Product(const Matrix& a, | |
146 const Vector& b) | |
147 { | |
148 return boost::numeric::ublas::prod(a, b); | |
149 } | |
150 | |
151 | |
152 inline Matrix Product(const Matrix& a, | |
153 const Matrix& b, | |
154 const Matrix& c) | |
155 { | |
156 return Product(a, Product(b, c)); | |
157 } | |
158 | |
159 | |
160 inline Matrix Product(const Matrix& a, | |
161 const Matrix& b, | |
162 const Matrix& c, | |
163 const Matrix& d) | |
164 { | |
165 return Product(a, Product(b, c, d)); | |
166 } | |
167 | |
168 | |
169 inline Matrix Product(const Matrix& a, | |
170 const Matrix& b, | |
171 const Matrix& c, | |
172 const Matrix& d, | |
173 const Matrix& e) | |
174 { | |
175 return Product(a, Product(b, c, d, e)); | |
176 } | |
177 | |
178 | |
179 inline Vector Product(const Matrix& a, | |
180 const Matrix& b, | |
181 const Vector& c) | |
182 { | |
183 return Product(Product(a, b), c); | |
184 } | |
185 | |
101 | 186 |
102 double ComputeDeterminant(const Matrix& a); | 187 double ComputeDeterminant(const Matrix& a); |
103 | 188 |
104 bool IsOrthogonalMatrix(const Matrix& q, | 189 bool IsOrthogonalMatrix(const Matrix& q, |
105 double threshold); | 190 double threshold); |
125 Matrix& q, | 210 Matrix& q, |
126 const Matrix& a); | 211 const Matrix& a); |
127 | 212 |
128 void InvertMatrix(Matrix& target, | 213 void InvertMatrix(Matrix& target, |
129 const Matrix& source); | 214 const Matrix& source); |
215 | |
216 void CreateSkewSymmetric(Matrix& s, | |
217 const Vector& v); | |
218 | |
219 void AlignVectorsWithRotation(Matrix& r, | |
220 const Vector& a, | |
221 const Vector& b); | |
222 | |
223 Matrix InvertScaleTranslationMatrix(const Matrix& t); | |
224 | |
225 bool IsShearMatrix(const Matrix& shear); | |
226 | |
227 Matrix InvertShearMatrix(const Matrix& shear); | |
130 }; | 228 }; |
131 } | 229 } |