Array functions and settings#

The bartorch namespace holds array functions on tensors, most of them calling BART’s commands, and the process-wide settings of the embedded library. Axis arguments are indices into a C-order shape; results are not recorded by autograd.

Fourier transforms#

Object

Description

fft

Fourier transform along axes; centred and unnormalized by default, unitary with unitary=True

ifft

Inverse of fft

fftshift

Cyclic shift of the zero frequency to the centre, or back

fftmod

Multiplication by the alternating phase relating centred and uncentred transforms

nufft

Non-uniform Fourier transform of an image along a trajectory

nufft_adjoint

Adjoint non-uniform Fourier transform, from samples to an image

estimate_density

Sampling density compensation weights of a trajectory (Pipe-Menon iteration)

K-space windows and readout#

Object

Description

hann_window

Radial or separable Hann window on a k-space grid

fermi_window

Radial or separable Fermi window on a k-space grid

apodize

Multiplication of k-space by a Hann or Fermi window over its trailing axes

remove_readout_oversampling

Cropping of the readout field of view in image space

Wavelet transforms#

Object

Description

fwt

Multi-level discrete wavelet transform along axes

iwt

Inverse of fwt

Thresholding#

Object

Description

soft_thresh

Soft thresholding of the modulus, \(x \max(1 - \lambda/\lvert x\rvert, 0)\)

hard_thresh

Hard thresholding, keeping entries with \(\lvert x\rvert > \lambda\)

Array utilities#

Object

Description

resize

Cropping or zero padding to a shape, anchored at the centre, the front or the start

flip

Reversal along axes

circshift

Cyclic shift along axes

conv

Cyclic convolution with a kernel

median_filter

Moving median along one axis

moving_average

Moving average along one axis

normalize

Division by the \(\ell_2\) or \(\ell_1\) norm over axes

mip

Maximum or minimum intensity projection

unwrap

Unwrapping of the real part along one axis, for a given period

casorati

Casorati matrix of overlapping blocks

rss

Root sum of squares over axes

Interpolation#

Object

Description

interpolate

Sampling of an array at fractional voxel positions

Coil kernels#

Object

Description

maps_to_kernels

Sensitivities as their low-frequency k-space kernels

kernels_to_maps

Sensitivities from k-space kernels

Errors#

Object

Description

BartError

Exception raised when a BART command or operator fails, carrying BART’s message

Runtime settings#

Object

Description

set_num_threads

Threads used by BART, its FFT and FINUFFT’s host transforms

set_copy_inputs

Whether commands work on copies of their inputs (default)

set_debug_level

BART’s verbosity

get_debug_level

Current verbosity

CUDA#

Object

Description

cuda_available

Whether the library was built with CUDA and a device is present

set_cuda_streams

Number of CUDA streams BART uses

use_cuda_memcache

Whether BART caches freed device memory

Build information#

Object

Description

bart_version

Version of the embedded BART

build_info

Compiler, nested-function mode, OpenMP and CUDA configuration of the library

backend_sources

Library serving each BLAS and LAPACK routine and the FFT