Skip to content

recon_HOOp ​

Solve a weighted inverse problem using an already constructed operator. The reconstruction workflow explains data preparation, weights, regularization and GPU placement. A complete CPU example follows; its synthetic full Cartesian model is a usage check, not physical validation.

Example ​

julia
using HighOrderMRI, RegularizedLeastSquares, LinearAlgebra

T = Float64
nX, nY = 8, 8
grid = Grid(nX, nY, 1, T(1e-3), T(1e-3), T(5e-3))
nSam = nX * nY
kspha = zeros(T, 9, nSam)
kspha[2, :] .= repeat(T.(-4:3) ./ (nX * grid.Δx), nY)
kspha[3, :] .= repeat(T.(-4:3) ./ (nY * grid.Δy); inner=nX)
times = zeros(T, nSam)
op = HighOrderOp(grid, kspha, times; arrayType=Array, nBlock=8)
reference = zeros(Complex{T}, grid.matrixSize)
reference[3:6, 3:6, 1] .= 1
samples = reshape(op * vec(reference), nSam, 1)
weights = ones(Complex{T}, nSam)  # raw sample weights
rec_params = Dict{Symbol,Any}(
    :reconSize => grid.matrixSize,
    :solver => CGNR,
    :reg => L2Regularization(T(1e-3)),
    :iterations => 10,
)
image = recon_HOOp(op, samples, weights, rec_params)
@assert size(image) == grid.matrixSize
@assert all(isfinite, image)

Solver and storage choices ​

Let A be the encoding operator, y the measured data, and W the diagonal matrix of raw sample weights repeated for each coil. The solver receives WA and Wy, so each raw weight is applied once to predictions and once to measurements. The corresponding data normal is AHWHWA. That matrix is Hermitian positive semidefinite. Standard CG convergence assumptions require positive definiteness on the solved space; mask nullspaces and undersampling can make the data normal singular. Choose regularization and a solver appropriate to the problem, and check convergence. An adjoint backprojection alone does not solve this objective.

For CUDA LowRank and resident explicit execution, place the data matrix and raw weight vector on first(gpus) using the operator's complex precision. The wrapper returns a CPU image. The legacy explicit kernel path instead uses host solver vectors. See resource ownership.

API ​

julia
recon_HOOp(HOOp::HOOp{Complex{T}},
    Data::AbstractArray{Complex{T}, 2},
    weight::AbstractVector{Complex{T}},
    recParams::Dict;
    release_backend::Bool = true) where T <: AbstractFloat

Reconstruct an image with a high-order encoding operator.

Data has one row per sample/dynamic point and one column per receive coil. For dynamic low-rank encoding, reshape (nSam, nDyn, nCha) data to (nSam * nDyn, nCha) without permuting axes. weight contains one raw complex sample weight per row, repeated identically for all coils. Match the floating-point precision of the operator, data, and weights.

The wrapper weights both the data and encoding operator: with A = HOOp and diagonal W formed from the repeated raw weights, it passes W * A and W * vec(Data) to the solver. The data normal is Aᴴ Wᴴ W A, so a raw weight contributes abs2(weight) to the normal. Do not square the weights before passing them here. samplingDensity already returns square-root density weights for this convention.

recParams must explicitly contain :solver, :reg, and :reconSize. Remaining solver settings are merged with MRIReco's defaultRecoParams(); select a solver and regularizer that are compatible. The returned image is a CPU Array reshaped to recParams[:reconSize].

For CUDA low-rank reconstruction and resident explicit backends, pass data and weights as CUDA arrays on the primary GPU to match the solver's CUDA storage. This wrapper does not move those inputs to the GPU automatically.

For HighOrderLowRankOp, channel/readout backends initialize on a normal request; rank execution can initialize on a forward, adjoint, or normal request. By default, the wrapper releases the owned distributed backend in a finally block, including when reconstruction throws an exception.

Set release_backend=false to retain that backend for another reconstruction with the same operator and weights. Call close(HOOp) after its final use. Backend release retains the parent's factor arrays and per-readout source queue; close(HOOp) also releases that queue. Later use of the parent can recreate these resources lazily. To change normal weights while retaining a distributed parent (:channel, :readout, or :rank), release the old backend first and obtain a fresh normal view. The :single path has no such owned distributed backend.

Resident explicit operators require a separate close(HOOp) after their final use; this keyword handles only low-rank distributed backends.

See Reconstruction workflow for solver configuration and Multi-GPU execution for execution strategies and cleanup.

Source: src/Recon/recon_HOOp.jl

HighOrderMRI.jl documentation · v0.1.1 · code 5d6ac72 · docs 5d6ac72