Skip to content

MRIOperators ​

MRIOperators implements the encoding operators used in MRI reconstruction: Fourier encoding with and without field inhomogeneity correction, coil sensitivities and sparsifying transforms. It builds on LinearOperatorCollection.jl and re-exports its operators, such as FFTOp, NFFTOp, WaveletOp, DiagOp and normalOperator, which are documented there. MRIOperators depends on MRIBase. MRIReco re-exports MRIOperators, so using MRIReco makes all names on this page available. Signal Model and Encoding Operators explains the operators, and the guide Use Encoding Operators Directly shows how to build and apply them.

Encoding Operators ​

MRIOperators.encodingOp_multiEcho Method
julia
encodingOp_multiEcho(acqData::AcquisitionData{T,D}, shape::NTuple{D,Int64}; kargs...) where {T,D}

generates a LinearOperator which describe combined signal encoding of all the contrasts in an MRI acquisition (for a given slice).

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • shape::NTuple{D,Int64} - size of image to be encoded/reconstructed

source
MRIOperators.encodingOp_multiEcho_parallel Method
julia
encodingOp_multiEcho_parallel(acqData::AcquisitionData{T,D}, shape::NTuple{D,Int64}
                                      , senseMaps::AbstractArray{Complex{T}}
                                      ; kargs...) where {T,D}

generates a LinearOperator which describe combined signal encoding of all the contrasts in an MRI acquisition (for a given slice). The different coils are taken into account in terms of their sensitivities

Arguments

  • acqData::AcquisitionData{T,D} - AcquisitionData object

  • shape::NTuple{D,Int64} - size of image to be encoded/reconstructed

  • senseMaps::AbstractArray{Complex{T}} - coil sensitivities with the coils in the fourth dimension

source
MRIOperators.encodingOps_parallel Method
julia
encodingOps_parallel(acqData::AcquisitionData{T,D}, shape::NTuple{D,Int64}
                          , senseMaps::AbstractArray{Complex{T},4}
                          ; kargs...) where {T,D}

generates an Array of LinearOperators which describe signal encoding of the individual contrasts in an MRI acquisition. The different coils are taken into account in terms of their sensitivities

Arguments

  • acqData::AcquisitionData{T,D} - AcquisitionData object

  • shape::NTuple{D,Int64} - size of image to be encoded/reconstructed

  • senseMaps::AbstractArray{Complex{T},4} - coil sensitivities with the coils in the fourth dimension

source
MRIOperators.encodingOps_simple Method
julia
encodingOps_simple(acqData::AcquisitionData, shape::NTuple{D,Int64}
                          ; kargs...) where D

generates an Array of LinearOperators which describe signal encoding of the individual contrasts in an MRI acquisition (for a given slice).

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • shape::NTuple{D,Int64} - size of image to be encoded/reconstructed

source
MRIOperators.fourierEncodingOp Method
julia
fourierEncodingOp(shape::NTuple{D,Int64}, tr::Trajectory{T}, opName::String;
                  subsampleIdx::Vector{Int64}=Int64[], slice::Int64=1,
                  correctionMap::Array{Complex{T}}=Complex{T}[], echoImage::Bool=true,
                  S = Vector{Complex{T}}, kargs...) where {T,D}

returns the Fourier encoding operator of the trajectory tr for images of size shape.

Arguments

  • shape::NTuple{D,Int64} - size of image to encode/reconstruct

  • tr::Trajectory - trajectory with the k-space nodes to sample

  • opName::String - "explicit" for an ExplicitOp, or "fast" for a FieldmapNFFTOp if the correction map is not zero (two-dimensional images only), otherwise an NFFTOp for non-Cartesian trajectories and, for Cartesian trajectories with no more samples, profiles or slices than shape, an FFTOp, with a SamplingOp if they have fewer; other names throw an error

  • (subsampleIdx::Vector{Int64}) - for Cartesian trajectories, the indices of the sampled nodes; unless the vector is empty or equals 1:N for the N nodes of tr, a SamplingOp selects them after the transform

  • (slice::Int64=1) - for two-dimensional images, the slice of the correction map, along its third dimension, that the operator uses

  • (correctionMap) - complex correction map with the relaxation rate R₂* in 1/s as its real part and the off-resonance frequency in rad/s as its imaginary part, in the precision of the trajectory

  • (echoImage::Bool=true) - passed to ExplicitOp and FieldmapNFFTOp

  • (S = Vector{Complex{T}}) - storage vector type, for example CuVector{ComplexF32} on a GPU

  • (kargs) - options of the approximation for FieldmapNFFTOp, and NFFT options such as oversamplingFactor and kernelSize for NFFTOp, which also takes an integer m as its kernel size; ExplicitOp and FFTOp ignore them

source

Operator Types ​

MRIOperators.ExplicitOp Method
julia
ExplicitOp(shape::NTuple{D,Int64}, tr::Trajectory{T}, correctionmap::AbstractArray{Complex{T},D}
        ; echoImage::Bool=false, S = Vector{Complex{T}}, kargs...) where {T,D}

generates an ExplicitOp, which evaluates the MRI Fourier signal encoding operator explicitly, including off-resonance and relaxation.

Arguments:

  • shape::NTuple{D,Int64} - size of image to encode/reconstruct

  • tr::Trajectory - Trajectory with the kspace nodes to sample

  • correctionmap::AbstractArray{Complex{T},D} - complex correction map with the relaxation rate R₂* in 1/s as its real part and the off-resonance frequency in rad/s as its imaginary part, in the precision of the trajectory

  • (echoImage::Bool=false) - if true, the sampling times are counted from the echo time TE of the trajectory, so the image is the magnetization at that time, which with off-resonance is complex-valued even for a real-valued object

  • (S = Vector{Complex{T}}) - storage vector type, for example CuVector{ComplexF32} on a GPU

  • (kargs) - further keyword arguments, which are ignored

Moving to another array backend

julia
Adapt.adapt(CuArray, op::ExplicitOp)

returns a new ExplicitOp built from Adapt.adapt(CuArray, ...) of the k-space nodes, readout times and correction map of op, with the same shape and echo time offset; the trajectory is not used again. adjoint(op) is an AdjointLinearOperator with parent op, and adapting it adapts that parent. On the same backend, the arrays may be shared with op and are only read. op itself is not modified. SensitivityOp, SubspaceOp, MapSliceOp, ExplicitOp and FieldmapNFFTOp are the MRI operators that support Adapt.adapt so far.

source
MRIOperators.FieldmapNFFTOp Method
julia
FieldmapNFFTOp(shape::NTuple{D,Int64}, tr::Trajectory,
                    correctionmap::Array{Complex{T},D};
                    method::String="nfft",
                    echoImage::Bool=true,
                    alpha::Float64=1.25,
                    m::Float64=2.0,
                    K=20,
                    K_tol::Float64=1.e-3,
                    step::Int64=10,
                    S = Vector{Complex{T}},
                    scheduler = DynamicScheduler(),
                    kargs...) where {T,D}

generates a FieldmapNFFTOp for two-dimensional images, which evaluates the MRI Fourier signal encoding operator, including off-resonance and relaxation, as a weighted sum of NFFTs.

Arguments:

  • shape::NTuple{D,Int64} - size of image to encode/reconstruct

  • tr::Trajectory - Trajectory with the kspace nodes to sample

  • correctionmap::Array{Complex{T},D} - complex correction map z with the relaxation rate R₂* in 1/s as its real part and the off-resonance frequency in rad/s as its imaginary part

  • (method::String="nfft") - approximation of exp(-z t), where t is the sampling time, for a map that is not spatially constant and sampling times that are not all equal: "nfft", "leastsquare", "hist", which works for a map with only an off-resonance part, or "svd", which works for a double-precision map with a spatially varying off-resonance part; see Correct Off-Resonance

  • (echoImage::Bool=true) - if true, the sampling times are counted from the echo time TE of the trajectory, so the image is the magnetization at that time, which with off-resonance is complex-valued even for a real-valued object

  • (alpha::Float64=1.25) - oversampling factor of the "nfft" approximation

  • (m::Float64=2.0) - kernel size of the "nfft" approximation

  • (K=20) - number of terms of "leastsquare" and "hist" and maximum number of terms of "svd"; "nfft" determines the number itself

  • (K_tol::Float64=1.e-3) - tolerance with which "svd" chooses the number of terms

  • (step::Int64=10) - "svd" takes its functions of time from the first profile, fits its coefficients to every step-th sample of it and uses the functions for all profiles, so it works for profiles with the same sampling times and about step or more samples per function

  • (S = Vector{Complex{T}}) - storage vector type, for example CuVector{ComplexF32} on a GPU

  • (scheduler = DynamicScheduler()) - scheduler of the parallel loop over the terms

  • (kargs) - further keyword arguments, which are ignored, so NFFT options such as oversamplingFactor have no effect

Moving to another array backend

julia
Adapt.adapt(CuArray, op::FieldmapNFFTOp)

returns a new FieldmapNFFTOp with the approximation coefficients of op moved by Adapt.adapt(CuArray, ...), so they are not computed again. Its NFFT plans and work arrays are new: the plans are built from k-space nodes kept on the CPU, with the NFFT backend that was active when op was constructed. op itself is not modified. The backend may choose other plan defaults on the new device (NonuniformFFTs uses another window on CUDA), so the results can differ from those of op within the NFFT accuracy. With JLArrays the operator was tested with the NFFT.jl backend only; NonuniformFFTs does not create plans for them. SensitivityOp, SubspaceOp, MapSliceOp, ExplicitOp and FieldmapNFFTOp are the MRI operators that support Adapt.adapt so far.

source
MRIOperators.SensitivityOp Type
julia
SensitivityOp(sensMaps::AbstractMatrix{T}, numContr=1)

builds a LinearOperator which performs multiplication of a given image with the coil sensitivities specified in sensMaps

Arguments

  • sensMaps - sensitivity maps ( 1. dim -> voxels, 2. dim-> coils)

  • numContr - number of contrasts to which the operator will be applied

The forward operation uses sensMaps itself, while the adjoint uses conj.(sensMaps) computed at construction.

Moving to another array backend

julia
Adapt.adapt(CuArray, op::SensitivityOp)

returns a new SensitivityOp with a new parent operator, built from Adapt.adapt(CuArray, ...) of the sensitivity maps and of their conjugates, so it applies the same forward and adjoint operation as op at the time of the call. In particular, the adjoint keeps using the conjugated maps computed when op was built. On the same backend, the maps may be shared with op and are only read. op itself is not modified. SensitivityOp, SubspaceOp, MapSliceOp, ExplicitOp and FieldmapNFFTOp are the MRI operators that support Adapt.adapt so far.

source
MRIOperators.SensitivityOp Method
julia
SensitivityOp(sensMaps::AbstractArray{T,4}, numContr=1)

builds a LinearOperator which performs multiplication of a given image with the coil sensitivities specified in sensMaps

Arguments

  • sensMaps - sensitivity maps ( 1.-3. dim -> voxels, 4. dim-> coils)

  • numContr - number of contrasts to which the operator will be applied

source
MRIOperators.SubspaceOp Type
julia
SubspaceOp(basis::AbstractMatrix{T},shape::NTuple{D,Int64},numContr) where {T,D}

basis correspond to svd_object.V cropped to a certain level

basis type should correspond to the type of the rawdata

Moving to another array backend

julia
Adapt.adapt(CuArray, op::SubspaceOp)

returns a new SubspaceOp with a new parent operator, built from Adapt.adapt(CuArray, basis). Its storage type S is derived from the adapted basis. On the same backend, the basis may be shared with op and is only read. op itself is not modified. SensitivityOp, SubspaceOp, MapSliceOp, ExplicitOp and FieldmapNFFTOp are the MRI operators that support Adapt.adapt so far.

source
MRIOperators.MapSliceOp Type
julia
MapSliceOp(trafo, dim::Int64, size1::Tuple, size2::Tuple; T=ComplexF64)

generates an operator that applies trafo to each slice of dimension dim of an array

Arguments

  • trafo - transformation to apply

  • size1 - size of the Array to be transformed

  • size2 - size of the resulting Array of applying trafo to all slices

  • (T=ComplexF64) - type of the transformation

Moving to another array backend

julia
Adapt.adapt(CuArray, op::MapSliceOp)

returns a new MapSliceOp with a new parent operator, built from Adapt.adapt(CuArray, trafo) and the same dim, size1, size2 and T. An operator trafo is adapted by its own Adapt rule, such as those of LinearOperatorCollection; an operator without one is kept unchanged. On the same backend, an array trafo may be shared with op and is only read; an operator trafo kept unchanged is shared with op, including any internal state it updates when applied. op itself is not modified. SensitivityOp, SubspaceOp, MapSliceOp, ExplicitOp and FieldmapNFFTOp are the MRI operators that support Adapt.adapt so far.

source

Sparsifying Transforms ​

Use a Custom Sparsifying Transform shows how to use these and other transforms in a reconstruction.

MRIOperators.SparseOp Method
julia
SparseOp(T::Type, name::AbstractString, shape::NTuple{N,Int64}; S = Vector{T}, kargs...) where N

generates the sparsifying transform (<: AbstractLinearOperator) given its name.

Arguments

  • T::Type - element type of the transform, for example ComplexF64

  • name::AbstractString - name of the sparsifying transform: "Wavelet" for WaveletOp with its default wavelet, Daubechies 2, or "nothing" for the identity; other names throw an error

  • shape::NTuple{N,Int64} - size of the Array to be transformed

  • (S = Vector{T}) - storage vector type, for example CuVector{ComplexF32} on a GPU

  • (kargs) - further keyword arguments, which are ignored

source