#include "ksdiffusion.h"
Functions | |
STATUS | ksdiff_readtensorfile (KSDIFF_SCHEME diffscheme, int ndirs) |
STATUS | ksdiff_eval_scheme (KSDIFF_SCHEME logical_scheme, KSDIFF_SCHEME physical_scheme, int ndirs, ksdiff_coordinate_system coordinate_system, const KS_MAT3x3f rot_l2p) |
float | ksdiff_scale_vector_to_bounds (const float *vector, const float *bounds) |
float | ksdiff_vector_mag (const float *vector) |
float | ksdiff_scale_vector_to_iso_bound (const float *vector, const float bound) |
int | ksdiff_compare_power_mag_than_x (float *amp, double mag, float *max_power_amp_scale, double max_mag) |
int | ksdiff_compare_power_x_than_mag (float *amp, double mag, float *max_power_amp_scale, double max_mag) |
STATUS | ksdiff_compute_scheme_amps (KSDIFF_SCHEME diff_amp_scaling, float *max_magnitude_amp, float *RMS_amp_scale, float *max_power_amp_scale, int(*amp_cmp_f)(float *, double, float *, double), const int ndirs, const ksdiff_coordinate_system coordinate_system, const ksdiff_physical_bound_type physical_bound_type, const KS_MAT3x3f rot_l2p) |
float | ksdiff_getmaxb (const float *bvalues, int n) |
STATUS | ksdiff_eval_design (KSDIFF_CONTROL *diff_control, const KSDIFF_CONTROL_DESIGN *design) |
s64 | ksdiff_schemeloop (const KSDIFF_CONTROL *diff_control, const KSSCAN_LOOP_CONTROL *orig_loop_control, KS_DYNAMIC_STATE *dynamic, KS_CORESLICETIME coreslice(const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic)) |
void | ksdiff_plotloop (const KSDIFF_CONTROL *diff_control, KS_CORESLICETIME coreslice(const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic), const SCAN_INFO *scan_info) |
STATUS ksdiff_readtensorfile | ( | KSDIFF_SCHEME | diffscheme, |
int | ndirs | ||
) |
STATUS ksdiff_eval_scheme | ( | KSDIFF_SCHEME | logical_scheme, |
KSDIFF_SCHEME | physical_scheme, | ||
int | ndirs, | ||
ksdiff_coordinate_system | coordinate_system, | ||
const KS_MAT3x3f | rot_l2p | ||
) |
float ksdiff_scale_vector_to_bounds | ( | const float * | vector, |
const float * | bounds | ||
) |
float ksdiff_vector_mag | ( | const float * | vector | ) |
float ksdiff_scale_vector_to_iso_bound | ( | const float * | vector, |
const float | bound | ||
) |
int ksdiff_compare_power_mag_than_x | ( | float * | amp, |
double | mag, | ||
float * | max_power_amp_scale, | ||
double | max_mag | ||
) |
int ksdiff_compare_power_x_than_mag | ( | float * | amp, |
double | mag, | ||
float * | max_power_amp_scale, | ||
double | max_mag | ||
) |
STATUS ksdiff_compute_scheme_amps | ( | KSDIFF_SCHEME | diff_amp_scaling, |
float * | max_magnitude_amp, | ||
float * | RMS_amp_scale, | ||
float * | max_power_amp_scale, | ||
int(*)(float *, double, float *, double) | amp_cmp_f, | ||
const int | ndirs, | ||
const ksdiff_coordinate_system | coordinate_system, | ||
const ksdiff_physical_bound_type | physical_bound_type, | ||
const KS_MAT3x3f | rot_l2p | ||
) |
float ksdiff_getmaxb | ( | const float * | bvalues, |
int | n | ||
) |
STATUS ksdiff_eval_design | ( | KSDIFF_CONTROL * | diff_control, |
const KSDIFF_CONTROL_DESIGN * | design | ||
) |
This function computes the scaling factors needed for the desired diffusion scheme to be executed taking into accout the limits of the gradient system according to design->physical_bound_type. The actual shape and timing of the diffusion gradients are not needed to be known, in fact, this function must be called before setting up the module that includes the diffusion gradients. In particular diff_control->bvalue and diff_control->max_magnitude_amp are to be used as inputs to design the diffusion gradients (see below for an example). Additionally, diff_control->RMS_amp_scale and diff_control->max_power_amp_scale are to be used for setting the diffusion gradients scaling factors for gradient heating calculations for average and maximum power respectively.
NOTE* that it is assumed that the diffusion gradients are generated with a maximum amplitude equal for each board equal to that board's maximum amplitude, possibly scaled down by a common factor. Each board's mximum amplitude is stored in tx, ty and tz from loggrd. In particular, one waveform (trapezoid or wave) per board is needed since those values are not necessarily equal. Specifically, the maximum amplitude of the diffusion gradients on the X logical board should be equal to alpha*loggrd.tx where alpha is a scaling factor (0 < alpha <= 1). Similarly, the maximum amplitude of the diffusion gradients on the Y and Z logical boards should be equal to alpha*loggrd.ty and alpha*loggrd.tz respectively.
For instance, in the case of standard diffusion gradients, the maximum amplitude is achieved during the plateau of the trapezoids. In order to design the shape of those trapezoids, a ramp time must be chosen first. If in doubt ks_syslimits_ramptimemax(loggrd) is always feasible as it represents the time for the slowest board to reach its maximum amplitude. Then the plateau time and the time separation between the two trapezoids should be chosen so that a plateau amplitude equal to alpha*diff_control->max_magnitude_amp results in a b-value equal to diff_control->bvalue. Finally, the actual trapezoids for the X, Y and Z boards need to be generated with a plateau amplitude equal to alpha*loggrd.tx, alpha*loggrd.ty and alpha*loggrd.tz respectively.
[out] | diff_control | |
[in] | design |
s64 ksdiff_schemeloop | ( | const KSDIFF_CONTROL * | diff_control, |
const KSSCAN_LOOP_CONTROL * | loop_control, | ||
KS_DYNAMIC_STATE * | dynamic, | ||
KS_CORESLICETIME | coresliceconst SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic | ||
) |
The index dynamic->vol is incremented for each b0 and each diffusion volumes. This corresponds to a total number of sampled volumes equal to nb0 + numbvals*ndirs for each invocation of ksdiff_schemeloop.
Note that dynamic->vol is not reset to zero so that, if the diffusion scheme is repeated, all volumes have different index.
[in] | diff_control | |
[in] | loop_control | |
[in,out] | dynamic | |
[in] | coreslice |
void ksdiff_plotloop | ( | const KSDIFF_CONTROL * | diff_control, |
KS_CORESLICETIME | coresliceconst SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic, | ||
const SCAN_INFO * | scan_info | ||
) |
All loops other than the one over all diffusion directions are collapsed.
[in] | diff_control | |
[in] | coreslice | |
[in] | scan_info | Optional slice position, can be NULL |