Skip to content

Expanded encoding model ​

This page explains how physical field information becomes the forward encoding operator used in reconstruction. HighOrderExplicitOp evaluates the phase explicitly; HighOrderLowRankOp separates Fourier encoding from a low-rank residual. For the ordinary forward model (kspha_dt=nothing), they target the same equation under the coordinate and array conventions below. LowRank also introduces low-rank truncation and NFFT interpolation error.

Read the signal model and array layout first to prepare inputs, then the Fourier/residual split to understand the algorithm. A complete CPU example connects the equation to the constructor. Detailed low-rank construction belongs in Low-rank shared subspace.

Notation is defined centrally in Symbols and notation. Phase sign, spatial coordinates, solid-harmonic normalization, vector ordering, and operator normalization are treated as part of the model definition and are held fixed when implementations are compared.

Signal model ​

Let m(r) denote the complex transverse magnetization at physical location r=(x,y,z)T, and let Cc(r) denote the receive sensitivity of coil c. For encoding profile or interleave i, the receive signal is represented as

yi,c(t)=∫Ωm(r)Cc(r)exp[i2πΦi(r,t)]dr+ϵi,c(t),

Here all profiles encode the same unknown image m(r); i does not introduce a separate reconstructed image frame. Φi(r,t) denotes the accumulated encoding phase in cycles before multiplication by 2π. This formulation follows the expanded-encoding treatment used for reconstruction in the presence of spatiotemporally varying higher-order fields. [1]

For an instantaneous dynamic field coefficient aℓ,i(t), define the accumulated coefficient

kℓ,i(t)=∫treftaℓ,i(τ)dτ.

If aℓ,i is expressed in Hz per basis unit, then kℓ,i is expressed in cycles per basis unit. HighOrderMRI therefore expects the time-integrated coefficients kℓ,i(t) in kspha; the encoding constructors do not integrate instantaneous fields or convert radians automatically. times contains the time used in the static off-resonance product (seconds for a field map in Hz). Choose consistent time references for that phase and the supplied accumulated coefficients.

Readout i contains Nt samples; there are Nro readouts (nSam and nDyn in Julia). The physical first-order vector ki(t) contains x/y/z coefficients, and H={5,…,nTerm} contains the modeled higher-order rows. For NFFT factorization, active axes I are x/y when grid.nZ == 1 and x/y/z otherwise; the residual row set is R={4}∪H in 2D and R=H in 3D. The z term is counted once.

Separating the spatially uniform term, full first-order phase, static off-resonance, and higher-order terms gives

Φi(r,t)=k0,i(t)+tΔf0(r)+ki(t)Tr+∑ℓ∈Hkℓ,i(t)bℓ(r)+ϕcon,i(r,t).

Here k0,i(t) is the zeroth-order accumulated phase, Δf0(r) is the static off-resonance map, ki(t) contains the first-order spatial coefficients, and bℓ(r) is a real solid-harmonic basis function. The residual set R depends on whether the reconstruction is two- or three-dimensional, as specified below.

HighOrderMRI uses the positive forward-phase convention

exp(+i2πΦi(r,t)).

Accordingly, all terms inside Φi must be expressed in cycles. Field-camera phase supplied in radians must be divided by 2π before entering this convention.

Optional concomitant phase ​

The concomitant keyword supplies four additional time-integrated coefficients,

ϕcon,i(r,t)=c1,i(t)z2+c2,i(t)(x2+y2)+c3,i(t)xz+c4,i(t)yz.

Supply coefficients in cycles/m², with coordinates in metres in the same frame and physical origin as the coefficients. Use (4,nSam) for HighOrderExplicitOp or a single-dynamic LowRank problem; use (4,nSam,nDyn) for dynamic LowRank. Their row order is exactly z², x²+y², xz, yz.

With concomitant=nothing, ϕcon,i=0. Otherwise add this phase to Φi and to the residual exponent in Hi below. The coefficients are already integrated at the supplied sample times: they are neither inferred from gradients nor multiplied by times again. Divide coefficients expressed in rad/m² by 2π before supplying them.

The original kspha retains its 9 or 16 spherical-harmonic rows. Concomitant coefficients are appended after recon_terms selection, so this string does not disable them. This augments the physical model, independently of choosing an explicit or low-rank representation. The explicit kspha_dt delay-estimation path ignores concomitant and keeps its existing derivative model.

Discrete dynamic formulation ​

Let tji denote sample j in dynamic i, mv the magnetization at masked voxel v, and Cvc the corresponding receive sensitivity. The discrete operator implemented in HighOrderMRI is

yjic=1Nv∑v=1NvmvCvcexp{i2π[k0,ji+tjiΔf0,v+kjiTrv+∑ℓ∈Hkℓ,jibℓ,v+ϕcon,i(rv,tji)]}+εjic.

The factor 1/Nv is a symmetric numerical normalization used by the forward and adjoint operators; it is not introduced as a spatial quadrature weight for the continuous signal integral. Nv=count(mask), while the public image vector has length prod(grid.matrixSize). The forward ignores values outside the mask; the adjoint returns zeros there.

If φjiv is the complete bracketed phase above, the adjoint is

(AHy)v=1Nv∑i=1Nro∑c=1Nc∑j=1NtCvc―exp⁡(−i2πφjiv)yjic.

It conjugates both the encoding phase and receive sensitivity and sums all profiles into the same image. Applying this adjoint alone is a backprojection; iterative reconstruction solves the inverse problem.

For one dynamic and the masked voxels, the explicit phase can be written as

julia
fieldmap_masked = vec(fieldmap)[vec(mask)]
phase = fieldmap_masked .* transpose(times) .+ bf * kspha

where times is a vector for this single profile, bf has shape (nVox,nTerm), and its first column is identically one. Thus, the spatially uniform dynamic term is included once through the first coefficient row of kspha. Optional concomitant basis columns and coefficient rows are appended before evaluating the same product.

Matrix formulation ​

For dynamic i, define the zeroth-order temporal modulation

D0,i(j,j)=exp(i2πk0,ji),

the first-order Fourier matrix

Fi(j,v)=exp(i2π∑a∈Ika,jira,v),

and the residual phase matrix

Hi(j,v)=exp{i2π[tjiΔf0,v+∑ℓ∈Rkℓ,jibℓ,v+ϕcon,i(rv,tji)]}.

With D0,i∈CNt×Nt and Fi,Hi∈CNt×Nv, the single-dynamic spatial encoding matrix is

Ei=D0,i(Fi⊙Hi),

where ⊙ denotes the Hadamard product. For coil c,

yi,c=1NvEiCcm+εi,c,

with Cc=diag(C1c,…,CNvc).

This factorization provides the common mathematical reference for the explicit and low-rank implementations.

Explicit implementation ​

HighOrderExplicitOp evaluates the complete phase model directly and therefore does not introduce a low-rank approximation.

implementation=:array selects array-based evaluation on CPU or CUDA arrays. Sample-voxel phase blocks are evaluated explicitly, with nBlock controlling the temporary-memory/runtime trade-off.

implementation=:kernel evaluates the same model with host-vector/direct kernels or resident cuBLAS backends. Legacy multi-GPU execution partitions masked voxels; resident backends partition samples. Blocked and cached representations retain the complete phase model, including supplied concomitant terms. Data placement and finite-precision reduction order change; the encoding equation does not.

For a single profile, the operator represents y=Am. The reconstruction wrapper applies data weights and a CG-based solver; the encoding operator itself does not reconstruct an image. See Reconstruction workflow for solver use. Explicit implementations avoid low-rank truncation, while finite-precision phase evaluation and reduction remain numerical error sources.

Low-rank factorization ​

HighOrderLowRankOp retains D0,i and the first-order Fourier encoding while approximating only the residual matrix Hi. This separation is related to singular-vector representations previously used to accelerate higher-order MRI reconstruction and to subsequent expanded-model reconstructions such as MaxGIRF. [2] [3]

For each dynamic,

Hi≈Ui,LV~iH,

where the local factors are obtained using a matrix-free randomized SVD. The randomized range-finding step follows standard randomized matrix-decomposition methods. [4]

With the default method=:incremental_shared, the retained spatial factors are compressed incrementally into a shared basis. Denote the completed incremental basis by S(0)∈CNv×R0 and the saved coefficient blocks by C¯i∈CR0×L:

V~i≈S(0)C¯i,

which yields

Hi≈q^i(0)(S(0))H,q^i(0)=Ui,LC¯iH.

By default global_basis_tol=nothing, so the final S,q^i are these incremental factors. A supplied nonnegative tolerance enables optional final recompression of the completed representation; this can reduce its rank and adds a separate approximation. It occurs before temporal phase folding.

The stored sample-domain coefficient matrix is

qi(j,r)=1Nvexp⁡(i2πk0,ji)cctr(j,i)q^i(j,r).

Here cctr is the parity-dependent correction defined below; it is one when nfft_center_correction=false. The first-order Fourier phase remains in the NFFT. Forward multiplication uses qi and the conjugated spatial basis, while the adjoint uses their conjugates in reverse order.

The shared basis is constructed incrementally across profiles. For an earlier profile, C¯i generally differs from (S(0))HV~i: earlier coefficient blocks are zero-padded when the basis grows, rather than reprojected. This statement refers to the incremental representation before optional final recompression.

method=:per_readout instead retains each profile's local factors. It avoids incremental sharing and requires global_basis_tol=nothing; it is a storage/execution choice, distinct from enabling physical field terms. The complete derivation and parameter meanings are given in Low-rank shared subspace and the LowRank API.

Solid-harmonic basis order ​

Julia uses one-based rows in kspha. The operator-supported terms through third order are:

Julia rowOrderSpatial basis
101
21x
31y
41z
52xy
62zy
723z2−(x2+y2+z2)
82xz
92x2−y2
1033yx2−y3
113xyz
123[5z2−(x2+y2+z2)]y
1335z3−3z(x2+y2+z2)
143[5z2−(x2+y2+z2)]x
153x2z−y2z
163x3−3xy2

These are the unnormalized real polynomial basis functions implemented by basisfunc_spha; they should not be interpreted as normalized spherical harmonics. Coefficients defined for a different normalization or coordinate system require an explicit conversion. When coordinates are expressed in metres, typical accumulated-coefficient units are cycles, cycles/m, cycles/m², and cycles/m³ for orders zero through three.

basisfunc_spha contains additional higher-order polynomial terms, whereas the current high-order encoding constructors accept 9 or 16 terms, corresponding to second- or third-order encoding, respectively.

2D and 3D Fourier-residual separation ​

The Fourier/residual split depends on reconstruction dimensionality and follows the implemented operator:

  • 3D (nZ > 1): rows 2-4 (x, y, z) define the 3D NFFT trajectory; R={5,…,nTerm}.
  • 2D (nZ == 1): rows 2-3 (x, y) define the 2D NFFT trajectory; R={4,…,nTerm}, so row 4 remains in the residual model. With the default centred Grid(..., nZ=1, ...), the single z coordinate is z=0, so kz(t)z=0. A nonzero row-4 contribution requires a supplied nonzero grid.z slice coordinate and coefficients in the same frame. This residual contribution does not add a third NFFT axis.

The zeroth-order row is included in neither the NFFT trajectory nor Hi; it is applied once through D0,i or, in the low-rank implementation, through the equivalent temporal modulation incorporated into q.

NFFT sign and centring ​

AbstractNFFTs uses a negative Fourier exponent on an integer-centred grid, whereas the explicit HighOrderMRI convention uses the positive physical phase defined above. For active axis a, the NFFT node is therefore

ξa,ji=−ka,jiΔa.

The physical voxel spacing Δa is applied independently along each active axis; use of one common spacing is incorrect for an anisotropic grid.

For the default untransformed Cartesian grid, Grid places voxel centres at

ra[n]=[n−Na+12]Δa,n=1,…,Na.

For odd Na, the physical and integer-centred NFFT grids have the same centre. For even Na, the physical voxel centres are shifted by half a voxel. With ξa=−kaΔa, the low-rank implementation incorporates the corresponding temporal correction

cctr,a(j,i)=exp[i2π(−12ξa,ji)]=exp(iπka,jiΔa)

for each even active axis; no correction is required for odd axes. The total centre correction is the product over active axes. This convention is enabled by default (nfft_center_correction=true). Turning it off removes this parity correction; it does not select a different forward phase sign or disable zeroth-order phase.

Coordinate scope ​

The explicit operators evaluate the supplied grid.x, grid.y, and grid.z coordinates directly. LowRank evaluates its residual basis at those coordinates, but constructs its Fourier nodes from kspha, the axis spacings, and MatrixSize. It does not infer an active-axis permutation, reversal, translation, or rotation from edited coordinate vectors.

For the Fourier/residual equivalence above, use the default centred Cartesian coordinates on the active NFFT axes. A Grid coordinate change such as exchange_xy, reverse_x, or an added active-axis offset is not automatically carried through the LowRank Fourier encoding. Matching the intended transformed geometry requires an explicitly consistent coefficient/image/phase conversion; changing the coordinate vectors alone is insufficient. In a 2D problem, a nonzero grid.z remains in the residual model as described above.

Array layout ​

QuantityExplicit operatorsLow-rank operator
kspha(nTerm,nSam)(nTerm,nSam,nDyn)
times(nSam,)(nSam,nDyn)
image vector(prod(grid.matrixSize),)same unknown image for all profiles
fieldmap(nX,nY[,nZ])same
csm(nX,nY[,nZ],nCha)same
mask(nX,nY[,nZ])same
logical output(nSam,nCha)(nSam,nDyn,nCha)

The single-profile LowRank overload also accepts (nTerm,nSam) and (nSam,), adding a length-one profile dimension internally. This does not change the coil ordering.

Julia column-major vectorization makes samples the fastest-changing index, followed by profiles and then channels. Thus the one-based vector index for yjic is

j+(i−1)Nt+(c−1)NtNro.

Vectorize the logical output with vec, and pass vec(image) to an encoding operator. The same convention is summarized in the unified symbol table.

Selecting field orders ​

recon_terms is a binary string:

  • 9 terms: three digits for zeroth, first, and second order;
  • 16 terms: four digits for zeroth through third order.

With recon_terms=nothing, all supported orders are selected ("111" or "1111"). A zero in the zeroth-, second-, or third-order position zeros the corresponding coefficient rows. A zero in the first-order position replaces all of rows 2-4 with k_nominal; it does not set the trajectory to zero. The default k_nominal is the supplied kspha[2:4,...], so a different nominal trajectory must be supplied for that replacement to change those rows.

This flag does not disable the fieldmap * times contribution, and optional concomitant terms are appended after order selection. prep_kspha copies the input before applying this selection, so the caller's kspha is not modified.

Minimal CPU example ​

This example evaluates the forward equation and its adjoint for one profile. All lengths are in metres, times is in seconds, and the coefficient rows use cycles per corresponding basis unit.

julia
using HighOrderMRI, LinearAlgebra

T = Float64
nX, nY, nSam = 6, 5, 8
grid = Grid(nX, nY, 1, T(0.002), T(0.003), T(0.004))
times = collect(range(zero(T), T(0.002); length=nSam))
kspha = zeros(T, 9, nSam)
kspha[1, :] .= T(0.05)                         # cycles
kspha[2, :] .= range(T(-35), T(35); length=nSam) # cycles/m
kspha[3, :] .= T(12)                           # cycles/m
kspha[5, :] .= range(T(-40), T(40); length=nSam) # cycles/m²
fieldmap = fill(T(15), nX, nY)                  # Hz
csm = ones(Complex{T}, nX, nY, 1)
mask = trues(nX, nY)
mask[1, 1] = false

op = HighOrderExplicitOp(grid, kspha, times;
    fieldmap, csm, mask, arrayType=Array, nBlock=2)
image = ones(Complex{T}, nX, nY)
y = op * vec(image)
backprojection = reshape(adjoint(op) * y, nX, nY)
@assert length(y) == nSam
@assert iszero(backprojection[1, 1])

The explicit CPU operator makes every phase term visible without choosing a low-rank truncation. For LowRank setup and multi-profile or multi-GPU configuration, continue with the LowRank API and multi-GPU guide. Use Reconstruction workflow to solve for an image from measured data rather than applying only the adjoint.

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