Skip to main content

fansi_dipole_kernel

Function fansi_dipole_kernel 

Source
pub fn fansi_dipole_kernel(grid: &Grid, bdir: (f64, f64, f64)) -> Vec<f64>
Expand description

FANSI’s discrete dipole kernel, dipole_kernel_angulated(N, spatial_res, B0_dir) with its default mode = 1 (FANSI-toolbox 93044a3):

spatial_res = spatial_res/max(spatial_res(:));
E_j = (1 - exp(2i*pi*k_j/N_j)) / spatial_res(j);    % k_j = 0..N_j-1
kernel = 1/3 - |E1*B0(1) + E2*B0(2) + E3*B0(3)|^2 ./ (|E1|^2 + |E2|^2 + |E3|^2);
kernel(1,1,1) = 0;

bdir is normalised first (the QSM-CI wrappers pass B0_dir/norm(B0_dir)). MATLAB builds it in single precision (N = single(N)); this is double, as the crate’s other kernels. FFT order, i + nx*(j + ny*k).