samplingDensity
This trajectory-only helper estimates square-root density weights for the weighted least-squares wrapper. It is not a coil-aware or field-aware inverse. 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) 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.
tr = [collect(range(-0.45, 0.45; length=32))'; zeros(1, 32)]
weights = samplingDensity(tr, (8, 8))