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
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 objectshape::NTuple{D,Int64}- size of image to be encoded/reconstructed
MRIOperators.encodingOp_multiEcho_parallel Method
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 objectshape::NTuple{D,Int64}- size of image to be encoded/reconstructedsenseMaps::AbstractArray{Complex{T}}- coil sensitivities with the coils in the fourth dimension
MRIOperators.encodingOps_parallel Method
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 objectshape::NTuple{D,Int64}- size of image to be encoded/reconstructedsenseMaps::AbstractArray{Complex{T},4}- coil sensitivities with the coils in the fourth dimension
MRIOperators.encodingOps_simple Method
encodingOps_simple(acqData::AcquisitionData, shape::NTuple{D,Int64}
; kargs...) where Dgenerates an Array of LinearOperators which describe signal encoding of the individual contrasts in an MRI acquisition (for a given slice).
Arguments
acqData::AcquisitionData- AcquisitionData objectshape::NTuple{D,Int64}- size of image to be encoded/reconstructed
MRIOperators.fourierEncodingOp Method
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/reconstructtr::Trajectory- trajectory with the k-space nodes to sampleopName::String-"explicit"for anExplicitOp, or"fast"for aFieldmapNFFTOpif the correction map is not zero (two-dimensional images only), otherwise anNFFTOpfor non-Cartesian trajectories and, for Cartesian trajectories with no more samples, profiles or slices thanshape, anFFTOp, with aSamplingOpif 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 equals1:Nfor theNnodes oftr, aSamplingOpselects 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 toExplicitOpandFieldmapNFFTOp(
S = Vector{Complex{T}}) - storage vector type, for exampleCuVector{ComplexF32}on a GPU(
kargs) - options of the approximation forFieldmapNFFTOp, and NFFT options such asoversamplingFactorandkernelSizeforNFFTOp, which also takes an integermas its kernel size;ExplicitOpandFFTOpignore them
Operator Types
MRIOperators.ExplicitOp Method
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/reconstructtr::Trajectory- Trajectory with the kspace nodes to samplecorrectionmap::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 timeTEof 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 exampleCuVector{ComplexF32}on a GPU(
kargs) - further keyword arguments, which are ignored
Moving to another array backend
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.
MRIOperators.FieldmapNFFTOp Method
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/reconstructtr::Trajectory- Trajectory with the kspace nodes to samplecorrectionmap::Array{Complex{T},D}- complex correction mapzwith 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 ofexp(-z t), wheretis 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 timeTEof 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 everystep-th sample of it and uses the functions for all profiles, so it works for profiles with the same sampling times and aboutstepor more samples per function(
S = Vector{Complex{T}}) - storage vector type, for exampleCuVector{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 asoversamplingFactorhave no effect
Moving to another array backend
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.
MRIOperators.SensitivityOp Type
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
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.
MRIOperators.SensitivityOp Method
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
MRIOperators.SubspaceOp Type
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
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.
MRIOperators.MapSliceOp Type
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 applysize1- size of the Array to be transformedsize2- size of the resulting Array of applying trafo to all slices(
T=ComplexF64) - type of the transformation
Moving to another array backend
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.
Sparsifying Transforms
Use a Custom Sparsifying Transform shows how to use these and other transforms in a reconstruction.
MRIOperators.SparseOp Method
SparseOp(T::Type, name::AbstractString, shape::NTuple{N,Int64}; S = Vector{T}, kargs...) where Ngenerates the sparsifying transform (<: AbstractLinearOperator) given its name.
Arguments
T::Type- element type of the transform, for exampleComplexF64name::AbstractString- name of the sparsifying transform:"Wavelet"forWaveletOpwith its default wavelet, Daubechies 2, or"nothing"for the identity; other names throw an errorshape::NTuple{N,Int64}- size of the Array to be transformed(
S = Vector{T}) - storage vector type, for exampleCuVector{ComplexF32}on a GPU(
kargs) - further keyword arguments, which are ignored