Skip to content

FindDelay ​

Use FindDelay to estimate one temporal offset between MRI samples and measured or predicted field coefficients for a two-dimensional reconstruction. It alternates an image update with a delay update based on the current signal residual. The method is based on Dubovan and Baron; the density weighting and accelerated updates described in the API below are the package's implementation choices. [8]

For the forward model and update equation, see Field preprocessing and synchronization. A temporal offset for one acquisition is different from estimating a separate offset for every readout or shot.

Prepare a CPU call ​

Use seconds for the ADC times, coefficient interval and temporal offsets when the static field map is in Hz. Check the coefficient order, phase units and coil ordering before estimating a delay; a timing adjustment cannot correct incompatible encoding conventions.

This first block is self-contained. It prepares a CPU configuration without running the delay-estimation loop:

julia
using HighOrderMRI
using RegularizedLeastSquares: CGNR, L2Regularization

T = Float32
# Example tolerance: 0.005 μs expressed in seconds; choose it for your data.
delay_tolerance = T(5e-9)
delay_options = (
    arrayType=Array,
    solver=CGNR,
    reg=L2Regularization(zero(T)),
    Δτ_min=delay_tolerance,
    iter_max=10,
)

After loading acquisition arrays, the following call uses that configuration. It assumes a 2D Float32 grid, host arrays with matching precision and coil ordering, and nine coefficient columns. The named acquisition variables must be supplied from your data; this block is not a synthetic convergence test.

julia
τ = FindDelay(
    grid,
    data,
    field_coefficients,
    adc_times,
    start_time,
    field_dt;
    csm,
    fieldmap,
    recon_terms="111",
    delay_options...,
)

Keep explicit ADC times when their sampling interval differs from the field-coefficient interval. The convenience overload makes a more restrictive timing assumption, described in the generated API below.

Check convergence before interpreting the result

The current implementation has no outer-iteration limit. iter_max limits each image reconstruction, so reducing it does not bound the complete delay search. Evaluate the timing estimate on data with an independent alignment reference, and check that shifted ADC times remain inside the measured field interval. The scalar result does not include a success flag.

Pass the tolerance explicitly with the same floating-point type as the input arrays. This both states the intended unit and avoids the current Float32 default-keyword problem. Also note that the existing iteration log labels sample offsets as microseconds; the API notes below explain how to interpret them.

API ​

julia
FindDelay(
    gridding :: Grid{T} ,
    data :: AbstractArray{Complex{T}, 2} ,
    kspha :: AbstractArray{T, 2} ,
    datatime :: AbstractVector{T} ,
    StartTime :: T ,
    dt :: T ;
    JumpFact :: Int64 = 3 ,
    Δτ_min :: T = 0.005 ,
    intermode :: Interpolations.InterpolationType = AkimaMonotonicInterpolation() ,
    fieldmap :: AbstractArray{T, 2} = zeros(T,(gridding.nX, gridding.nY)) ,
    csm :: Array{Complex{T}, 3} = ones(Complex{T},(gridding.nX, gridding.nY)..., 1) ,
    recon_terms :: String ="111" ,
    nBlock :: Int64 = 50 ,
    arrayType :: Type{<:AbstractArray}= Array ,
    solver :: Type{<:AbstractLinearSolver} = CGNR ,
    reg :: AbstractParameterizedRegularization = L2Regularization(zero(T)) ,
    iter_max :: Int64 = 10 ,
    verbose :: Bool = false ,
) ::T where {T<:AbstractFloat}

FindDelay(
    gridding :: Grid{T} ,
    data :: AbstractArray{Complex{T}, 2} ,
    kspha :: AbstractArray{T, 2} ,
    StartTime :: T ,
    dt :: T ;
    JumpFact :: Int64 = 3 ,
    Δτ_min :: T = 0.005 ,
    intermode :: Interpolations.InterpolationType = AkimaMonotonicInterpolation() ,
    fieldmap :: AbstractArray{T, 2} = zeros(T,(gridding.nX, gridding.nY)) ,
    csm :: Array{Complex{T}, 3} = ones(Complex{T},(gridding.nX, gridding.nY)..., 1) ,
    recon_terms :: String = "111" ,
    nBlock :: Int64 = 50 ,
    arrayType :: Type{<:AbstractArray}= Array ,
    solver :: Type{<:AbstractLinearSolver} = CGNR ,
    reg :: AbstractParameterizedRegularization = L2Regularization(zero(T)) ,
    iter_max :: Int64 = 10 ,
    verbose :: Bool = false ,
) ::T where {T<:AbstractFloat}

Estimate a scalar synchronization delay between complex MRI data and sampled field coefficients for a two-dimensional reconstruction.

The implementation alternates a density-weighted image reconstruction with an unweighted scalar delay update from the data residual and the derivative forward product. It follows the model-based approach of Dubovan and Baron, with the weighting and accelerated update implemented in this package.

Arguments ​

All real-valued inputs share T<:AbstractFloat; data and csm use Complex{T}.

  • gridding::Grid{T}: reconstruction grid with nZ == 1.
  • data::AbstractArray{Complex{T},2}: MRI samples, shaped (nSample, nCha).
  • kspha::AbstractArray{T,2}: time-integrated field coefficients, shaped (nFieldSample, nTerm), with nTerm equal to 9 or 16. Use the solid-harmonic order and cycles-based phase units expected by HighOrderExplicitOp.
  • datatime::AbstractVector{T}: nSample ADC times, in seconds. This vector may have a different sampling interval from the field coefficients.
  • StartTime::T: offset subtracted from the field-coefficient time grid, in seconds. At the current delay τ, coefficient sample j is placed at (j - 1) * dt - (StartTime + τ) before interpolation.
  • dt::T: positive field-coefficient sampling interval, in seconds.

The overload without datatime constructs T.(dt * (0:nSample-1)) for the ADC times. Use it only when the ADC interval equals the coefficient interval and the first ADC time is zero in the chosen time reference.

Keywords ​

  • JumpFact::Int64=3: multiplier of the scalar delay update. It is reduced after a change in the update's sign.
  • Δτ_min::T=0.005: stopping threshold for the absolute delay increment, in the same time unit as dt. The literal default is 0.005, not a conversion from microseconds; with second-based inputs it represents 5 ms. Pass a finite positive tolerance appropriate to the acquisition explicitly.
  • intermode::Interpolations.InterpolationType=AkimaMonotonicInterpolation(): interpolation method for the field coefficients and their time derivatives.
  • fieldmap::AbstractArray{T,2}=zeros(T,(gridding.nX, gridding.nY)): static off-resonance map in Hz, shaped (nX, nY).
  • csm::Array{Complex{T},3}=ones(Complex{T},(gridding.nX, gridding.nY)..., 1): coil-sensitivity maps, shaped (nX, nY, nCha).
  • recon_terms::String="111": order-selection string passed to HighOrderExplicitOp. Use three digits for 9 coefficient columns and four digits for 16 columns.
  • nBlock::Int64=50: trajectory block count passed to the explicit operators to bound temporary storage.
  • arrayType::Type{<:AbstractArray}=Array: operator backend passed to HighOrderExplicitOp. The default uses the CPU. This wrapper creates density weights on the CPU; changing this keyword alone is not an end-to-end GPU setup.
  • solver::Type{<:AbstractLinearSolver}=CGNR: inner reconstruction solver type from RegularizedLeastSquares, rather than a solver-name string.
  • reg::AbstractParameterizedRegularization=L2Regularization(zero(T)): inner reconstruction regularizer object. Configure its strength in the object; this function has no separate λ keyword.
  • iter_max::Int64=10: iteration limit for each inner image reconstruction. This does not limit the number of outer delay updates.
  • verbose::Bool=false: show intermediate image plots and enable verbosity in the explicit operators. Delay-update information is logged even when this keyword is false.

Returns ​

A scalar τ::T, in seconds with the input convention above. Apply it as StartTime + τ when calling InterpTrajTime. Positive τ evaluates the coefficient series at later source times: k(t + StartTime + τ).

After the final update, the implementation returns τ_iter - Δτ / J * (J - 1), where τ_iter is its accumulated delay and J is the final value of JumpFact. No iteration history or convergence status is returned.

Limitations ​

The current Δτ_min=0.005 keyword default is a Float64 literal and causes a method-dispatch error for Float32 inputs. Pass a same-type value explicitly, for example Δτ_min=Float32(5e-9) for a selected tolerance of 0.005 μs when all times are in seconds. This numerical tolerance is an example, not a validated choice for every acquisition.

The outer loop has no iteration limit or non-finite-update guard. A returned scalar does not establish convergence or timing accuracy. The estimator starts with zero additional delay; StartTime supplies the initial temporal offset. Interpolation uses zero outside the available coefficient interval, so the shifted interval must cover the ADC times relevant to the reconstruction.

The iteration log currently prints Δτ/dt and τ/dt with the label [us]. Those ratios are dimensionless sample offsets, not microseconds. Interpret the returned value using the input time unit rather than that log label.

See also InterpTrajTime, FindDelay_multishot, HighOrderExplicitOp, and recon_HOOp.

Reference ​

Dubovan PI, Baron CA. Model-based determination of the synchronization delay between MRI and trajectory data. Magnetic Resonance in Medicine. 2023;89:721–728. doi:10.1002/mrm.29460.

Source: src/Synchronization/FindDelay.jl

HighOrderMRI.jl documentation · dev · code fa12c44 · docs fa12c44