BART commands as functions#

bartorch.tools exposes BART’s command-line applications that have no operator or pipeline counterpart here, one function per command, run in this process. Array arguments and results are C-order tensors in BART’s dimension order reversed (Data layout and conventions), and axis arguments are axis indices rather than BART bitmasks; the results of a BART command are not recorded by autograd. Functions marked wrapped have a hand-written signature; the others are generated from BART’s declaration of the command and take its options under their long names. Reconstructions are bartorch.apps, or an encoding from bartorch.linop under a solver from bartorch.optim; Interfaces and execution compares the two routes. The last two sections, corrections and rigid motion, hold functions and classes with no BART command behind them.

Simulation#

Object

Description

phantom

Analytical phantom as an image or as k-space, optionally with coils or along a trajectory (wrapped)

coils

Analytical coil sensitivities

fakeksp

K-space from an image and sensitivities

noise

Additive complex Gaussian noise

Sampling and trajectories#

Object

Description

traj

Cartesian, radial and golden-angle trajectories in grid units (wrapped)

grid

Sampling grid coordinates in image space or k-space

pattern

Sampling pattern of a k-space array

poisson

Poisson-disc sampling pattern

upat

Regular undersampling pattern with a fully sampled centre

raga

Indices of a RAGA (rational approximation of the golden angle) radial ordering

grog

Radial data gridded onto a Cartesian grid by GROG

psf

Point spread function of a trajectory

wavepsf

Wave-CAIPI point spread function in hybrid space

estdims

Image dimensions implied by a non-Cartesian trajectory

estdelay

Gradient-delay estimation from radial data

trajcor

Gradient-delay correction of a trajectory

rmfreq

Removal of an angle-dependent frequency from radial data

bin

Binning of data by labels, including respiratory and cardiac quadrature binning

ssa

Singular spectrum analysis (SSA-FARY) of a time series

Coil calibration and compression#

Object

Description

ecalib

Sensitivities by ESPIRiT (wrapped)

caldir

Sensitivities directly from the low-resolution k-space centre (wrapped)

calmat

Calibration matrix of the k-space centre

ecaltwo

Second stage of ESPIRiT calibration

walsh

Walsh coil combination, for use with ecaltwo

nlinv

Image and sensitivities jointly by nonlinear inversion (wrapped)

ncalib

Sensitivities from non-Cartesian data by nonlinear inversion (ENLIVE)

cc

Coil compression matrix (SVD, geometric or ESPIRiT)

ccapply

Application of a coil compression matrix

rovir

Coil compression by region-optimized virtual coils (ROVir)

whiten

Noise prewhitening from a noise measurement, optionally returning the whitening matrix and the noise covariance (wrapped)

estvar

Noise variance of white Gaussian noise

phasepole

Detection of phase poles in sensitivities

Preprocessing, registration and metrics#

Object

Description

fovshift

Field-of-view shift of k-space by a linear phase (wrapped)

homodyne

Homodyne partial-Fourier reconstruction of asymmetrically sampled k-space

affine_transform

Resampling on an affinely mapped grid (wrapped)

warp

Resampling through a displacement field (wrapped)

register_affine

Affine registration by mutual information (wrapped)

register_nonrigid

Non-rigid registration by greedy SyN or TV-L1 optical flow (wrapped)

estimate_shift

Sub-voxel translation from the phase of the cross-spectrum (wrapped)

nrmse

Normalized root-mean-square error, optionally after least-squares scaling (wrapped)

mse

Mean squared error (wrapped)

psnr

Peak signal-to-noise ratio of the magnitudes (wrapped)

ssim

Structural similarity of the magnitudes (wrapped)

roi_stat

Statistic over a region of interest (wrapped)

Low-rank completion#

Object

Description

sake

SAKE: low-rank matrix completion of k-space

lrmatrix

Multi-scale low-rank matrix completion

Corrections#

Corrections applied to data or images outside the reconstruction. Bias field and gradient nonlinearity correction resample with SimpleITK (pip install 'bartorch[correct]'), and spiral deblurring uses Triton on a CUDA device when it is installed. Susceptibility correction runs PyHySCO, which is GPL-3.0-only, is not distributed with bartorch and is imported only when correct_susceptibility is called (pip install 'bartorch[pyhysco]').

Object

Description

epi_ramp_operator

Band-limited resampling of a ramp-sampled EPI readout onto a uniform grid

estimate_epi_phase

Odd/even phase of an EPI readout, fitted to a three-line navigator

correct_lines

Reversal of EPI lines into forward readout order, with the odd/even phase removed

bias_field_correct

Receive-field (bias) correction by N4

GradientCoefficients

Spherical-harmonic coefficient table of a gradient coil

CoefficientAccessor

Protocol for a coefficient table that is not a file

Gradunwarp

Gradient nonlinearity correction of images from a coefficient table

field_map_from_phase

Off-resonance field map from the phase of single-echo coil images

ReadoutTiming

Readout time of a spiral arm as a function of k-space radius

SpiralTransfer

Low-rank factorization of the off-resonance transfer of a spiral readout

fit_transfer

Fit of a SpiralTransfer to a readout’s time map

deblur

Off-resonance deblurring of a spiral image

correct_susceptibility

Susceptibility distortion correction from a reversed phase-encoding pair, by PyHySCO

SusceptibilityCorrection

Corrected pair and displacement field from correct_susceptibility

Rigid motion from navigators#

Plane reconstruction by the non-uniform transform of this package, rigid registration by SimpleITK (pip install 'bartorch[motion]'), and a constant-velocity extended Kalman filter over the registered poses.

Object

Description

reconstruct_navigator

Magnitude images of a navigator’s planes by density-compensated adjoint NUFFT

RigidRegistration

Multi-resolution rigid registration of magnitude images

RigidMotionEstimate

2D or 3D rigid transform with its covariance

RigidMotionEKF

Constant-velocity extended Kalman filter over registered rigid poses

NavigatorMotionTracker

Six-degree-of-freedom pose from a navigator’s 2D planes, filtered over time