Skip to content

apply_girf ​

Predict field waveforms by applying a calibrated frequency-domain response to nominal gradients in device coordinates. Each extra input dimension is processed independently, so separate shots need not be concatenated across their dead time. The output channel order comes from the response calibration.

This complete CPU example applies a matched-length identity response directly. It checks the array interface without invoking response expansion:

julia
using HighOrderMRI

T = Float64
nominal_gradients = zeros(T, 3, 8)
nominal_gradients[1, 3] = 1
Hw = zeros(Complex{T}, 8, 3, 3)
for axis in 1:3
    Hw[:, axis, axis] .= 1
end
predicted = apply_girf(nominal_gradients, Hw;
    dim_spatial=1, dim_time=2, rbw=1.0)
@assert predicted ≈ nominal_gradients

For the model-container form, see the complete GIRFModel example. A calibrated response must match the acquisition sampling and physical units.

rbw suppresses outer waveform-frequency bins. It is not an estimate of the model's uncertainty. The function does not integrate gradients or apply a gyromagnetic ratio; perform the appropriate conversion before using the result as phase coefficients. See phase preparation.

Current limits ​

The FFT multiplication is periodic convolution. Padding the waveform to nextprod([2,3,5],max(nPoint,nFreq)) does not by itself prevent a late response from wrapping to the start. Determine the required pre/post support from the acquisition and calibrated impulse response.

If this FFT length exceeds the supplied response length, the current time-domain response expansion omits one middle coefficient. That can remove a valid response tap, including for odd lengths. An already matched response length avoids this expansion path; it does not remove periodic-boundary effects. These numerical limitations remain in the implementation.

The real inverse transform is returned. A physically compatible real response, consistent frequency ordering and matched sample intervals must be supplied; the API does not validate all these calibration conditions. A GIRFModel wrapper adds metadata but does not resample its response.

API ​

Transfer array ​

julia
apply_girf(G_DCS_nom::AbstractArray{T, N}, Hw::AbstractArray; dim_spatial::Int = 1, dim_time::Int = 2, rbw::Float64 = 1.0) where {T, N}

Apply a frequency-domain linear, time-invariant gradient response model. Use real floating-point nominal gradients with three physical DCS channels along dim_spatial and waveform samples along the distinct dim_time axis. Hw has shape (nFreq,3,nOut) with DC centred (fftshift ordering). Other input dimensions are processed independently. The output preserves their order and replaces the three-channel dimension by nOut. Its element type follows the nominal waveform; the inverse transform's real part is used.

The frequency response and input waveform must use matching sample intervals and compatible physical units. rbw is intended in (0,1]; below one, the outer frequency bins of the waveform spectrum are set to zero. This keyword is not a calibrated anti-aliasing or noise model, and its range is not checked. The function does not insert gamma, integrate fields or convert to cycles.

Current FFT boundary and response-expansion limits ​

The FFT length is nextprod([2,3,5],max(nPoint,nFreq)). The waveform is padded with trailing zeros to that length, multiplied by the transfer matrix, and the first nPoint real output samples are returned. This is circular FFT convolution; this padding alone does not guarantee finite-record linear convolution or prevent a response from wrapping into the beginning.

When the FFT length exceeds nFreq, the implementation expands the response in the time domain. Its current split omits index fld(nFreq,2)+1, which can discard a valid impulse-response coefficient even for odd nFreq. This is a known numerical limitation, not safe general-purpose impulse padding. Prefer an already matched response length and assess the input/output boundary support explicitly; no padding fix is performed by this API.

apply_girf(nominal, model::GIRFModel; ...) delegates here and does not use the model's stored frequency vector to resample the response.

Source: src/GIRF/apply_girf.jl

Model wrapper ​

julia
apply_girf(G_DCS_nom::AbstractArray, GIRF::GIRFModel; kwargs...)

Apply GIRF.Hw with the array overload of apply_girf, forwarding all keywords. GIRF.freqs is metadata only in this call. The sampling-grid, response-expansion and circular-convolution limitations of that overload also apply here.

Source: src/GIRF/GIRF.jl

HighOrderMRI.jl documentation · stable · v0.1.2 · code 9af532a · docs 9af532a