Skip to content

HighOrderExplicitOp ​

HighOrderExplicitOp is the Explicit family type and constructor. implementation=:array selects Array evaluation; implementation=:kernel selects CUDA direct kernels or GEMM and phase-reuse. Concrete implementation types are internal. See the implementation guide, Array options and CUDA options.

Complete CPU example ​

julia
using HighOrderMRI, LinearAlgebra
using LinearOperatorCollection

grid = Grid(4,3,1,1f-3,1f-3,5f-3)
kspha = zeros(Float32,9,7)
kspha[2,:] .= range(-100f0,100f0;length=7)
times = collect(range(0f0,2f-3;length=7))
fieldmap = reshape(collect(range(-20f0,20f0;length=12)),4,3)
op = HighOrderExplicitOp(grid,kspha,times;
    implementation=:array, arrayType=Array, fieldmap, nBlock=3)
x = ones(ComplexF32,12)
signal = op*x
D = Float32.(range(0.2,1;length=7))
normal = normalOperator(op,D)*x
@assert size(op) == (7,12)
@assert all(isfinite,normal)
@assert norm(normal-op'*(D.*signal))/norm(normal) < 1e-5

normalOperator receives the already squared diagonal. recon_HOOp receives raw square-root weights instead. For CUDA paths, explicitly close the operator after its final use. Array close is a no-op; its model arrays stay referenced until the operator is dropped.

Constructor API ​

Explicit operator family ​

julia
HighOrderExplicitOp

Explicit MRI encoding operator with Array or CUDA execution. Construct it with HighOrderExplicitOp(grid, kspha, times; implementation, kwargs...). Concrete implementation types are internal. All implementations use the same positive phase, mask, sample/coil ordering and voxel normalization.

Source: src/EncodingOperator/HighOrderExplicitOp.jl

Explicit family constructor ​

julia
HighOrderExplicitOp(grid::Grid{T}, kspha::AbstractMatrix{T},
    times::AbstractVector{T}; implementation::Symbol=:array,
    kwargs...) where T<:AbstractFloat

Construct an Explicit encoding operator with implementation=:array or :kernel. :array uses array operations on CPU or CUDA; :kernel uses direct CUDA kernels or resident matrix execution. The returned operator is an instance of HighOrderExplicitOp.

The default is implementation=:array, arrayType=CuArray. Pass arrayType=Array for CPU execution. The CUDA implementation requires CuArray; its default backend=:legacy computes on CUDA with host solver vectors. backend=:direct, :blocked, :cached, and :cached_full keep solver vectors on the primary GPU. Select participating GPUs with gpus.

With backend=:blocked, phase_backend=:gemm, gemm_backend=:cublas generates the dynamic phase by real GEMM and reuses each complex phase block across coils and both normal products. phase_cache_bytes=0 disables the optional prefix cache. Matrix execution introduces no low-rank truncation.

Inputs contain one flattened sample axis: kspha is (9,N) or (16,N) and times has length N. For multiple readouts of one image, flatten samples before readouts in both model inputs and data. Weights are passed to recon_HOOp or the normal operator, not this constructor.

Physical, block, precision and execution options are documented in the Explicit guide and implementation option pages. Call close(op) after the final use; CUDA normals share their parent's mutable workspaces. Array operators own no persistent execution resources.

Source: src/EncodingOperator/HighOrderExplicitOp.jl

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