From BART and sigpy#
import bartorch.tools as bt
from bartorch import apps, linop, optim, priors
kspace = bt.phantom(128, coils=8, kspace=True) # (coils, z, y, x)
maps = bt.ecalib(kspace, maps=1) # bart ecalib -m1
image = apps.pics(kspace, maps, # bart pics -R W:3:0:0.005
regularizers=priors.Wavelet((-1, -2), 0.005))
A = linop.CartesianSense(maps, (1, 128, 128)) # sigpy.mri.linop.Sense
x = optim.CG(maxiter=20)(kspace, A) # sigpy.app.LinearLeastSquares
Arrays are torch tensors in C order, with the coils first: (coils, z, y, x),
the reverse of BART’s dimension vector and the layout sigpy uses
(Data layout and conventions). Axes are given as indices, never as
BART bitmasks.
BART |
sigpy |
bartorch |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
— |
|
|
|
|
— |
|
|
— |
|
|
— |
|
|
|
— |
|
BART’s fft is unnormalised unless -u; linop.FFT is unitary. Every other
command is a function of bartorch.tools (BART commands as functions).