17#ifndef __dwi_tractography_algorithms_sd_stream_h__
18#define __dwi_tractography_algorithms_sd_stream_h__
29namespace Tractography {
46 throw Exception (
"Algorithm SD_STREAM expects as input a spherical harmonic (SH) image");
49 if (is_act() && act().backtrack())
50 throw Exception (
"Backtracking not valid for deterministic algorithms");
55 dot_threshold = std::cos (max_angle_1o);
59 properties[
"method"] =
"SDStream";
61 bool precomputed =
true;
62 properties.set (precomputed,
"sh_precomputed");
103 if (!
S.init_dir.allFinite()) {
104 if (!dir.allFinite())
124 const Eigen::Vector3f prev_dir (dir);
129 if (prev_dir.dot (dir) <
S.dot_threshold)
132 pos += dir *
S.step_size;
137 float get_metric (
const Eigen::Vector3f& position,
const Eigen::Vector3f& direction)
override
139 if (!get_data (
source, position))
141 return FOD (direction);
152 if (!std::isfinite (
FOD) ||
FOD <
S.threshold)
157 float FOD (
const Eigen::Vector3f& d)
const
159 return (
S.precomputer ?
160 S.precomputer->value (
values, d) :
float FOD(const Eigen::Vector3f &d) const
Interpolator< Image< float > >::type source
Eigen::Vector3f random_direction()
Precomputed Associated Legrendre Polynomials - used to speed up SH calculation.
void check(const ImageType &H)
convenience function to check if an input image can contain SH coefficients
size_t LforN(int N)
returns the largest lmax given N parameters
VectorType::Scalar get_peak(const VectorType &sh, int lmax, UnitVectorType &unit_init_dir, PrecomputedAL< typename VectorType::Scalar > *precomputer=nullptr)
estimate direction & amplitude of SH peak
VectorType::Scalar value(const VectorType &coefs, typename VectorType::Scalar cos_elevation, typename VectorType::Scalar cos_azimuth, typename VectorType::Scalar sin_azimuth, int lmax)
constexpr float cutoff_fod
constexpr float cutoff_act_multiplier
constexpr float angle_deterministic
constexpr float stepsize_voxels_firstorder
constexpr float stepsize_voxels_rk4