17#ifndef __dwi_tractography_algorithms_tensor_det_h__
18#define __dwi_tractography_algorithms_tensor_det_h__
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
23#include <Eigen/Eigenvalues>
24#pragma GCC diagnostic pop
40 namespace Tractography
56 if (is_act() && act().backtrack())
57 throw Exception (
"Backtracking not valid for deterministic algorithms");
65 properties[
"method"] =
"TensorDet";
69 auto bmat_double = grad2bmatrix<double> (grad);
71 bmat = bmat_double.cast<
float>();
74 throw Exception (
"Tensor-based tracking algorithms expect a DWI series as input");
78 Eigen::MatrixXf bmat, binv;
104 if (
S.init_dir.allFinite())
106 if (
S.init_dir.dot (dir) < 0.0)
121 float get_metric (
const Eigen::Vector3f& position,
const Eigen::Vector3f& direction)
override
123 if (!get_data (
source, position))
133 Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f>
eig;
142 M(1,0) =
M(0,1) =
dt[3];
143 M(2,0) =
M(0,2) =
dt[4];
144 M(2,1) =
M(1,2) =
dt[5];
146 eig.computeDirect (
M);
147 dir =
eig.eigenvectors().col(2);
172 Eigen::Vector3f prev_dir = dir;
176 float dot = prev_dir.dot (dir);
177 if (
abs (dot) <
S.cos_max_angle_1o)
183 pos += dir *
S.step_size;
Eigen::SelfAdjointEigenSolver< Eigen::Matrix3f > eig
Tracking::Interpolator< Image< float > >::type source
Eigen::Matrix< typename MatrixType::Scalar, Eigen::Dynamic, Eigen::Dynamic > pinv(const MatrixType &M)
return Moore-Penrose pseudo-inverse of M
constexpr float cutoff_fa
constexpr float cutoff_act_multiplier
constexpr float angle_deterministic
constexpr float stepsize_voxels_firstorder
constexpr float stepsize_voxels_rk4
Eigen::MatrixXd get_DW_scheme(const Header &header, BValueScalingBehaviour bvalue_scaling=BValueScalingBehaviour::Auto)
get the fully-interpreted DW gradient encoding matrix
void dwi2tensor(VectorTypeOut &dt, const MatrixType &binv, VectorTypeIn &dwi)
VectorType::Scalar tensor2FA(const VectorType &dt)
constexpr std::enable_if< std::is_arithmetic< X >::value &&std::is_unsigned< X >::value, X >::type abs(X x)