Linear operators#

bartorch.linop represents a linear operator \(A\) from a domain of C-order shape ishape to a codomain of shape oshape, with its adjoint \(A^H\) and its normal operator \(A^H A\). Operators combine by A @ B (composition), A + B, A - B, c * A, A ** n, A.H (adjoint), A.T (transpose) and A[key] (restriction of the codomain); each result is a LinearOperator, and a composition of BART-backed operators is built as one BART operator. The MRI encoding operator describes the MRI encoding these operators implement and Differentiation through reconstruction their autograd behaviour.

Operation

Result

A(x), A.forward(x)

\(Ax\); A(x) is recorded by autograd, forward is not

A.adjoint(y), A.H(y)

\(A^H y\)

A.normal(x), A.gram()

\(A^H A x\), and \(A^H A\) as an operator

A.cogram()

\(A A^H\) as an operator

A.plan

The encoding form an MRI operator was lowered into, or None

MRI encoding operators#

Object

Transform

Model

CartesianSense

FFT

Cartesian SENSE, \(A = PFS\), with optional subspace basis and sampled-encode table

NoncartesianSense

NUFFT

Non-Cartesian SENSE, \(A = W\,\mathrm{NUFFT}\,S\), with optional density weights and subspace basis

WaveSense

Wave-encoded FFT

Wave-CAIPI and Wave-Shuffling encoding

FieldCorrected

Any of the above

Off-resonance correction by time segmentation, \(\sum_l \operatorname{diag}(b_l)\,E\,\operatorname{diag}(c_l)\)

Operator class#

Object

Description

LinearOperator

Base class: forward, adjoint and normal applications, operator algebra, and operators defined by Python callbacks

Elementary operators#

Object

Description

Identity

Identity on a shape

Zero

Zero operator

Diagonal

Pointwise multiplication by a broadcast tensor

ComponentDiagonal

Separate real scalings of the real and imaginary parts (real-linear)

Conj

Complex conjugation (real-linear)

Real

Real part (real-linear)

FFT

Unitary Fourier transform along axes, centred by default

NUFFT

Non-uniform Fourier transform along a trajectory, with optional weights and basis

MultiplySum

Multiplication by a tensor followed by summation over axes absent from the codomain

Matrix, convolution, finite-difference and smoothing operators#

Object

Description

Matrix

Multiplication by a matrix along one axis

Convolve

Convolution with a fixed kernel

Gradient

Forward finite differences with circular boundary, stacked on a new leading axis

Sobolev

A smooth image from k-space coefficients under a Sobolev weighting, as NLINV and moba fit coils and field maps

Stacking and block composition#

Object

Description

concatenate

Operators applied to one input, outputs concatenated along an axis

stack

Operators applied to one input, outputs stacked on a new axis

hstack

Input split between operators, outputs summed

block_diag

Block-diagonal operator

block

Block matrix of operators

Shape and indexing operators#

Object

Description

Reshape

Same elements under another shape

Transpose

Exchange of two axes

Permute

Permutation of the axes

Flip

Reversal along axes

Roll

Cyclic shift along one axis

Pad

Zero padding

Resize

Centred cropping or zero filling

Extract

Extraction of a block

Hankel

Sliding-window (Hankel) embedding along one axis

Sum

Sum over axes

ScaledSum

Sum over axes divided by the square root of the number of terms

Mean

Mean over axes

Repeat

Repetition along axes

User-defined operators#

LinearOperator.from_callbacks() builds an operator from Python functions for the forward, the adjoint and, optionally, the normal; BART calls them through callbacks, one call into Python per application. A subclass that defines forward and adjoint in Python is equivalent.

Complete reconstructions with these operators are in Operators and solvers and Radial SENSE reconstruction.