diff --git a/Tensor/TensorFunctions.h b/Tensor/TensorFunctions.h index 0477e671e..167b771d0 100644 --- a/Tensor/TensorFunctions.h +++ b/Tensor/TensorFunctions.h @@ -438,7 +438,7 @@ GetMetricTensorCost(TVectorType dpath, TTensorType dtv, unsigned int matrixpower vec(0, 0) = dpath[0]; vec(1, 0) = dpath[1]; vec(2, 0) = dpath[2]; - MatrixType inv = vnl_matrix_inverse(DT); + MatrixType inv = vnl_matrix_inverse(DT).inverse(); for (unsigned int lo = 1; lo < matrixpower; lo++) { inv = inv * inv; @@ -837,7 +837,7 @@ GetMetricTensorCost(itk::Vector dpath, TTensorType dtv) vec(0, 0) = dpath[0]; vec(1, 0) = dpath[1]; vec(2, 0) = dpath[2]; - MatrixType inv = vnl_matrix_inverse(DT); + MatrixType inv = vnl_matrix_inverse(DT).inverse(); MatrixType sol = vec.transpose() * inv * vec; float cost = sol(0, 0) / etot;