17#ifndef __dwi_tractography_algorithms_fact_h__
18#define __dwi_tractography_algorithms_fact_h__
33 namespace Tractography
46 num_vec (
source.size(3)/3) {
49 throw Exception (
"Number of volumes in FACT algorithm input image should be a multiple of 3");
51 if (is_act() && act().backtrack())
52 throw Exception (
"Backtracking not valid for deterministic algorithms");
55 throw Exception (
"4th-order Runge-Kutta integration not valid for FACT algorithm");
60 dot_threshold = std::cos (max_angle_1o);
62 properties[
"method"] =
"FACT";
76 FACT (
const Shared& shared) :
92 if (!get_data (
source))
return false;
93 if (
S.init_dir.allFinite())
107 if (max_norm <
S.threshold)
110 pos +=
S.step_size * dir;
114 float get_metric (
const Eigen::Vector3f& position,
const Eigen::Vector3f& direction)
override
116 if (!get_data (
source, position))
118 Eigen::Vector3f d (direction);
131 float max_abs_dot = 0.0, max_dot = 0.0, max_norm = 0.0;
133 for (
size_t n = 0; n <
S.num_vec; ++n) {
135 float norm = v.norm();
136 float dot = v.dot(d) / norm;
137 float abs_dot =
abs (dot);
138 if (abs_dot <
S.dot_threshold)
continue;
139 if (max_abs_dot < abs_dot) {
140 max_abs_dot = abs_dot;
147 if (idx < 0)
return (0.0);
Interp::Masked< Interp::Nearest< Image< float > > > source
float select_fixel(Eigen::Vector3f &d) const
Eigen::Vector3f random_direction()
Implicit masking for interpolator class.
constexpr float cutoff_act_multiplier
constexpr float angle_deterministic
constexpr float stepsize_voxels_firstorder
constexpr float cutoff_fixel
constexpr std::enable_if< std::is_arithmetic< X >::value &&std::is_unsigned< X >::value, X >::type abs(X x)