Skip to content

MRIReco ​

MRIReco provides the image reconstruction of the framework. Of the packages in this repository, it depends on MRIBase and MRIOperators. It re-exports both, together with RegularizedLeastSquares.jl and AbstractImageReconstruction.jl, so the data types, encoding operators, solvers, regularization terms and the functions for reconstruction plans are available after using MRIReco. MRIFiles, MRISampling, MRICoilSensitivities and MRISimulation are independent of MRIReco and have to be loaded separately.

Reconstruction ​

Reconstruction Parameters lists the keys of the parameter dictionary.

MRIReco.reconstruction Function
julia
reconstruction(acqData::AcquisitionData, recoParams::Dict)

Performs image reconstruction of an AcquisitionData object. Parameters are specified in a dictionary.

Reconstruction types are specified by the key :reco. Valid reconstruction names are:

  • "direct" - direct Fourier reconstruction (default)

  • "standard" - iterative reconstruction for all contrasts, coils & slices independently

  • "multiEcho" - iterative joint reconstruction of all echo images

  • "multiCoil" - SENSE-type iterative reconstruction

  • "multiCoilMultiEcho" - SENSE-type iterative reconstruction of all echo images

  • "multiCoilMultiEchoSubspace" - SENSE-type iterative reconstruction of the coefficient maps of a temporal basis

The dictionary is merged into the defaults of defaultRecoParams, and :reconSize defaults to the encoding size of acqData. reconstruction then loads the plan of the reconstruction type with MRIRecoPlan. For the iterative reconstructions, a few keys first select the type of a parameter: :densityWeighting => false selects UniformWeightingParameters, :weights selects CustomWeightingParameters, :encodingOps selects CustomEncodingParameters, and a :sparseTrafo with an operator selects CustomSparsityParameters; "direct" does not support these keys and warns that it cannot set the parameter they select. reconstruction then sets the parameters of the same name as the other keys, for example iterations of LeastSquaresSolverParameter for :iterations, and runs the plan.

Other keys that the plan does not have are ignored. If the value of such a key is a parameter object such as UniformWeightingParameters(), an algorithm or a plan, reconstruction warns; with ENV["JULIA_DEBUG"] = "MRIReco", it lists the remaining keys that the plan does not have, :densityWeighting included.

source
julia
reconstruction(acqData::AcquisitionData, recoParams::Dict, filename::String;
               force=false)

This method is meant to save the result of reconstruction(acqData, recoParams) in the file filename, or to load it from there if force=false and the file exists. The functions it calls for this are no longer part of MRIReco, so it throws an UndefVarError: right away if force=false and the file exists, otherwise after the reconstruction.

source
MRIReco.defaultRecoParams Function
julia
defaultRecoParams() -> Dict{Symbol, Any}

Return the default parameters of reconstruction: :reco => "direct", :reg => L1Regularization(0.0), :normalizeReg => NoNormalization(), :solver => ADMM, :rho => 5e-2, :iterations => 30 and :arrayType => Array. reconstruction merges the given dictionary into them.

source

Reconstruction Plans ​

reconstruction translates the parameter dictionary into a reconstruction plan of AbstractImageReconstruction.jl and runs it. A plan for each reconstruction type is stored in reco_plans/ and can be loaded with MRIRecoPlan, e.g. MRIRecoPlan("multiCoil"), or run directly with reconstruct("multiCoil", acqData; kwargs...). Configure a Reconstruction with Plans shows how to use them.

AbstractImageReconstruction.reconstruct Method
julia
reconstruct(name::AbstractString, acqData::AcquisitionData; modules = getMRIRecoPlanModules(), kwargs...)

Perform a reconstruction of acqData with the RecoPlan specified by name. Additional keyword arguments can be passed to the reconstruction plan. modules are the modules whose types the plan file can use, see addMRIRecoPlanModule.

The plan is looked up as the file name.toml in the folders added with addMRIRecoPlanPath, the last added first, and then in the folder reco_plans of MRIReco. Alternatively, name can be the path of a plan file.

Examples

julia
Ireco = reconstruct("standard", acqData; kwargs...)
source
MRIReco.MRIRecoPlan Function
julia
MRIRecoPlan(value, modules = getMRIRecoPlanModules(); kwargs...)

Load a RecoPlan and set the keyword arguments if applicable. Value can be the name of a plan or path to plan file.

source
MRIReco.addMRIRecoPlanModule Method
julia
addMRIRecoPlanModule(mod::Module)

Add the mod module to the list of modules which are used for plan loading, so that plan files can use the types that mod exports.

source
MRIReco.addMRIRecoPlanPath Method
julia
addMRIRecoPlanPath(path)

Add the folder path to the folders in which MRIRecoPlan, reconstruct and reconstruction look for plan files. Added folders are searched before the folder reco_plans of MRIReco, the last added first, so a plan file with the name of a built-in plan, for example standard.toml, replaces it. A folder is added only once and only for the current Julia session.

source
MRIReco.getMRIRecoPlanList Method
julia
getMRIRecoPlanList(; full = false)

Retrieve a list of currently known RecoPlans. If full is true then full paths are returned.

source
MRIReco.getMRIRecoPlanModules Method
julia
getMRIRecoPlanModules()

Retrieve a list of currently used modules for plan loading

source
MRIReco.MRIRecoContext Type
julia
MRIRecoContext{D, arrT, S, Acq}

Container for reconstruction context parameters that are used throughout the reconstruction pipeline. Uses a ScopedValue for task-local access.

Fields

  • reconSize::NTuple{D, Int64} - Size of the reconstructed image

  • arrayType::Type{arrT} - Array type for computation (Array, JLArray, etc.)

  • storageType::Type{S} - Storage type for operators

  • acqData::Acq - Acquisition data or nothing, provides metadata like trajectory info

  • red3d::Bool - true if 3D-encoded data was converted to 2D slices and the user gave a 3D reconSize; user-supplied volumes (e.g. sensitivity maps) are then in 3D order and need to be permuted

Usage

julia
# Set the context for reconstruction
ctx = MRIRecoContext((128,128), Float64, Array)

# Or with acquisition data
ctx = MRIRecoContext((128,128), acqData, Array)

# Using with() to set scoped value
with(MRIRECO_CONTEXT => ctx) do
    # reconstruction code
end

# And then access anywhere in the reconstruction pipeline
function foo(sparsity_params)
    rs = ctx_reconSize()  # Get from scoped value
    ad = ctx_acqData()    # Get acquisition data if needed
    # ...
end
source
MRIReco.ctx_acqData Method
julia
ctx_acqData() -> Union{AcquisitionData, Nothing}

Get the acquisition data from the current MRI reconstruction context. Returns nothing if not set.

source
MRIReco.ctx_arrayType Method
julia
ctx_arrayType() -> Type

Get the array type from the current MRI reconstruction context.

source
MRIReco.ctx_reconSize Method
julia
ctx_reconSize() -> NTuple

Get the reconstruction size from the current MRI reconstruction context.

source
MRIReco.ctx_red3d Method
julia
ctx_red3d() -> Bool

Return true if the current reconstruction treats 3D-encoded data that was converted to 2D slices with a 3D reconSize.

source
MRIReco.ctx_storageType Method
julia
ctx_storageType() -> Type

Get the storage type from the current MRI reconstruction context.

source
MRIReco.AbstractDirectMRIRecoParameters Type
julia
AbstractDirectMRIRecoParameters <: AbstractMRIRecoParameters

Abstract type for direct (non-iterative) MRI reconstruction parameters. Performs a direct Fourier-based image reconstruction.

source
MRIReco.DirectMRIReco Type
julia
DirectMRIReco{P} <: AbstractDirectMRIRecoAlgorithm

The reconstruction type "direct": a direct image reconstruction which applies the adjoint of the encoding operator to the density-compensated k-space data.

Its parameter is a DirectMRIRecoParameter.

source
MRIReco.DirectMRIRecoParameter Type
julia
DirectMRIRecoParameter{S, C, W, arrT} <: AbstractDirectMRIRecoParameters

Parameters of the direct reconstruction DirectMRIReco.

Fields

  • reconSize::S - Size of the image to reconstruct (default: nothing, the encoding size)

  • cmap::C - Complex correction map of two-dimensional data for off-resonance and relaxation, in the precision of the data, always approximated with "nfft", which works for a map that varies within each slice and sampling times that are not all equal (default: nothing); in the parameter dictionary of reconstruction, its key is :cmap, not :correctionMap

  • weights::W - Has to stay nothing: the reconstruction then weights the data with the density compensation factors, the squares of the weights from samplingDensity

  • arrayType::Type{arrT} - Array type of the reconstruction (default: Array)

source

Iterative Reconstructions ​

MRIReco.AbstractIterativeRecoParameters Type
julia
AbstractIterativeRecoParameters <: AbstractMRIRecoParameters

Abstract base type for iterative reconstruction algorithm parameters. Subtypes must implement callable methods for use with AbstractIterativeMRIRecoContextParameter.

Required Callable Interface

Allocation

julia
(params)(algo, reconSize) -> (Ireco, indices, weights, extra...)

Allocates the output array and returns iteration indices and weights.

  • algo - The algorithm

  • reconSize::NTuple{D, Int64} - Reconstruction size

  • Returns a tuple of (Ireco, indices, weights, extra...) where:

    • Ireco::Array{Complex{T}} - Output image array

    • indices - CartesianIndices for iteration

    • weights - Sampling weights

    • extra... - Optional additional data (e.g., decorrelatedSenseMaps, L_inv for coil recon)

Loop Body

julia
(params)(algo, Ireco, index, weights, extra...)

Called once per iteration index. Writes results to Ireco.

  • algo - The algorithm

  • Ireco - Output array to write to

  • index::CartesianIndex - Current index, such as (rep, slice)

  • weights - Sampling weights from allocation

  • extra... - Optional additional data from allocation

Finalization

julia
(params)(algo, Ireco) -> result

Finalizes and returns the reconstruction result.

  • algo - The algorithm

  • Ireco::Array{Complex{T}} - The filled output array

  • Returns final result (typically AxisArray)

source
MRIReco.AbstractIterativeMRIRecoContextParameter Type
julia
AbstractIterativeMRIRecoContextParameter{P} <: AbstractMRIRecoParameters

Abstract base type for iterative reconstruction context parameters. Provides the runtime framework (context, parallelization, allocation) while the inner parameter implements the algorithm-specific loop body.

Type Parameters

  • P - The inner algorithm parameter type (e.g., AbstractStandardParameters)
source
MRIReco.SerialIterativeMRIRecoContextParameter Type
julia
SerialIterativeMRIRecoContextParameter{P, RS, AT} <: AbstractIterativeMRIRecoContextParameter{P}

Serial (non-parallel) iterative reconstruction context parameter. Uses a simple for loop for iteration.

Type Parameters

  • P - The inner algorithm parameter type

  • RS - ReconSize type (NTuple or Nothing)

  • AT - Array type

Fields

  • reconSize::RS - Reconstruction size (nothing = infer from acqData)

  • arrayType::Type{AT} - Array type for computation

  • parameter::P - Inner algorithm-specific parameter

source
MRIReco.ThreadedIterativeMRIRecoContextParameter Type
julia
ThreadedIterativeMRIRecoContextParameter{P, RS, AT, S} <: AbstractIterativeMRIRecoContextParameter{P}

Threaded iterative reconstruction context parameter using OhMyThreads. Uses @tasks for parallel execution.

Type Parameters

  • P - The inner algorithm parameter type

  • RS - ReconSize type (NTuple or Nothing)

  • AT - Array type

  • S - Scheduler type

Fields

  • reconSize::RS - Reconstruction size (nothing = infer from acqData)

  • arrayType::Type{AT} - Array type for computation

  • scheduler::S - Task scheduler (nothing = auto-based on arrayType)

  • parameter::P - Inner algorithm-specific parameter

source
MRIReco.StandardIterativeParameters Type
julia
StandardIterativeParameters{E, W, S} <: AbstractStandardParameters

Parameters of the iterative reconstruction StandardReconstruction.

Fields

  • encodingParams::E - Encoding operator parameters

  • weightingParams::W - Sampling weighting parameters

  • solverParams::S - Least squares solver parameters

Callable Interface

julia
# Allocation - allocates output array and returns iteration indices and weights
(params::StandardIterativeParameters)(algo, reconSize) -> (Ireco, indices, weights)

# Loop body - called per index with weights and output array
(params::StandardIterativeParameters)(algo, Ireco, index, weights)

# Finalization - reshapes and wraps result
(params::StandardIterativeParameters)(algo, Ireco) -> AxisArray
source
MRIReco.StandardReconstruction Type
julia
StandardReconstruction{P, C} <: AbstractIterativeMRIRecoAlgorithm

The reconstruction type "standard": an iterative image reconstruction which reconstructs the data of all coils, contrasts and slices independently.

Its parameter is an AbstractIterativeMRIRecoContextParameter that holds StandardIterativeParameters; its stored plan uses a ThreadedIterativeMRIRecoContextParameter.

source
MRIReco.MultiEchoIterativeParameters Type
julia
MultiEchoIterativeParameters{E, W, S} <: AbstractMultiEchoParameters

Parameters of the iterative reconstruction MultiEchoReconstruction.

Fields

  • encodingParams::E - Encoding operator parameters

  • weightingParams::W - Sampling weighting parameters

  • solverParams::S - Least squares solver parameters

Callable Interface

julia
# Allocation - allocates output array and returns iteration indices and weights
(params::MultiEchoIterativeParameters)(algo, reconSize) -> (Ireco, indices, weights)

# Loop body - called per index with weights and output array
(params::MultiEchoIterativeParameters)(algo, Ireco, index, weights)

# Finalization - reshapes and wraps result
(params::MultiEchoIterativeParameters)(algo, Ireco) -> AxisArray
source
MRIReco.MultiEchoReconstruction Type
julia
MultiEchoReconstruction{P, C} <: AbstractIterativeMRIRecoAlgorithm

The reconstruction type "multiEcho": an iterative image reconstruction which reconstructs all contrasts jointly. Different slices and coil images are reconstructed independently. For more than one contrast, with ADMM, the default solver, or with SplitBregman, give every regularization term a transform, also the default term used without :reg; "nothing" is the identity, for example :sparseTrafo => "nothing" for one term or :sparseTrafo => ["nothing", "nothing"] for two.

Its parameter is an AbstractIterativeMRIRecoContextParameter that holds MultiEchoIterativeParameters; its stored plan uses a ThreadedIterativeMRIRecoContextParameter.

source
MRIReco.MultiCoilIterativeParameters Type
julia
MultiCoilIterativeParameters{E, W, S, C} <: AbstractMultiCoilParameters

Parameters of the SENSE-type iterative reconstructions MultiCoilReconstruction, MultiCoilMultiEchoReconstruction and MultiCoilMultiEchoSubspaceReconstruction.

Fields

  • encodingParams::E - Encoding operator parameters

  • weightingParams::W - Sampling weighting parameters

  • solverParams::S - Least squares solver parameters

  • coilParams::C - Coil sensitivity and noise decorrelation parameters

Callable Interface

julia
# Allocation - allocates output array and returns iteration indices, weights, and coil data
(params::MultiCoilIterativeParameters)(algo, reconSize) -> (Ireco, indices, weights, decorrelatedSenseMaps, L_inv)

# Loop body - called per index with weights and output array
(params::MultiCoilIterativeParameters)(algo, Ireco, index, weights, decorrelatedSenseMaps, L_inv)

# Finalization - reshapes and wraps result
(params::MultiCoilIterativeParameters)(algo, Ireco) -> AxisArray
source
MRIReco.MultiCoilReconstruction Type
julia
MultiCoilReconstruction{P, C} <: AbstractIterativeMRIRecoAlgorithm

The reconstruction type "multiCoil": a SENSE-type iterative image reconstruction. Different slices and contrasts are reconstructed independently.

Its parameter is an AbstractIterativeMRIRecoContextParameter that holds MultiCoilIterativeParameters; its stored plan uses a ThreadedIterativeMRIRecoContextParameter.

source
MRIReco.MultiCoilMultiEchoReconstruction Type
julia
MultiCoilMultiEchoReconstruction{P, C} <: AbstractIterativeMRIRecoAlgorithm

The reconstruction type "multiCoilMultiEcho": a SENSE-type iterative image reconstruction which reconstructs all contrasts jointly. Different slices are reconstructed independently. For more than one contrast, with ADMM, the default solver, or with SplitBregman, give every regularization term a transform, also the default term used without :reg; "nothing" is the identity, for example :sparseTrafo => "nothing" for one term or :sparseTrafo => ["nothing", "nothing"] for two.

Its parameter is an AbstractIterativeMRIRecoContextParameter that holds MultiCoilIterativeParameters; its stored plan uses a ThreadedIterativeMRIRecoContextParameter.

source
MRIReco.AbstractSubspaceParameters Type
julia
AbstractSubspaceParameters <: AbstractIterativeRecoParameters

Abstract type for subspace-based reconstruction parameters. Subspace methods reconstruct images in a lower-dimensional subspace basis.

source
MRIReco.MultiCoilMultiEchoSubspaceReconstruction Type
julia
MultiCoilMultiEchoSubspaceReconstruction{P, C} <: AbstractIterativeMRIRecoAlgorithm

The reconstruction type "multiCoilMultiEchoSubspace": a SENSE-type iterative image reconstruction which reconstructs all contrasts jointly using a subspace basis. Its result holds one coefficient map per basis function. Different slices are reconstructed independently. For more than one basis function, with ADMM, the default solver, or with SplitBregman, give every regularization term a transform, also the default term used without :reg; "nothing" is the identity, for example :sparseTrafo => "nothing" for one term or :sparseTrafo => ["nothing", "nothing"] for two.

Its parameter is an AbstractIterativeMRIRecoContextParameter that holds MultiCoilIterativeParameters, whose field encodingParams has to be a SubspaceEncodingParameters with the basis; its stored plan uses a ThreadedIterativeMRIRecoContextParameter.

source

Parameters ​

MRIReco.AbstractMRIRecoEncodingParameters Type
julia
AbstractMRIRecoEncodingParameters <: AbstractMRIRecoParameters

Abstract base type for encoding operator parameters used in MRI reconstruction.

source
MRIReco.CustomEncodingParameters Type
julia
CustomEncodingParameters{E} <: AbstractMRIRecoEncodingParameters

Parameters with user-provided encoding operators.

Type Parameters

  • E - The type of the encoding operators

Fields

  • encodingOps::E - Pre-computed encoding operators of "standard" and "multiCoil" as a matrix with one row per contrast and one column per slice. For "multiCoil", the operators include the coil sensitivities, like those of encodingOps_parallel, and the reconstruction still needs its CoilParameters; with noiseData, it decorrelates the data but not these operators.

Callable Interface

julia
(ep::CustomEncodingParameters)(algo, slice::Int, args...)

Returns

  • The encoding operators for the given slice, encodingOps[:, slice]

Example

julia
ep = CustomEncodingParameters(; encodingOps=myEncodingOps)
source
MRIReco.EncodingParameters Type
julia
EncodingParameters{C} <: AbstractMRIRecoEncodingParameters

Parameters for computing encoding operators from acquisition data.

Type Parameters

  • C - Type of correctionMap, an AbstractArray{<:Complex} or Nothing

Fields

All fields are nothing by default, and the operator then uses its own default given below.

  • correctionMap::C - Complex correction map z of two-dimensional data for off-resonance and relaxation, in the precision of the data, see Correct Off-Resonance (default: none)

  • method::Union{String, Nothing} - Approximation of exp(-z t), where t is the sampling time, for a map that varies within each slice 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 double-precision data, a map with a spatially varying off-resonance part and profiles with the same sampling times and about ten or more samples per term (default: "nfft"), see FieldmapNFFTOp

  • toeplitz::Union{Bool, Nothing} - Whether the normal operator uses the Toeplitz approach (default: false)

  • oversamplingFactor::Union{Float64, Nothing} - NFFT oversampling factor (default: 1.25)

  • kernelSize::Union{Int, Nothing} - NFFT kernel size (default: 3)

  • K::Union{Int, Nothing} - Number of terms of "leastsquare" and "hist" and maximum number of terms of "svd" (default: 20); "nfft" determines the number itself

  • K_tol::Union{Float64, Nothing} - Tolerance with which "svd" chooses the number of terms (default: 1e-3)

method, K and K_tol only take effect with a correction map, and toeplitz, oversamplingFactor and kernelSize only for non-Cartesian data without a correction map.

Callable Interface

julia
(ep::EncodingParameters)(algo, slice::Int)
(ep::EncodingParameters)(algo, slice::Int, senseMaps)

Returns

  • The encoding operators of the given slice: one per contrast for the reconstructions that treat the contrasts separately, and otherwise one for all contrasts. The second form, used by the reconstructions with coil sensitivities, includes the sensitivities.

Note

  • Gets the data, the reconstruction size and the storage type from the MRIRecoContext of the reconstruction

Example

julia
ep = EncodingParameters()

# With a correction map
ep = EncodingParameters(; correctionMap = cmap, method = "leastsquare", K = 10)
source
MRIReco.SubspaceEncodingParameters Type
julia
SubspaceEncodingParameters{E, B} <: AbstractMRIRecoEncodingParameters

Encoding parameters with subspace projection for dimensionality reduction.

Type Parameters

  • E - The inner encoding parameters type

  • B - The basis matrix type

Fields

  • inner::E - Inner encoding parameters

  • basis::B - Subspace basis matrix with one row per contrast and one column per basis function, in the precision of the data

Callable Interface

julia
(ep::SubspaceEncodingParameters)(algo, slice::Int, args...)

Returns

  • Encoding operator of inner composed with a SubspaceOp of the basis

Example

julia
ep = SubspaceEncodingParameters(; inner=EncodingParameters(), basis=basisMatrix)
source
MRIReco.AbstractMRIRecoWeightingParameters Type
julia
AbstractMRIRecoWeightingParameters <: AbstractMRIRecoParameters

Abstract base type for weighting parameters used in MRI reconstruction. Subtypes define how weights are computed for the reconstruction. The iterative reconstructions multiply the encoding operator and the data by them, so they take the place of the square roots of the density compensation factors.

Required Callable Interface

julia
(wp::AbstractMRIRecoWeightingParameters)(::Type{<:AbstractMRIRecoAlgorithm})

A subtype must implement this method for Type{<:AbstractMRIRecoAlgorithm}. ctx_acqData and ctx_reconSize give it the data and the image size of the running reconstruction.

Returns

  • Vector{S} with S = ctx_storageType() - One weight vector per contrast with one weight per sample, the same for all coils, complex and in the precision of the data, in the form that samplingDensity returns
source
MRIReco.CustomWeightingParameters Type
julia
CustomWeightingParameters{W} <: AbstractMRIRecoWeightingParameters

Weighting parameters that use user-provided custom weights.

Type Parameters

  • W - The type of the weights (typically Vector{Vector{Complex{<:AbstractFloat}}})

Fields

  • weights::W - User-provided weights

Description

Allows explicit specification of weighting vectors for data with one coil: a vector of vectors, one per contrast, in the form that samplingDensity returns.

Callable Interface

julia
(wp::CustomWeightingParameters)(::Type{<:AbstractMRIRecoAlgorithm})

Returns

  • The stored weights vector

Validation

Weights are validated during reconstruction to ensure they match the acquisition data structure (same number of contrasts and samples).

Example

julia
weights = [[1.0+0im, 2.0+0im], [3.0+0im, 4.0+0im]]
wp = CustomWeightingParameters(; weights=weights)
source
MRIReco.DensityWeightingParameters Type
julia
DensityWeightingParameters <: AbstractMRIRecoWeightingParameters

Weighting parameters that compute density compensation weights from the acquisition data.

Description

Uses the trajectory information in the acquisition data to compute appropriate density compensation weights. This is the default weighting scheme for most reconstructions.

Callable Interface

julia
(wp::DensityWeightingParameters)(::Type{<:AbstractMRIRecoAlgorithm})

Returns

  • Vector{Vector{Complex{T}}} - One weight vector per contrast, from samplingDensity
source
MRIReco.UniformWeightingParameters Type
julia
UniformWeightingParameters <: AbstractMRIRecoWeightingParameters

Weighting parameters that use uniform weights for all k-space samples.

Description

For data with one coil, assigns uniform weight 1/sqrt(prod(reconSize)) to each k-space sample.

Callable Interface

julia
(wp::UniformWeightingParameters)(::Type{<:AbstractMRIRecoAlgorithm})

Returns

  • Vector{Vector{Complex{T}}} - One weight vector per contrast
source
MRIReco.CoilParameters Type
julia
CoilParameters{T, S, N} <: AbstractCoilParameters
CoilParameters(; senseMaps = nothing, noiseData = nothing)

Coil sensitivities and noise data of the SENSE-type reconstructions "multiCoil", "multiCoilMultiEcho" and "multiCoilMultiEchoSubspace", as complex arrays in the precision of the data. The constructor needs at least one of the two, and the reconstructions with EncodingParameters need senseMaps.

Fields

  • senseMaps::S - Coil sensitivities with the dimensions x, y, z or slice, and coil, as espirit returns them when called on an AcquisitionData with nmaps = 1, see Estimate Coil Sensitivities with ESPIRiT

  • noiseData::N - Noise samples as a matrix of samples × coils; if given, the k-space data and the coil sensitivities are decorrelated, see Noise Decorrelation

source
MRIReco.CustomSparsityParameters Type
julia
CustomSparsityParameters{L} <: AbstractSparsityParameters

Parameters specifying custom sparsifying transforms, see Use a Custom Sparsifying Transform.

Fields

  • sparseTrafo::L - The transform of the first regularization term (an AbstractLinearOperator such as LinearOperator(M) for a matrix M, or a name as for SimpleSparsityParameters) or a vector with one entry per term (default: nothing). With nothing or a missing entry, a term has no transform.

Examples

julia
CustomSparsityParameters(op)                # op for the first term
CustomSparsityParameters([op, nothing])     # op for the first term, none for the second
CustomSparsityParameters()                  # no transform
source
MRIReco.CustomSparsityParameters Method
julia
(sparsity::CustomSparsityParameters)(algo, numTerms::Int64) -> Vector

Build the transforms of numTerms regularization terms: the given operators, a SparseOp for each name and nothing for each term without a transform. Reconstructions that solve for all contrasts or basis functions at once repeat each transform for every contrast or basis function, so an operator has to act on a single image.

Note

  • Gets the reconstruction size and the storage type from the MRIRecoContext of the reconstruction
source
MRIReco.LeastSquaresSolverParameter Type
julia
LeastSquaresSolverParameter{SL, R, T} <: SolverParameters

Parametric solver parameters for iterative MRI reconstruction using RegularizedLeastSquares.

Type Parameters

  • SL - Solver type: ADMM, CGNR, FISTA, POGM, OptISTA or SplitBregman

  • R - RegularizationParameters type

  • T - Floating-point type of rho and the tolerances

Fields

Except for solver and regParams, a field is passed to the solver as the keyword argument of the same name, but only if it is not nothing and the solver takes that keyword; otherwise the solver uses its own default.

  • solver::Type{SL} - Solver type (default: ADMM)

  • regParams::R - Regularization terms and their transforms (default: RegularizationParameters())

  • normalizeReg::AbstractRegularizationNormalization - Scaling of the weights λ of the terms: NoNormalization(), MeasurementBasedNormalization() or SystemMatrixBasedNormalization() (default: NoNormalization())

  • iterations::Int - Maximum iterations; for SplitBregman, the outer iterations (default: 30)

  • rho::T - Penalty parameter of ADMM and SplitBregman and step size of FISTA, POGM and OptISTA (default: 5e-2). FISTA, POGM and OptISTA always receive it, so they do not determine the step size themselves.

  • iterationsInner::Union{Int, Nothing} - Inner iterations of SplitBregman (default: nothing)

  • iterationsCG::Union{Int, Nothing} - CG iterations of ADMM and SplitBregman (default: nothing)

  • absTol::Union{T, Nothing} - Absolute tolerance of ADMM and SplitBregman (default: nothing)

  • relTol::Union{T, Nothing} - Relative tolerance (default: nothing)

  • tolInner::Union{T, Nothing} - Tolerance of the CG iterations of ADMM and SplitBregman (default: nothing)

  • verbose::Bool - Print progress in all solvers except CGNR (default: false)

  • restart::Symbol - Restart of FISTA and POGM: :none or :gradient (default: :none)

  • vary_rho::Symbol - Adaptation of rho in ADMM: :none, :balance or :PnP (default: :none)

Examples

julia
# With L1 + Wavelet regularization
params = LeastSquaresSolverParameter(solver = FISTA,
  regParams = RegularizationParameters(
    reg = L1Regularization(1e-3),
    sparsityParams = SimpleSparsityParameters("Wavelet")
  ),
  iterations = 100
)

# Multiple regularization terms (ADMM)
params = LeastSquaresSolverParameter(solver = ADMM,
  regParams = RegularizationParameters(
    reg = [L1Regularization(1e-3), L2Regularization(1e-4)],
    sparsityParams = SimpleSparsityParameters(["Wavelet", "nothing"])
  ),
  rho = 1e-1
)
source
MRIReco.LeastSquaresSolverParameter Method
julia
(params::LeastSquaresSolverParameter)(algo, b::AbstractVector, A, AHA=normalOperator(A))

Solve an inverse problem using the configured solver.

Arguments

  • algo::AbstractIterativeMRIRecoAlgorithm - The reconstruction algorithm

  • b::AbstractVector - k-space data

  • A - Forward operator

  • AHA - Normal operator (optional, computed from A if not provided)

Returns

Reconstructed image vector

Note

  • Gets the reconstruction size and the storage type from the MRIRecoContext of the reconstruction
source
MRIReco.LeastSquaresSolverParameter Method
julia
(params::LeastSquaresSolverParameter)(algo, A, AHA=normalOperator(A))

Create a configured solver for the given problem.

Arguments

  • algo::AbstractIterativeMRIRecoAlgorithm - The reconstruction algorithm

  • A - Forward operator

  • AHA - Normal operator (optional, computed from A if not provided)

Returns

A configured AbstractLinearSolver ready for use with solve!

Note

  • Gets the reconstruction size and the storage type from the MRIRecoContext of the reconstruction
source
MRIReco.RegularizationParameters Type
julia
RegularizationParameters{R, S} <: AbstractImageReconstructionParameters

Parameters specifying regularization terms and their sparsity transforms.

Type Parameters

  • R - Regularization type (nothing, AbstractRegularization, or Vector)

  • S - Sparsity parameters type

Fields

  • reg::R - Regularization term(s). Can be nothing, a single term, or a vector (default: nothing). nothing stands for L1Regularization(0.0), which does not regularize and which CGNR does not accept.

  • sparsityParams::S - Sparsifying transforms of the terms, see SimpleSparsityParameters and CustomSparsityParameters (default: SimpleSparsityParameters()).

Examples

julia
# L1 with wavelet
RegularizationParameters(reg = L1Regularization(1e-3),
                         sparsityParams = SimpleSparsityParameters("Wavelet"))

# Multiple terms
RegularizationParameters(reg = [L1Regularization(1e-3), L2Regularization(1e-4)],
                         sparsityParams = SimpleSparsityParameters(["Wavelet", "nothing"]))
source
MRIReco.RegularizationParameters Method
julia
(params::RegularizationParameters)(algo, solver::Type{<:AbstractLinearSolver})

Transform the regularization parameters for a specific solver type. ADMM and SplitBregman take several terms; FISTA, POGM and OptISTA take one term; CGNR takes one L2Regularization and ignores its transform. FISTA, POGM, OptISTA and CGNR also take the projections PositiveRegularization and RealRegularization.

Arguments

  • algo::AbstractIterativeMRIRecoAlgorithm - The reconstruction algorithm

  • solver::Type{<:AbstractLinearSolver} - The solver type (for example ADMM or FISTA)

Returns

  • For ADMM and SplitBregman, which take the transforms separately: the tuple (reg, regTrafo) with one transform per term, the identity of one image for a term without a transform

  • For the other solvers: the vector of terms, each term with a transform as a TransformedRegularization

Note

  • Gets the reconstruction size and the storage type from the MRIRecoContext of the reconstruction
source
MRIReco.SimpleSparsityParameters Type
julia
SimpleSparsityParameters{S} <: AbstractSparsityParameters

Parameters specifying sparsifying transforms by name, see SparseOp.

Fields

  • sparseTrafo::S - The transform of the first regularization term ("Wavelet", or "nothing" for the identity) or a vector with one entry per term. With "" (the default) or nothing, no term has a transform; in a vector, nothing or a missing entry leaves that term without one. A term without a transform applies to the image itself.

Examples

julia
SimpleSparsityParameters("Wavelet")               # Wavelet for the first term
SimpleSparsityParameters(["Wavelet", "nothing"])  # one transform per term
SimpleSparsityParameters()                        # no transform
source
MRIReco.SimpleSparsityParameters Method
julia
(sparsity::SimpleSparsityParameters)(algo, numTerms::Int64) -> Vector

Build the transforms of numTerms regularization terms: a SparseOp for each name and nothing for each term without a transform. Reconstructions that solve for all contrasts or basis functions at once repeat each transform for every contrast or basis function.

Note

  • Gets the reconstruction size and the storage type from the MRIRecoContext of the reconstruction
source
MRIReco.SolverParameters Type
julia
SolverParameters <: AbstractMRIRecoParameters

Abstract base type for solver parameters in MRIReco. Subtypes define how linear solvers are configured for iterative reconstruction.

source

Deprecated Reconstruction Functions ​

Before reconstruction plans, reconstruction called one of the following functions. They are deprecated.

MRIReco.reconstruction_simple Function

Performs iterative image reconstruction independently for the data of all coils, contrasts and slices

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • reconSize::NTuple{2,Int64} - size of image to reconstruct

  • reg::Vector{<:AbstractRegularization} - Regularization to be used

  • sparseTrafo::AbstractLinearOperator - sparsifying transformation

  • weights::Vector{Vector{Complex{<:AbstractFloat}}} - sampling density of the trajectories in acqData

  • solver::Type{<:AbstractLinearSolver} - name of the solver to use

  • arrayType - array type to use for the reconstruction, defaults to Array (CPU execution)

  • scheduler - (OhMyThreads) scheduler to use during reconstruction, defaults to dynamic/parallel on CPU, sequential/serial on GPU

  • (normalize::Bool=false) - adjust regularization parameter according to the size of k-space data

  • (params::Dict{Symbol,Any}) - Dict with additional parameters

source
MRIReco.reconstruction_multiEcho Function

Performs a iterative image reconstruction jointly for all contrasts. Different slices and coil images are reconstructed independently.

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • reconSize::NTuple{2,Int64} - size of image to reconstruct

  • reg::Vector{<:AbstractRegularization} - Regularization to be used

  • sparseTrafo::AbstractLinearOperator - sparsifying transformation

  • weights::Vector{Vector{Complex{<:AbstractFloat}}} - sampling density of the trajectories in acqData

  • solver::Type{<:AbstractLinearSolver} - name of the solver to use

  • arrayType - array type to use for the reconstruction, defaults to Array (CPU execution)

  • scheduler - (OhMyThreads) scheduler to use during reconstruction, defaults to dynamic/parallel on CPU, sequential/serial on GPU

  • (normalize::Bool=false) - adjust regularization parameter according to the size of k-space data

  • (params::Dict{Symbol,Any}) - Dict with additional parameters

source
MRIReco.reconstruction_multiCoil Function

Performs a SENSE-type iterative image reconstruction. Different slices and contrasts images are reconstructed independently.

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • reconSize::NTuple{2,Int64} - size of image to reconstruct

  • reg::Vector{<:AbstractRegularization} - Regularization to be used

  • sparseTrafo::AbstractLinearOperator - sparsifying transformation

  • weights::Vector{Vector{Complex{<:AbstractFloat}}} - sampling density of the trajectories in acqData

  • L_inv::Array{Complex{<:AbstractFloat}} - noise decorrelation matrix

  • solver::Type{<:AbstractLinearSolver} - name of the solver to use

  • senseMaps::AbstractArray{Complex{<:AbstractFloat}} - coil sensitivities

  • arrayType - array type to use for the reconstruction, defaults to Array (CPU execution)

  • scheduler - (OhMyThreads) scheduler to use during reconstruction, defaults to dynamic/parallel on CPU, sequential/serial on GPU

  • (normalize::Bool=false) - adjust regularization parameter according to the size of k-space data

  • (params::Dict{Symbol,Any}) - Dict with additional parameters

source
MRIReco.reconstruction_multiCoilMultiEcho Function

Performs a SENSE-type iterative image reconstruction which reconstructs all contrasts jointly. Different slices are reconstructed independently.

Arguments

  • acqData::AcquisitionData - AcquisitionData object

  • reconSize::NTuple{2,Int64} - size of image to reconstruct

  • reg::Vector{<:AbstractRegularization} - Regularization to be used

  • sparseTrafo::AbstractLinearOperator - sparsifying transformation

  • weights::Vector{Vector{Complex{<:AbstractFloat}}} - sampling density of the trajectories in acqData

  • solver::Type{<:AbstractLinearSolver} - name of the solver to use

  • senseMaps::AbstractArray{Complex{<:AbstractFloat}} - coil sensitivities

  • arrayType - array type to use for the reconstruction, defaults to Array (CPU execution)

  • scheduler - (OhMyThreads) scheduler to use during reconstruction, defaults to dynamic/parallel on CPU, sequential/serial on GPU

  • (normalize::Bool=false) - adjust regularization parameter according to the size of k-space data

  • (params::Dict{Symbol,Any}) - Dict with additional parameters

source

Tools ​

MRIReco.remove_oversampling Method
julia
raw = remove_oversampling(rawData::RawAcquisitionData)
remove_oversampling!(rawData::RawAcquisitionData)

Removes oversampling from the profiles in a RawAcquisitionData object by creating a deep copy of the input data and applying the remove_oversampling! function.

Arguments

  • rawData::RawAcquisitionData: The RawAcquisitionData object to process.

Returns

  • RawAcquisitionData: A new RawAcquisitionData object with oversampling removed.

Examples

julia
# Assuming `rawData` is a RawAcquisitionData object
processedData = remove_oversampling(rawData)
source
MRIReco.regrid Method
julia
`regrid(acqData::AcquisitionData{T}, kspaceSize::NTuple{2,Int64}
          ; cgnr_iter::Int64=3, correctionMap::Array{Complex{T}}=Complex{T}[]) where (D,T)`

Regrid non-cartesian k-space data in acqData to a cartesian grid of size kspaceSize. Uses the CGNR method to invert the non-cartesian Fourier encoding.

Arguments:

  • acqData::AcquisitionData{T} - AcquisitionData

  • ksize::NTuple{2,Int64} - size of the cartesian k-space grid

  • cgnr_iter::Int64=3 - number of CGNR iterations

  • correctionMao::Array{Complex{T}}- relaxation/b0 map

source
MRIReco.applySubspace Method
julia
applySubspace(I, basis)

computes the echo images from the coefficient maps I of the reconstruction type "multiCoilMultiEchoSubspace", by multiplying the dimension of the coefficient maps with basis'.

I has the dimensions x, y, z, coefficient maps, coils and repetitions. basis is the matrix passed as :basis, with one row per echo and one column per coefficient map, and has the element type of I. The result has the dimensions of I, with the echoes instead of the coefficient maps.

source
MRIReco.nrmsd Method
julia
nrmsd(I,Ireco)

computes the normalized root mean squared error of the image Ireco with respect to the image I.

source
MRIReco.optimalScalingFactor Method
julia
optimalScalingFactor(I,Ireco)

computes the optimal scaling factor α such that || I - α Ireco ||₂ is minimal

source
MRIReco.covariance Method
julia
covariance(noiseData)

computes the covariance matrix of the coils from the noise samples noiseData, an array of size (samples, coils), as noiseData' * noiseData / (N - 1) for N samples.

source
MRIReco.decorrelateSenseMaps Method
julia
decorrelateSenseMaps(L_inv, senseMaps, numChan)

multiplies the coil sensitivities senseMaps, an array of size (x, y, z, coils) with numChan coils, by L_inv' from the right along the coil dimension, reshape(senseMaps, :, numChan) * L_inv', which decorrelates them in the same way as the data. L_inv is the inverse of the lower Cholesky factor of the matrix that covariance returns. If L_inv is nothing, senseMaps is returned unchanged.

source