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
Here all profiles encode the same unknown image
For an instantaneous dynamic field coefficient
If 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 nSam and nDyn in Julia). The physical first-order vector grid.nZ == 1 and x/y/z otherwise; the residual row set is
Separating the spatially uniform term, full first-order phase, static off-resonance, and higher-order terms gives
Here
HighOrderMRI uses the positive forward-phase convention
Accordingly, all terms inside
Optional concomitant phase
The concomitant keyword supplies four additional time-integrated coefficients,
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, times again. Divide coefficients expressed in rad/m² by
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
The factor prod(grid.matrixSize). The forward ignores values outside the mask; the adjoint returns zeros there.
If
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
fieldmap_masked = vec(fieldmap)[vec(mask)]
phase = fieldmap_masked .* transpose(times) .+ bf * ksphawhere 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
the first-order Fourier matrix
and the residual phase matrix
With
where
with
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
Low-rank factorization
HighOrderLowRankOp retains
For each dynamic,
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
which yields
By default global_basis_tol=nothing, so the final
The stored sample-domain coefficient matrix is
Here nfft_center_correction=false. The first-order Fourier phase remains in the NFFT. Forward multiplication uses
The shared basis is constructed incrementally across profiles. For an earlier profile,
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 row | Order | Spatial basis |
|---|---|---|
| 1 | 0 | |
| 2 | 1 | |
| 3 | 1 | |
| 4 | 1 | |
| 5 | 2 | |
| 6 | 2 | |
| 7 | 2 | |
| 8 | 2 | |
| 9 | 2 | |
| 10 | 3 | |
| 11 | 3 | |
| 12 | 3 | |
| 13 | 3 | |
| 14 | 3 | |
| 15 | 3 | |
| 16 | 3 |
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 (, , ) define the 3D NFFT trajectory; . - 2D (
nZ == 1): rows 2-3 (, ) define the 2D NFFT trajectory; , so row 4 remains in the residual model. With the default centred Grid(..., nZ=1, ...), the singlecoordinate is , so . A nonzero row-4 contribution requires a supplied nonzero grid.zslice 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 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
The physical voxel spacing
For the default untransformed Cartesian grid, Grid places voxel centres at
For odd
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
| Quantity | Explicit operators | Low-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
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.
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.