API
In the following, you find the documentation of all exported functions of the MRISubspaceRecon.jl package:
MRISubspaceRecon.FFTNormalOpMRISubspaceRecon.NFFTNormalOpMRISubspaceRecon.calculate_backprojectionMRISubspaceRecon.calculate_coil_mapsMRISubspaceRecon.calculate_golden_meansMRISubspaceRecon.grog_calibMRISubspaceRecon.grog_gridding!MRISubspaceRecon.radial_grog!MRISubspaceRecon.traj_2d_radial_goldenratioMRISubspaceRecon.traj_cartesianMRISubspaceRecon.traj_kooshballMRISubspaceRecon.traj_kooshball_goldenratio
MRISubspaceRecon.FFTNormalOp — Method
FFTNormalOp(img_shape, trj, U; cmaps)
FFTNormalOp(M, U; cmaps)
FFTNormalOp(Λ; cmaps, eltype_x)Create normal operator of FFT operator. Differentiate between functions exploiting a pre-calculated kernel basis Λ and the functions which calculate Λ based on a passed trajectory trj or mask M.
Arguments
img_shape::Tuple{Int}: Image dimensionstraj::Vector{Matrix}: TrajectoryU::Matrix: Basis coefficients of subspacecmaps::Matrix=(1,): Coil sensitivitiessample_mask::AbstractArray{Bool}=trues(size(trj)[2:end]): Mask indicating which acquired k-space samples are included in the reconstructionM::Vector{Matrix}: Mask specific toFFTNormalOp(M, U; cmaps)method. Here,Mrepresents a Cartesian binary mask that indicates in every time frame which phase-encoding lines were acquired. This means, for example,Mis sized(Nx, Ny, Nt)for a 2D image. Explicit use of a trajectory withFFTNormalOp(img_shape, trj, U; cmaps)is generally recommended.Λ::Array{Complex{T},3}: Toeplitz kernel basis resulting from internalcalculate_kernel_cartesianmethod.num_fft_threads::Int=round(Int, Threads.nthreads()/size(U, 2))or `round(Int, Threads.nthreads()/size(Λ, 1)): Number of Threads for FFTeltype_x=eltype(Λ)define the type ofx(in the productFFTNormalOp(Λ) * x). The default is the same eltype asΛ
References
- Tamir JI, et al. “T2 shuffling: Sharp, multicontrast, volumetric fast spin-echo imaging”. Magn Reson Med. 77.1 (2017), pp. 180–195. https://doi.org/10.1002/mrm.26102
- Assländer J, et al. “Low rank alternating direction method of multipliers reconstruction for MR fingerprinting”. Magn Reson Med 79.1 (2018), pp. 83–96. https://doi.org/10.1002/mrm.26639
MRISubspaceRecon.NFFTNormalOp — Method
NFFTNormalOp(img_shape, trj, U; cmaps, sample_mask, verbose, num_fft_threads)
NFFTNormalOp(img_shape, Λ, kmask_indcs; cmaps)Create normal operator of NFFT operator. Differentiate between functions exploiting a pre-calculated Toeplitz kernel basis Λ and the function which calculates Λ based on a passed trajectory trj. When the basis functions U are real-valued, a real-only NUFFT is used to compute Λ, reducing the data volume and computation time for the spreading and interpolation steps by half.
Arguments
img_shape::Tuple{Int}: Image dimensionstrj::AbstractArray: Trajectory, useCuArrayas input type to use CUDA code.U::AbstractMatrix: Basis coefficients of subspacecmaps::AbstractVector{Matrix}=(1,): Coil sensitivities, useAbstractVector{CuArray}as type for use with CUDA code.sample_mask::AbstractArray{Bool} = trues(size(trj)[2:end]): Mask indicating which acquired k-space samples are included in the reconstructionverbose::Boolean=false: Verbose levelnum_fft_threads::Int=round(Int, Threads.nthreads()/size(U, 2))orround(Int, Threads.nthreads()/size(Λ, 1)): Number of threads for FFTΛ: Toeplitz kernel basis resulting from internalcalculate_kernel_noncartesianmethod. Using a real basisUreduces its size by a factor of 2.
References
- Wajer FTAW, and Pruessmann, KP. “Major Speedup of Reconstruction for Sensitivity Encoding with Arbitrary Trajectories”. In: Proc. Intl. Soc. Mag. Reson. Med 9 (2001).
- Fessler JA, et al. "Toeplitz-Based Iterative Image Reconstruction for MRI With Correction for Magnetic Field Inhomogeneity". IEEE Trans. Signal Process., 53.9 (2006).
- Mani M, et al. “Fast iterative algorithm for the reconstruction of multishot non-cartesian diffusion data”. Magn Reson Med. 74.4 (2015), pp. 1086–1094. https://doi.org/10.1002/mrm.25486
- Uecker M, Zhang S, and Frahm J. “Nonlinear inverse reconstruction for real-time MRI of the human heart using undersampled radial FLASH". Magn Res Med. 63 (2010), pp. 1456–1462. https://doi.org/10.1002/mrm.22453
MRISubspaceRecon.calculate_backprojection — Method
calculate_backprojection(data, trj, img_shape; U, sample_mask, density_compensation, verbose)
calculate_backprojection(data, trj, cmaps::AbstractVector{<:AbstractArray{Tc,N}}; U, sample_mask, density_compensation, verbose)
calculate_backprojection(data, trj, img_shape; U, sample_mask, density_compensation, verbose)
calculate_backprojection(data, trj, cmaps; U, sample_mask)Calculate (filtered) backprojection.
Arguments
data <: AbstractArray{Complex}: Complex dataset with axes (samples, time frames, channels). Time frames are reconstructed using the subspace defined in U. UseCuArrayas input type to use CUDA GPU code.trj <: AbstractArray: Trajectory with sample coordinates corresponding to the dataset. For a Cartesian reconstruction, useT <: Intand definetrj[idim,it,ik] ∈ (1, img_shape[idim]). IfT <: Float, the NFFT is used. UseCuArrayas input type to use CUDA code.
One of the following arguments needs to be supplied
img_shape::NTuple{N,Int}: Shape of output image; in this case, the data is reconstructed per coil.cmaps::AbstractVector{<:AbstractArray{Tc}}: Coil sensitivities; when provided, the coils are combined into an array with no coil axis. UseAbstractVector{CuArray{Tc,N}}as type for use with CUDA code.
Optional Keyword Arguments
U::Matrix=I(size(trj)[end])or=I(1): Basis coefficients of subspace (only defined if data and trj have different timeframes)sample_mask::AbstractArray{Bool}=trues(size(trj)[2:end]): Mask indicating which acquired k-space samples are included in the reconstructiondensity_compensation=:none: Values of:radial_3D,:radial_2D,:none, or of typeAbstractVector{<:AbstractVector}verbose::Boolean=false: Verbosity level
MRISubspaceRecon.calculate_coil_maps — Method
calculate_coil_maps(data, trj, img_shape; U, density_compensation, kernel_size, calib_size, eigThresh_1, eigThresh_2, nmaps, verbose)Estimate coil sensitivity maps using ESPIRiT [1].
Arguments
data::AbstractArray: Complex dataset with axes (samples, time frames, channels). Time frames are reconstructed using the subspace defined in U. UseCuArrayas input type to use CUDA code.trj::AbstractArray: Trajectory with sample coordinates corresponding to the dataset UseCuArrayas input type to use GPU code.img_shape::NTuple{N,Int}: Shape of output image
Keyword Arguments
U::Matrix=ones(size(trj)[end]):I(1): Basis coefficients of subspacesample_mask::AbstractArray{Bool}=trues(size(trj)[2:end]): Mask indicating which acquired k-space samples are included in the reconstructiondensity_compensation=:radial_3D: Values of:radial_3D,:radial_2D,:none, or of typeAbstractArraykernel_size=ntuple(_ -> 6, N): Kernel sizecalib_size=ntuple(_ -> 24, N): Size of calibration regioneigThresh_1=0.01: Threshold of first eigenvalueeigThresh_2=0.9: Threshold of second eigenvaluenmaps=1: Number of estimated mapsNiter_cg: Number of CG iterations used for the reconstruction. The default is 100 and 5 for non-Cartesian and Cartesian trajectories, respectively. Using a number of iterations too large for a given dataset can introduce errors.verbose::Boolean=false: Verbosity level
Return
cmaps::Vector{Array}: Coil sensitivities asVectorof arrays
References
- Uecker M, Lai P, Murphy MJ, Virtue P, Elad M, Pauly JM, Vasanawala SS, and Lustig M. "ESPIRiT—an eigenvalue approach to autocalibrating parallel MRI: Where SENSE meets GRAPPA". Magn. Reson. Med. 71 (2014), pp. 990-1001. https://doi.org/10.1002/mrm.24751
MRISubspaceRecon.calculate_golden_means — Method
calculate_golden_means()Function to calculate the 3D golden means [1].
References
- Chan RW, Ramsay EA, Cunningham CH, and Plewes DB. "Temporal stability of adaptive 3D radial MRI using multidimensional golden means". Magn. Reson. Med. (2009), 61: 354-363. https://doi.org/10.1002/mrm.21837
MRISubspaceRecon.grog_calib — Method
grog_calib(data, trj, Nr)Perform GROG kernel calibration based on the radial trajectory and acquired k-space data [1].
Arguments
data::AbstractAbstractArray: Complex dataset with dimensions (samples per time frame [Nr], time frames, Rx channels)trj::AbstractArray: Trajectory with samples corresponding to the dataset, passed as AbstractArray with dimension (dims, samples per time frame, time frames)Nr::Int: Number of samples per readout
References
- Seiberlich N, Breuer F, Blaimer M, Jakob P, and Griswold M. "Self-calibrating GRAPPA operator gridding for radial and spiral trajectories". Magn. Reson. Med. 59 (2008), pp. 930-935. https://doi.org/10.1002/mrm.21565
MRISubspaceRecon.grog_gridding! — Method
grog_gridding!(data, trj, lnG, Nr, img_shape)Perform gridding of data based on pre-calculated GROG kernel.
Arguments
data::AbstractVector{<:AbstractMatrix}: Complex dataset passed as AbstractVector of matricestrj::AbstractArray}: Trajectory with samples corresponding to the dataset passed as AbstractVector of matrices with Float32 entrieslnG::AbstractArray{Matrix}: Natural logarithm of GROG kernel in all dimensionsNr::Int: Number of samples per read outimg_shape::Tuple{<:Integer}: Image dimensions
Output
trj::AbstractArray{<:Integer}: Cartesian trajectory with the elementstrj[idim,ik,it] ∈ (1, img_shape[idim])
Dimensions:
data: (samples, timesteps, coils, repetitions of sampling pattern)trj: (dims, samples, timesteps)lnG: (dims][Ncoils, Ncoils)
MRISubspaceRecon.radial_grog! — Method
radial_grog!(data, trj, Nr, img_shape)Perform GROG kernel calibration and gridding of data in-place [1]. The trajectory is returned with integer values.
Arguments
data::AbstractArray}: Complex dataset with dimensions (samples per time frame [Nr], time frames, Rx channels)trj::AbstractArray: Trajectory with samples corresponding to the dataset, passed as AbstractArray with dimension (dims, samples per time frame, time frames)Nr::Int: Number of samples per read outimg_shape::Tuple{Int}: Image dimensions
Output
trj::AbstractArray{<:Integer}}: Cartesian trajectory with the elementstrj[idim,ik,it] ∈ (1, img_shape[idim])
References
- Seiberlich N, Breuer F, Blaimer M, Jakob P, and Griswold M. "Self-calibrating GRAPPA operator gridding for radial and spiral trajectories". Magn. Reson. Med. 59 (2008), pp. 930-935. https://doi.org/10.1002/mrm.21565
MRISubspaceRecon.traj_2d_radial_goldenratio — Method
traj_2d_radial_goldenratio(Nr, Ncyc, Nt; thetaRot, phiRot, delay, N)Function to calculate a 2D radial trajectory with golden-angle spacing between subsequent readouts [1]. The use of tiny golden angles [2] is supported by modifying N.
Arguments
Nr::Int: Number of read out samplesNcyc::Int: Number of cyclesNt::Int: Number of time steps in the trajectorythetaRot::Float= 0: Fixed rotation angle along thetaphiRot::Float= 0: Fixed rotation angle along phidelay::Tuple{Float, Float, Float}=(0, 0, 0): Gradient delays in (HF, AP, LR)N::Int= 1: Number of tiny golden angle
References
- Winkelmann S, Schaeffter T, Koehler T, Eggers H, Doessel O. "An optimal radial profile order based on the Golden Ratio for time-resolved MRI". IEEE TMI 26:68-76 (2007)
- Wundrak S, Paul J, Ulrici J, Hell E, Geibel MA, Bernhardt P, Rottbauer W, Rasche V. "Golden ratio sparse MRI using tiny golden angles". Magn. Reson. Med. 75:2372-2378 (2016)
MRISubspaceRecon.traj_cartesian — Method
traj_cartesian(T, Nx, Ny, Nz, Nt)Generate a 3D Cartesian trajectory.
Arguments
Nx::Int: Number of readout samplesNy::Int: Number of phase encoding linesNz::Int: Number of phase encoding lines (third dimension)Nt::Int: Number of time steps in the trajectory
Optional Keyword Argument
T::Type=Int: Type of output trajectory. IfT <: Float, trajectory is defined ∈ (-0.5, 0.5). IfT <: Int, trajectory consists of values ∈ (1, N) instead.
MRISubspaceRecon.traj_kooshball — Method
traj_kooshball(Nr, theta, phi; thetaRot, phiRot, delay)Function to calculate a 3D radial kooshball trajectory with custom sets of projection angles.
Arguments
Nr::Int: Number of read out samplestheta::Array{Float,2}: Array with dimensions:Ncyc, Ntdefining the anglesthetafor each cycle and time step.phi::Array{Float,2}: Array with dimensions:Ncyc, Ntdefining the anglesphifor each cycle and time step.thetaRot::Float= 0: Fixed rotation angle along thetaphiRot::Float= 0: Fixed rotation angle along phidelay::Tuple{Float, Float, Float}=(0, 0, 0): Gradient delays in (HF, AP, LR)
MRISubspaceRecon.traj_kooshball_goldenratio — Method
traj_kooshball_goldenratio(Nr, Ncyc, Nt; thetaRot, phiRot, delay)Function to calculate a 3D radial kooshball trajectory with a golden-means angular spacing of k-space readouts [1].
Arguments
Nr::Int: Number of read out samplesNcyc::Int: Number of cyclesNt::Int: Number of time steps in the trajectorythetaRot::Float= 0: Fixed rotation angle along thetaphiRot::Float= 0: Fixed rotation angle along phidelay::Tuple{Float, Float, Float}=(0, 0, 0): Gradient delays in (HF, AP, LR)
References
- Chan RW, Ramsay EA, Cunningham CH, and Plewes DB. "Temporal stability of adaptive 3D radial MRI using multidimensional golden means". Magn. Reson. Med. 61 (2009) pp. 354-363. https://doi.org/10.1002/mrm.21837