samplingDensity
This trajectory-only helper estimates square-root density weights for the weighted least-squares wrapper. Coil maps and higher-order fields do not enter this trajectory-based estimate. Supply trajectory coordinates in dimension-by-sample order; all-zero inputs are outside the usable normalization domain.
Example
using HighOrderMRI
kx = collect(range(-0.45, 0.45; length=32))
trajectory = [kx'; zeros(1, length(kx))]
weights = samplingDensity(trajectory, (8, 8))
@assert length(weights) == size(trajectory, 2)The helper rescales all coordinates by a single maximum. For anisotropic sampling, prepare axis scaling consistently with the intended reconstruction grid. Use the returned weights once in recon_HOOp.
API
samplingDensity(tr::AbstractArray{T, 2},
shape::Tuple; normalize::Bool=false) where TCompute square-root sampling-density weights for a non-Cartesian trajectory. tr must be dimension-by-sample (length(shape), nSam), with real floating-point coordinates and at least one nonzero finite value. shape is the Cartesian reconstruction size, with positive dimensions. This overload normalizes all trajectory coordinates by 2*maximum(abs.(tr)), constructs a CPU Float64 NFFT plan (m=2, σ=2), and uses 10 density-compensation iterations.
Return Vector{Complex{T}} of length nSam, containing the square root of the computed density. Pass these weights once to recon_HOOp, which applies them to both data and encoding. They are not the already squared normal weights. An all-zero trajectory has undefined normalization in the current implementation; anisotropic physical coordinates must be prepared consistently before calling this helper. It is a convenience estimate, not an absolute physical quadrature normalization.
Set normalize=true to divide the square-root weights by their root-mean-square value, so that the mean of the raw density abs2.(weights) is one. The default retains the historical scale. This changes the scale of the data fidelity term: to preserve an existing L2-regularized objective, divide its regularization coefficient by the original mean density as well. With zero regularization, a global weight rescaling leaves the exact least-squares solution unchanged; it does not improve the exact condition number or remove nonuniform weighting.
tr = [collect(range(-0.45, 0.45; length=32))'; zeros(1, 32)]
weights = samplingDensity(tr, (8, 8))