Algorithmresearch
Low-rank plus sparse dynamic MRI
Also called L+S reconstruction.
Reconstruct a dynamic image series as the sum of a low rank background and a sparse dynamic part by proximal steps on nuclear and L1 norms.
- Solves
- MRI reconstruction
- Time
- O(K (c f n log n + n f^2 + f^3)) worst
- Space
- O(c f n) extra
- Where
- K = the number of iterations; c = the number of coils; f = the number of frames; n = the number of pixels in one frame
- Model
- Real RAM
- Properties
- convexdeterministicnot in placeiterativemonotoneoffline
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Ricardo Otazo, Emmanuel J. Candès, Daniel K. Sodickson, 2015
Low-rank plus sparse (L+S) reconstruction recovers a dynamic MR image series from undersampled k-space data. It writes the series as . The part has low rank as a space by time matrix and holds the background that changes slowly and in the same way everywhere. The part is sparse after a transform along time and holds the local changes, such as contrast that moves through a vessel. The method minimizes a data term plus the nuclear norm of and the norm of , one proximal gradient step at a time. The decomposition is that of robust PCA, with two differences: robust PCA sees the whole matrix and its is sparse in the matrix itself, while L+S sees only Fourier samples of each frame and its is sparse in a transform. It applies the ideas of compressed sensing MRI to dynamic data.
In plain words
Think of a cardiac scan as a film. Most of each frame is the same tissue, only a little brighter or darker over time. That part looks almost the same in every frame, so as a table with one column per frame it has only a few independent columns: it has low rank. The rest is small: a few pixels where something moves or where contrast flows in. Along time, these pixels change in a simple pattern, so few temporal frequencies describe them.
L+S keeps two guesses, one for each part. At each step it checks the sum against the measured k-space and corrects it. Then it cleans each part: it shrinks the singular values of the background, and it shrinks the temporal frequencies of the dynamic part. Small values become zero.
The problem
The input is the undersampled k-space data of frames, a 0/1 mask for each frame, coil maps (or one coil with ), two weights , a step and an iteration count . A frame has pixels. The series is the Casorati matrix with one column per frame.
The encoding operator maps frame and coil to , with the unitary 2D DFT (). This is the model of the MRI reconstruction problem and of SENSE, frame by frame. If at every pixel, then . The transform is the unitary DFT along time at each pixel. The output is the pair that minimizes, as far as steps allow,
where is the sum of the singular values (the nuclear norm) and is the sum of the moduli of the complex entries. The image series is . is convex.
The algorithm
The method is proximal gradient in the pair . The data term has the same gradient for and for . The two penalties act on different variables, so the proximal step splits into singular value thresholding for and soft thresholding in the transform for .
L+S(d, E, T, lambda_L, lambda_S, t, K)- 1
L <- 0; S <- 0; M <- t E^H d ▷ M = L + S - t gamma at the start - 2
repeat K times - 3
L_new <- SVT(M - S, t lambda_L) ▷ shrink singular values - 4
S_new <- T^H soft(T(M - L), t lambda_S) ▷ shrink temporal frequencies - 5
L <- L_new; S <- S_new - 6
M <- (L + S) - t E^H(E(L + S) - d) ▷ gradient step on the data term - 7
return L, S
Here for the SVD , and for each complex entry. Note that and , so lines L3 and L4 are the proximal step at the gradient point.
Table 1 of Otazo et al. has this form with and , . The code starts at . For SVT it uses the Gram matrix of the Casorati matrix, because is small and is large.
Example
Take frames of pixels. The background is a disk of 32 pixels with the value 1, scaled in frame by a contrast curve . Three pixels inside the disk also oscillate with the amplitude 0.5: pixel as , pixel as and pixel as . The singular values of the true series are 23.5, 1.00, 0.995, 0.948 and then zero, so it has rank 4. The background alone has rank 1, but the curve makes it dense along temporal frequency.
Each frame keeps 3 of its 8 phase encoding rows, always row 0 and two others chosen at random (seed 1), with a different choice per frame. One coil, . Zero filling, , has a relative error of 0.443. The table gives the relative error of with (measured with the code below):
| method and weights | 10 steps | 50 steps | 200 steps |
|---|---|---|---|
| L+S, , | 0.262 | 0.150 | 0.091 |
| low rank only, () | 0.372 | 0.193 | 0.107 |
| sparse only, () | 0.223 | 0.115 | 0.114 |
After 200 steps, the singular values of are 22.9, 0.18, 0.07, so has taken the background, and holds the three oscillating pixels. On a 3 by 3 grid of weights with 150 steps, the best errors were 0.093 for L+S, 0.107 for the low rank part alone and 0.097 for the sparse part alone. On this small series, the gain of L+S over the better single prior is small. These are measurements on one series, not a theorem.
Correctness
Three results hold, and all are proved in full below.
- The steps are proximal maps. Singular value thresholding is the proximal map of (Cai, Candès and Shen 2010), and is the proximal map of for a unitary . So lines L3 to L6 are one proximal gradient step on .
- Sufficient decrease. The gradient of the data term in is Lipschitz with the constant , because and enter only through their sum. Each step gives . So does not increase for .
- Convergence for small steps. For the iterates converge to a minimizer of by the general theory of forward-backward splitting (Combettes and Wajs 2005), and for , (Beck and Teboulle 2009). Otazo et al. cite these results and do not prove convergence themselves.
With , the step is the boundary case: does not increase, but the convergence results above do not apply. None of these results says that the minimizer of is close to the true series, or that it splits into the true background and dynamic parts. That depends on the sampling and the weights, and it is measured.
Proof: L+S is proximal gradient on a convex objective, with sufficient decrease for small stepsfull
The setting is that of the algorithm. A series is an complex Casorati matrix with one column per frame, where is the number of pixels. The inner product of two series is , and is the Frobenius norm. The encoding operator maps frame and coil to , with a 0/1 mask , the unitary 2D DFT and coil maps . The transform is the unitary DFT along time at each pixel. The objective is
with . Each term is convex, so is convex.
1. The norm of the encoding operator
Lemma 1. If at every pixel , then . With one coil, and full masks, .
Proof. is an orthogonal projection and is unitary, so . Summing over and gives . With one coil and , frame by frame.
2. The two proximal maps
The proximal map of a convex function is . It exists and is unique because the objective is strongly convex.
Lemma 2 (singular value thresholding). Let be an SVD with singular values , and . Then
where a term with is 0.
Proof. Let have the singular values . Von Neumann's trace inequality gives , so
Each term on the right is a scalar function of with its minimum at . The matrix has these singular values and gives equality in the trace inequality, because it shares the singular vectors of . So it attains the lower bound, and by uniqueness it is the proximal point. For the second form, , so , and for .
The code forms from the Gram matrix . It uses the real symmetric matrix . If , then and are orthogonal eigenvectors of for . So every eigenvalue of appears twice, and , summed over an orthonormal eigenbasis of . The complex matrix is the top left block plus times the bottom left block. This holds for any orthonormal eigenbasis, also when eigenvalues repeat, because the sum depends only on the eigenspaces.
Lemma 3 (soft thresholding in a unitary transform). For a unitary and ,
Proof. Put . Then , so the problem becomes , which splits into one problem per complex entry: . For a fixed modulus , the first term is smallest when has the phase of , and then the problem is , with the minimizer . So , and .
3. The iteration is proximal gradient
Theorem 4. Lines L3 to L6 are one proximal gradient step with step on in the variable :
Proof. The gradient of with respect to and to is the same matrix . The function is a sum of a function of and a function of , so its proximal map acts on each part alone. Line L6 stores . Then , and line L3 applies Lemma 2 with . Also , and line L4 applies Lemma 3 with . Line L1 sets and , which is at .
4. Sufficient decrease
Theorem 5. For every step ,
So does not increase for , and it decreases strictly at each step that moves for .
Proof. Write and . Since is quadratic,
using . So the gradient of is Lipschitz with the constant . The optimality condition of the proximal map says that is a subgradient of at . So
Add the two inequalities.
Consequences. Let and . Summing Theorem 5 gives , which is finite because . So the steps tend to zero. The step is for . In this range the general theory of forward-backward splitting gives convergence of to a minimizer of when one exists (Combettes and Wajs 2005). For , Beck and Teboulle (2009) also give . With , the step of Otazo et al. is the boundary case: Theorem 5 still gives a non-increasing , but none of these convergence results applies.
These results are about . They do not say that the minimizer splits the true series into its true and , or that it is close to the true series. Both depend on the sampling, the weights and the series, and are measured.
5. Known answers with full sampling
With one coil, , full masks and , Lemma 1 gives , so for the true series , and after every step. Then line L3 gives and line L4 gives , each from the previous pair. If exceeds every entry of and of along the iteration, then and after one step. If exceeds every singular value of and of , then and . The test file checks both cases.
Complexity
Let be the number of pixels in a frame, the number of frames and the number of coils. One step costs:
- for and with the FFT (line L6).
- for and with the FFT along time (line L4); the code uses a direct DFT when is not a power of two, which costs .
- to form the Gram matrix and the product (line L3).
- for the eigendecomposition of the Gram matrix with a dense solver. The code uses the cyclic Jacobi method on a real matrix, with work per sweep and a number of sweeps that is small in practice but not bounded here.
So steps take in the real RAM, and the space is for the data. The number of steps is a measured quantity. Otazo et al. stop when the relative change of falls below .
Properties
- Convex. Unlike LORAKS and the partial separability model with a fixed rank, the objective is convex, so every local minimizer is global.
- Two priors at once. The background and the dynamic part are regularized in different ways and come out as separate images. This separation is useful in itself, for example to view contrast uptake without the background.
- No training data. Unlike k-t BLAST, L+S needs no low resolution training scan.
- The split is not unique. A rank one matrix that is also sparse in , such as a constant series in one pixel, can sit in either part. The weights decide where it goes.
Variants and improvements
- Other transforms. Otazo et al. use the temporal Fourier transform for cardiac perfusion and cine, temporal finite differences for abdominal contrast scans, and the identity for angiography, where the images are sparse already. With a transform that is not unitary, line L4 is no longer the exact proximal map.
- Acceleration. FISTA adds a momentum step to the same iteration and improves the rate of to . ADMM and other splitting methods solve the same problem.
- Low rank and sparse in one variable. k-t SLR (Lingala et al. 2011) asks one series to be both low rank and sparse, instead of the sum of two parts. Robust PCA on fully sampled data is the case and .
- Explicit low rank models. The partial separability model fixes the rank and fits temporal basis functions from navigator data. This is a hard rank constraint and not a convex penalty.
- Non-Cartesian data. For radial or spiral sampling, uses a nonuniform FFT and must be computed or bounded before is chosen.
When to use it
Use L+S for dynamic scans with a background that changes slowly and a dynamic part that is local, such as contrast enhanced perfusion or cine with a static field of view. Use it when you want the background and the dynamic part as separate images. If the whole series is close to low rank, a low rank method alone is simpler. If the motion is large, so that the background does not stay in place, the low rank assumption fails, and methods with motion correction do better.
Pitfalls
- The step at the boundary. With , the step of Table 1 sits exactly at . On the example above with , and 150 steps, stopped at the error 0.545, above zero filling, with , while reached the error 0.148 and . With and , worked well (0.094). Use , or check the result against a smaller step.
- The weights are choices. Otazo et al. pick and by hand for each kind of scan, after they scale the data by its largest magnitude. Their values are for cardiac perfusion and , for cine. They also report that the weight from the robust PCA theory did not work directly for undersampled data.
- The norm of . The step bound uses . Coil maps that are not normalized, or a Fourier transform that is not unitary, change and can make the steps too long.
- The complex SVD. A real SVD of the real and imaginary parts as separate columns is not the complex SVD. The code embeds the complex Gram matrix as a real symmetric matrix of twice the size, where each eigenvalue appears twice.
- Leakage between the parts. If is small, takes the background too; if is small, takes the dynamic part. The separation in the images is only as good as this balance.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Shared helper of the imaging and inverse problems pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Small images and signals for the imaging and inverse problems pages.
Conventions:
- A signal is a list of numbers. An image is a list of rows, img[i][j], with
row i from the top and column j from the left.
- An n x n image covers the square [-1, 1]^2. The center of pixel (i, j) is
x_j = -1 + (2 j + 1) / n and y_i = 1 - (2 i + 1) / n, so y goes up.
- DFT: X_k = sum_j x_j exp(-2 pi i j k / n), unnormalized; the inverse has
the factor 1 / n. Index k stands for frequency k for k < n / 2 and k - n
otherwise. fftshift moves the zero frequency to position n // 2.
- Periodic convolution kernels are stored with their center at index 0
(wrapped around), so a delta kernel gives the identity and no shift.
"""
import cmath
import math
# ------------------------------------------------------------------ images
def new_image(n1, n2, value=0.0):
"""An n1 x n2 image (n1 rows, n2 columns) filled with value."""
return [[value] * n2 for _ in range(n1)]
def img_add(a, b):
"""The pixelwise sum a + b."""
return [[x + y for x, y in zip(ra, rb)] for ra, rb in zip(a, b)]
def img_scale(a, c):
"""The image c a."""
return [[c * x for x in row] for row in a]
def img_dot(a, b):
"""<a, b> = sum conj(a_ij) b_ij."""
return sum(x.conjugate() * y for ra, rb in zip(a, b) for x, y in zip(ra, rb))
def img_norm(a):
"""The Euclidean (Frobenius) norm of an image."""
return math.sqrt(sum(abs(x) ** 2 for row in a for x in row))
def flatten(img):
"""Row-major vector of an image."""
return [x for row in img for x in row]
def unflatten(v, n1, n2):
"""The n1 x n2 image of a row-major vector."""
return [list(v[i * n2:(i + 1) * n2]) for i in range(n1)]
# ------------------------------------------------------------------ DFT
def _is_pow2(n):
return n > 0 and n & (n - 1) == 0
def _fft_pow2(x):
"""Iterative radix-2 FFT, unnormalized forward transform."""
n = len(x)
a = [complex(v) for v in x]
j = 0
for i in range(1, n):
bit = n >> 1
while j & bit:
j ^= bit
bit >>= 1
j |= bit
if i < j:
a[i], a[j] = a[j], a[i]
size = 2
while size <= n:
half = size // 2
tw = [cmath.exp(-2j * math.pi * k / size) for k in range(half)]
for start in range(0, n, size):
for k in range(half):
u = a[start + k]
v = a[start + k + half] * tw[k]
a[start + k] = u + v
a[start + k + half] = u - v
size *= 2
return a
def dft(x):
"""X_k = sum_j x_j exp(-2 pi i j k / n). Radix-2 FFT when n is a power of 2."""
n = len(x)
if n == 0:
return []
if _is_pow2(n):
return _fft_pow2(x)
w = [cmath.exp(-2j * math.pi * t / n) for t in range(n)]
return [sum(x[j] * w[(j * k) % n] for j in range(n)) for k in range(n)]
def idft(xf):
"""x_j = (1/n) sum_k X_k exp(2 pi i j k / n)."""
n = len(xf)
if n == 0:
return []
y = dft([complex(v).conjugate() for v in xf])
return [v.conjugate() / n for v in y]
def _rows_then_cols(img, f):
rows = [f(row) for row in img]
cols = [f(list(col)) for col in zip(*rows)]
return [list(r) for r in zip(*cols)]
def dft2(img):
"""2D DFT: X_kl = sum_jq x_jq exp(-2 pi i (j k / n1 + q l / n2))."""
return _rows_then_cols(img, dft)
def idft2(img):
"""Inverse 2D DFT, with the factor 1 / (n1 n2)."""
return _rows_then_cols(img, idft)
def _shift1(x, s):
return list(x[s:]) + list(x[:s])
def fftshift(x):
"""Move the zero frequency to position n // 2 (1D, or both axes of an image)."""
if x and isinstance(x[0], (list, tuple)):
rows = [fftshift(r) for r in x]
return _shift1(rows, (len(rows) + 1) // 2)
return _shift1(x, (len(x) + 1) // 2)
def ifftshift(x):
"""The inverse of fftshift (1D, or both axes of an image)."""
if x and isinstance(x[0], (list, tuple)):
rows = [ifftshift(r) for r in x]
return _shift1(rows, len(rows) // 2)
return _shift1(x, len(x) // 2)
def circ_conv(x, h):
"""Periodic convolution y_i = sum_j h_j x_{(i - j) mod n}, kernel centered at index 0."""
n = len(x)
nz = [(j, hj) for j, hj in enumerate(h) if hj != 0]
return [sum(hj * x[(i - j) % n] for j, hj in nz) for i in range(n)]
def circ_conv2(img, h):
"""Periodic 2D convolution with the kernel h centered at index (0, 0)."""
n1, n2 = len(img), len(img[0])
nz = [(p, q, h[p][q]) for p in range(len(h)) for q in range(len(h[0])) if h[p][q] != 0]
out = new_image(n1, n2)
for i in range(n1):
for j in range(n2):
out[i][j] = sum(v * img[(i - p) % n1][(j - q) % n2] for p, q, v in nz)
return out
# ------------------------------------------------------------------ phantoms
def pixel_centers(n):
"""(xs, ys): xs[j] = -1 + (2 j + 1) / n and ys[i] = 1 - (2 i + 1) / n."""
xs = [-1.0 + (2 * j + 1) / n for j in range(n)]
ys = [1.0 - (2 * i + 1) / n for i in range(n)]
return xs, ys
# Rows: rho, A, B, x0, y0, phi (degrees). A is the semi-axis along the
# direction phi (counterclockwise from the x axis), B the other semi-axis.
# Geometry and densities of Shepp and Logan (1974), as reproduced in Kak and
# Slaney, Principles of Computerized Tomographic Imaging, Table 3.1. The value
# at the center (0, 0) is 2 - 0.98 = 1.02.
SHEPP_LOGAN = [
(2.0, 0.92, 0.69, 0.0, 0.0, 90.0),
(-0.98, 0.874, 0.6624, 0.0, -0.0184, 90.0),
(-0.02, 0.31, 0.11, 0.22, 0.0, 72.0),
(-0.02, 0.41, 0.16, -0.22, 0.0, 108.0),
(0.01, 0.25, 0.21, 0.0, 0.35, 90.0),
(0.01, 0.046, 0.046, 0.0, 0.1, 0.0),
(0.01, 0.046, 0.046, 0.0, -0.1, 0.0),
(0.01, 0.046, 0.023, -0.08, -0.605, 0.0),
(0.01, 0.023, 0.023, 0.0, -0.605, 0.0),
(0.01, 0.046, 0.023, 0.06, -0.605, 90.0),
]
# The same ellipses with the gray levels of Toft (1996), which give more
# contrast. The value at the center is 1 - 0.8 = 0.2.
MODIFIED_SHEPP_LOGAN = [
(rho, a, b, x0, y0, phi)
for rho, (_, a, b, x0, y0, phi) in zip(
(1.0, -0.8, -0.2, -0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1), SHEPP_LOGAN
)
]
def ellipse_value(x, y, table):
"""The phantom value at the point (x, y): the sum of rho over the ellipses that hold it."""
total = 0.0
for rho, a, b, x0, y0, phi in table:
c, s = math.cos(math.radians(phi)), math.sin(math.radians(phi))
dx, dy = x - x0, y - y0
u = dx * c + dy * s
v = -dx * s + dy * c
if (u / a) ** 2 + (v / b) ** 2 <= 1.0:
total += rho
return total
def ellipse_phantom(n, table):
"""The n x n image of an ellipse table, sampled at the pixel centers."""
xs, ys = pixel_centers(n)
return [[ellipse_value(x, y, table) for x in xs] for y in ys]
def disk_phantom(n, radius):
"""1 at pixel centers with x^2 + y^2 <= radius^2, 0 elsewhere."""
xs, ys = pixel_centers(n)
r2 = radius * radius
return [[1.0 if x * x + y * y <= r2 else 0.0 for x in xs] for y in ys]
def spikes_1d(n, positions, amplitudes):
"""A signal of length n with the given amplitudes at the given positions."""
out = [0.0] * n
for p, a in zip(positions, amplitudes):
out[p] += a
return out
# ------------------------------------------------------------------ projector
def parallel_beam_matrix(n, angles, nbins):
"""Pixel-driven discrete Radon transform of an n x n image on [-1, 1]^2.
Each pixel center (x, y) projects to s = x cos(theta) + y sin(theta). Its
value times the pixel area over the bin width is split linearly between
the two nearest bin centers. The bins cover [-sqrt(2), sqrt(2)]. Row
a * nbins + b holds angle a and bin b; column i * n + j holds pixel (i, j).
Returns the sparse rows, each a list of (column, weight) pairs.
Pixel-driven projection has a ripple: with a bin width close to the pixel
size, a disk projection is off by up to about 10 percent in some bins. A
bin of about twice the pixel size (nbins = 23 for n = 32) keeps it near
1 percent.
"""
xs, ys = pixel_centers(n)
smax = math.sqrt(2.0)
width = 2.0 * smax / nbins
scale = (2.0 / n) ** 2 / width
rows = []
for theta in angles:
c, s = math.cos(theta), math.sin(theta)
acc = [dict() for _ in range(nbins)]
for i, y in enumerate(ys):
for j, x in enumerate(xs):
t = (x * c + y * s + smax) / width - 0.5
b0 = math.floor(t)
frac = t - b0
col = i * n + j
for b, w in ((b0, 1.0 - frac), (b0 + 1, frac)):
if 0 <= b < nbins and w > 0.0:
acc[b][col] = acc[b].get(col, 0.0) + w * scale
rows.extend(sorted(d.items()) for d in acc)
return rows
def sp_matvec(rows, x):
"""y = A x for sparse rows of (column, weight) pairs."""
return [sum(w * x[c] for c, w in row) for row in rows]
def sp_rmatvec(rows, y, ncols):
"""x = A^H y for sparse rows of (column, weight) pairs and ncols columns."""
out = [0.0] * ncols
for row, yi in zip(rows, y):
if yi == 0:
continue
for c, w in row:
out[c] += w.conjugate() * yi
return out
# ------------------------------------------------------------------ noise
def gauss_noise(rng, shape, sigma):
"""Independent N(0, sigma^2) values: a list for an int shape, an image for (n1, n2)."""
if isinstance(shape, int):
return [rng.gauss(0.0, sigma) for _ in range(shape)]
n1, n2 = shape
return [[rng.gauss(0.0, sigma) for _ in range(n2)] for _ in range(n1)]
def _poisson_small(rng, lam):
"""Knuth's product method, exact for a mean lam <= 30."""
limit = math.exp(-lam)
k, p = 0, rng.random()
while p > limit:
k += 1
p *= rng.random()
return k
def poisson_sample(rng, lam):
"""An exact Poisson(lam) sample: a sum of Knuth samples with means at most 30."""
if lam < 0:
raise ValueError("negative mean")
total = 0
while lam > 30.0:
total += _poisson_small(rng, 30.0)
lam -= 30.0
if lam > 0.0:
total += _poisson_small(rng, lam)
return total
imgla.py 259 lines
# SPDX-License-Identifier: MIT
# Shared helper of the imaging and inverse problems pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Dense linear algebra on lists of rows (float, complex or Fraction entries).
A matrix is a list of rows. A vector is a list of numbers. The inner product
is <u, v> = sum_i conj(u_i) v_i, linear in the second argument, so that the
adjoint A^H satisfies <A x, y> = <x, A^H y>.
"""
import math
def _flat(x):
"""Flatten a list of rows (an image) into one list; a vector is returned as is."""
if x and isinstance(x[0], (list, tuple)):
return [v for row in x for v in row]
return x
def zeros(m, n):
"""The m x n zero matrix."""
return [[0.0] * n for _ in range(m)]
def eye(n):
"""The n x n identity matrix."""
out = zeros(n, n)
for i in range(n):
out[i][i] = 1.0
return out
def transpose(a):
"""A^T."""
return [list(col) for col in zip(*a)]
def conj_transpose(a):
"""A^H, the conjugate transpose."""
return [[v.conjugate() for v in col] for col in zip(*a)]
def matmul(a, b):
"""The product A B."""
bt = list(zip(*b))
return [[sum(x * y for x, y in zip(row, col)) for col in bt] for row in a]
def matvec(a, x):
"""The product A x."""
return [sum(v * w for v, w in zip(row, x)) for row in a]
def rmatvec(a, y):
"""The product A^H y."""
n = len(a[0]) if a else 0
out = [0.0] * n
for row, yi in zip(a, y):
if yi == 0:
continue
for j, v in enumerate(row):
out[j] += v.conjugate() * yi
return out
def dot(u, v):
"""<u, v> = sum_i conj(u_i) v_i. Images (lists of rows) are flattened."""
return sum(a.conjugate() * b for a, b in zip(_flat(u), _flat(v)))
def norm2(x):
"""The Euclidean norm. Images (lists of rows) are flattened."""
return math.sqrt(sum(abs(v) ** 2 for v in _flat(x)))
def solve(a, b):
"""Solve A x = b by Gaussian elimination with partial pivoting.
b is a vector or a matrix (a list of rows). A must be square and
nonsingular; a zero pivot raises ValueError. Fractions stay exact.
"""
n = len(a)
vec = not (b and isinstance(b[0], (list, tuple)))
rhs = [[bi] for bi in b] if vec else [list(r) for r in b]
m = [list(row) + rhs[i] for i, row in enumerate(a)]
w = len(m[0])
for c in range(n):
p = max(range(c, n), key=lambda r: abs(m[r][c]))
if m[p][c] == 0:
raise ValueError("singular matrix")
m[c], m[p] = m[p], m[c]
piv = m[c][c]
for r in range(c + 1, n):
f = m[r][c] / piv
if f != 0:
mr, mc = m[r], m[c]
for j in range(c, w):
mr[j] -= f * mc[j]
x = [[0.0] * (w - n) for _ in range(n)]
for r in range(n - 1, -1, -1):
for j in range(w - n):
s = m[r][n + j] - sum(m[r][k] * x[k][j] for k in range(r + 1, n))
x[r][j] = s / m[r][r]
return [row[0] for row in x] if vec else x
def cholesky(a):
"""Lower triangular L with A = L L^H for a Hermitian positive definite A."""
n = len(a)
low = zeros(n, n)
for j in range(n):
d = a[j][j] - sum(abs(low[j][k]) ** 2 for k in range(j))
d = d.real if isinstance(d, complex) else d
if not d > 0:
raise ValueError("matrix is not positive definite")
ljj = math.sqrt(d)
low[j][j] = ljj
for i in range(j + 1, n):
s = a[i][j] - sum(low[i][k] * low[j][k].conjugate() for k in range(j))
low[i][j] = s / ljj
return low
def cho_solve(low, b):
"""Solve (L L^H) x = b, with L from cholesky."""
n = len(low)
z = [0.0] * n
for i in range(n):
z[i] = (b[i] - sum(low[i][k] * z[k] for k in range(i))) / low[i][i]
x = [0.0] * n
for i in range(n - 1, -1, -1):
s = z[i] - sum(low[k][i].conjugate() * x[k] for k in range(i + 1, n))
x[i] = s / low[i][i].conjugate()
return x
def _rot_params(app, aqq, apq):
"""c, s of the Jacobi rotation that zeroes the (p, q) entry of [[app, apq], [apq, aqq]]."""
theta = (aqq - app) / (2.0 * apq)
t = (1.0 if theta >= 0 else -1.0) / (abs(theta) + math.sqrt(theta * theta + 1.0))
c = 1.0 / math.sqrt(1.0 + t * t)
return c, c * t
def sym_eig(a, tol=1e-15, max_sweeps=100):
"""Eigenvalues (ascending) and eigenvectors (as columns) of a real symmetric matrix.
Cyclic Jacobi method. Returns (w, Q) with A = Q diag(w) Q^T.
"""
n = len(a)
m = [[float(v) for v in row] for row in a]
q = eye(n)
for _ in range(max_sweeps):
off = sum(m[i][j] ** 2 for i in range(n) for j in range(n) if i != j)
scale = sum(m[i][i] ** 2 for i in range(n)) + off
if off <= (tol * tol) * scale or off == 0.0:
break
for p in range(n - 1):
for r in range(p + 1, n):
apq = m[p][r]
if apq == 0.0:
continue
c, s = _rot_params(m[p][p], m[r][r], apq)
for k in range(n):
mkp, mkr = m[k][p], m[k][r]
m[k][p] = c * mkp - s * mkr
m[k][r] = s * mkp + c * mkr
mp, mr = m[p], m[r]
for k in range(n):
mpk, mrk = mp[k], mr[k]
mp[k] = c * mpk - s * mrk
mr[k] = s * mpk + c * mrk
m[p][r] = m[r][p] = 0.0
for k in range(n):
qkp, qkr = q[k][p], q[k][r]
q[k][p] = c * qkp - s * qkr
q[k][r] = s * qkp + c * qkr
order = sorted(range(n), key=lambda i: m[i][i])
w = [m[i][i] for i in order]
qs = [[q[k][i] for i in order] for k in range(n)]
return w, qs
def _complete(cols, m):
"""Replace zero columns of an m-row column list by unit vectors orthogonal to the others."""
for idx, col in enumerate(cols):
if any(v != 0.0 for v in col):
continue
for e in range(m):
cand = [0.0] * m
cand[e] = 1.0
for _ in range(2):
for jdx, other in enumerate(cols):
if jdx == idx or not any(v != 0.0 for v in other):
continue
h = sum(a * b for a, b in zip(other, cand))
cand = [a - h * b for a, b in zip(cand, other)]
nrm = math.sqrt(sum(v * v for v in cand))
if nrm > 0.5:
cols[idx] = [v / nrm for v in cand]
break
return cols
def svd(a, tol=1e-15, max_sweeps=100):
"""Thin SVD of a real m x n matrix by one-sided Jacobi (Hestenes).
Returns (U, S, V) with p = min(m, n): U is m x p, S a list of p values in
descending order, V is n x p, U^T U = I, V^T V = I and A = U diag(S) V^T.
"""
m, n = len(a), len(a[0])
if m < n:
v, s, u = svd(transpose(a), tol, max_sweeps)
return u, s, v
cols = [[float(a[i][j]) for i in range(m)] for j in range(n)]
vcols = [[1.0 if i == j else 0.0 for i in range(n)] for j in range(n)]
for _ in range(max_sweeps):
rotated = False
for p in range(n - 1):
for r in range(p + 1, n):
cp, cr = cols[p], cols[r]
alpha = sum(x * x for x in cp)
beta = sum(x * x for x in cr)
gamma = sum(x * y for x, y in zip(cp, cr))
if gamma == 0.0 or abs(gamma) <= tol * math.sqrt(alpha * beta):
continue
rotated = True
c, s = _rot_params(alpha, beta, gamma)
cols[p] = [c * x - s * y for x, y in zip(cp, cr)]
cols[r] = [s * x + c * y for x, y in zip(cp, cr)]
vp, vr = vcols[p], vcols[r]
vcols[p] = [c * x - s * y for x, y in zip(vp, vr)]
vcols[r] = [s * x + c * y for x, y in zip(vp, vr)]
if not rotated:
break
sig = [math.sqrt(sum(x * x for x in col)) for col in cols]
# A column below 1e-150 times the largest one is zero to working precision;
# its squares underflow, so its direction carries no information.
floor = max(sig) * 1e-150 if sig else 0.0
sig = [t if t > floor and t > 1e-150 else 0.0 for t in sig]
order = sorted(range(n), key=lambda j: -sig[j])
s_out = [sig[j] for j in order]
ucols = [[x / sig[j] for x in cols[j]] if sig[j] > 0.0 else [0.0] * m for j in order]
ucols = _complete(ucols, m)
u = [[ucols[j][i] for j in range(n)] for i in range(m)]
v = [[vcols[j][i] for j in order] for i in range(n)]
return u, s_out, v
def adjoint_gap(apply_a, apply_ah, x, y):
"""|<A x, y> - <x, A^H y>| / (||A x|| ||y||) for given functions A and A^H.
x and y may be vectors or images (lists of rows). If the denominator is
zero, the absolute gap is returned.
"""
ax = apply_a(x)
gap = abs(dot(ax, y) - dot(x, apply_ah(y)))
den = norm2(ax) * norm2(y)
return gap / den if den > 0.0 else gap
low_rank_plus_sparse_mri.py 201 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/low-rank-plus-sparse-mri/. The authors are listed in prov/FVJ0PD.jsonl.
"""Low-rank plus sparse (L+S) reconstruction of dynamic MRI (Otazo, Candes and Sodickson 2015).
A series is a list of nt frames. Each frame is an n1 x n2 complex image,
stored row-major as one list of n1 * n2 numbers, so the series is the
Casorati matrix with one column per frame.
Encoding operator E: frame t and coil j give the k-space M_t F_u (c_j x_t),
with the unitary 2D DFT F_u (F_u^H F_u = I), the 0/1 mask M_t of frame t
and the coil map c_j (one coil with c = 1 if no maps are given). The data
are stored on the full grid, with zeros where M_t = 0. With
sum_j |c_j|^2 <= 1 at every pixel, ||E|| <= 1.
Sparsifying transform T: the unitary DFT along time at each pixel.
The method minimizes, by proximal gradient steps on the pair (L, S),
F(L, S) = (1/2) ||E(L + S) - d||^2 + lamL ||L||_* + lamS ||T S||_1,
with the nuclear norm ||L||_* (the sum of the singular values of the
Casorati matrix) and the l1 norm of the complex entries. The gradient of
the data term in (L, S) has the Lipschitz constant 2 ||E||^2, so the
objective does not increase for t <= 1 / ||E||^2 and decreases by at
least (1/t - ||E||^2) ||change||^2 per step. With t = 1 the update has
the form of Table 1 of Otazo et al., which is the boundary case for
||E|| = 1. The start here is L_0 = S_0 = 0.
Complex SVD: imgla.svd is for real matrices, so singular value
thresholding uses the real symmetric embedding of the nt x nt Gram matrix
and imgla.sym_eig. This small piece of code lives here and not in a helper.
Cost per iteration, for P = n1 n2 pixels, nt frames and nc coils:
O(nt nc P log P) for E and E^H with the FFT, O(P nt log nt) for T and T^H
when nt is a power of two, O(P nt^2) for the Gram matrix and the product
L W, and O(nt^3) per Jacobi sweep.
"""
import math
from imgkit import dft, dft2, idft, idft2, unflatten
from imgla import sym_eig
# ------------------------------------------------------------------ operators
def _fu2(frame, n1, n2):
s = 1.0 / math.sqrt(n1 * n2)
return [v * s for row in dft2(unflatten(frame, n1, n2)) for v in row]
def _fu2h(kspace, n1, n2):
s = math.sqrt(n1 * n2)
return [v * s for row in idft2(unflatten(kspace, n1, n2)) for v in row]
def encode(series, masks, n1, n2, coils=None):
"""E(x): data[t][j] = M_t F_u (c_j x_t) on the full grid."""
out = []
for t, frame in enumerate(series):
per_coil = []
for cmap in coils or [None]:
img = frame if cmap is None else [c * v for c, v in zip(cmap, frame)]
k = _fu2(img, n1, n2)
per_coil.append([v if m else 0j for v, m in zip(k, masks[t])])
out.append(per_coil)
return out
def encode_adjoint(data, masks, n1, n2, coils=None):
"""E^H(d): x_t = sum_j conj(c_j) F_u^H (M_t d[t][j])."""
out = []
for t, per_coil in enumerate(data):
acc = [0j] * (n1 * n2)
for j, k in enumerate(per_coil):
img = _fu2h([v if m else 0j for v, m in zip(k, masks[t])], n1, n2)
if coils is None:
acc = [a + v for a, v in zip(acc, img)]
else:
acc = [a + c.conjugate() * v for a, c, v in zip(acc, coils[j], img)]
out.append(acc)
return out
def temporal_ft(series):
"""T: the unitary DFT along time at each pixel."""
nt = len(series)
s = 1.0 / math.sqrt(nt)
cols = [dft([frame[p] for frame in series]) for p in range(len(series[0]))]
return [[col[f] * s for col in cols] for f in range(nt)]
def temporal_ift(series):
"""T^H = T^(-1)."""
nt = len(series)
s = math.sqrt(nt)
cols = [idft([frame[p] for frame in series]) for p in range(len(series[0]))]
return [[col[f] * s for col in cols] for f in range(nt)]
# ------------------------------------------------------------------ proximal maps
def gram_function(series, g):
"""The matrix W = V diag(g(sigma_i^2)) V^H of the Gram matrix X^H X = V diag(sigma^2) V^H.
The Hermitian nt x nt Gram matrix G is embedded as the real symmetric
matrix [[Re G, -Im G], [Im G, Re G]], where each eigenvalue of G
appears twice, and W is read from the sum of g(lambda) q q^T over its
eigenpairs. Returns (W, s2) with s2 the eigenvalues of G in descending
order.
"""
nt = len(series)
gm = [[sum(a.conjugate() * b for a, b in zip(series[i], series[j])) for j in range(nt)] for i in range(nt)]
emb = [[0.0] * (2 * nt) for _ in range(2 * nt)]
for i in range(nt):
for j in range(nt):
re, im = gm[i][j].real, gm[i][j].imag
emb[i][j] = re
emb[i + nt][j + nt] = re
emb[i][j + nt] = -im
emb[i + nt][j] = im
vals, vecs = sym_eig(emb)
gv = [g(max(v, 0.0)) for v in vals]
w = [[0j] * nt for _ in range(nt)]
for i in range(nt):
for j in range(nt):
re = sum(gv[q] * vecs[i][q] * vecs[j][q] for q in range(2 * nt))
im = sum(gv[q] * vecs[i + nt][q] * vecs[j][q] for q in range(2 * nt))
w[i][j] = complex(re, im)
desc = sorted((max(v, 0.0) for v in vals), reverse=True)
return w, [desc[2 * i] for i in range(nt)]
def svt(series, tau):
"""Singular value thresholding: U diag(max(sigma - tau, 0)) V^H = X V diag(max(1 - tau / sigma, 0)) V^H."""
if tau <= 0:
return [list(frame) for frame in series]
def shrink(lam):
sig = math.sqrt(lam)
return max(1.0 - tau / sig, 0.0) if sig > 0 else 0.0
w, _ = gram_function(series, shrink)
nt = len(series)
npix = len(series[0])
return [[sum(series[i][p] * w[i][j] for i in range(nt)) for p in range(npix)] for j in range(nt)]
def nuclear_norm(series):
"""The sum of the singular values of the Casorati matrix."""
_, s2 = gram_function(series, lambda lam: 0.0)
return sum(math.sqrt(v) for v in s2)
def soft(z, tau):
"""Complex soft thresholding: (z / |z|) max(|z| - tau, 0)."""
a = abs(z)
return z * (1.0 - tau / a) if a > tau else 0j
# ------------------------------------------------------------------ the method
def objective(low, sparse, data, masks, n1, n2, lam_l, lam_s, coils=None):
"""F(L, S) = (1/2) ||E(L + S) - d||^2 + lamL ||L||_* + lamS ||T S||_1."""
xs = [[a + b for a, b in zip(fl, fs)] for fl, fs in zip(low, sparse)]
ex = encode(xs, masks, n1, n2, coils)
fit = 0.5 * sum(abs(a - b) ** 2 for et, dt in zip(ex, data) for ej, dj in zip(et, dt) for a, b in zip(ej, dj))
ts = temporal_ft(sparse)
return fit + lam_l * nuclear_norm(low) + lam_s * sum(abs(v) for frame in ts for v in frame)
def l_plus_s(data, masks, n1, n2, lam_l, lam_s, step=1.0, iters=50, coils=None, history=None):
"""Recover L and S from dynamic k-space data d (one entry per frame and coil).
step is the step t; the objective does not increase for t <= 1 / ||E||^2.
If history is a list, F(L_k, S_k) is appended for k = 0, ..., iters.
"""
nt = len(data)
npix = n1 * n2
low = [[0j] * npix for _ in range(nt)] # @line L1
sparse = [[0j] * npix for _ in range(nt)]
m = [[step * v for v in frame] for frame in encode_adjoint(data, masks, n1, n2, coils)]
if history is not None:
history.append(objective(low, sparse, data, masks, n1, n2, lam_l, lam_s, coils))
for _ in range(iters): # @line L2
new_low = svt([[a - b for a, b in zip(fm, fs)] for fm, fs in zip(m, sparse)], step * lam_l) # @line L3
diff = temporal_ft([[a - b for a, b in zip(fm, fl)] for fm, fl in zip(m, low)]) # @line L4
new_sparse = temporal_ift([[soft(v, step * lam_s) for v in frame] for frame in diff])
low, sparse = new_low, new_sparse # @line L5
xs = [[a + b for a, b in zip(fl, fs)] for fl, fs in zip(low, sparse)] # @line L6
ex = encode(xs, masks, n1, n2, coils)
resid = [[[a - b for a, b in zip(ej, dj)] for ej, dj in zip(et, dt)] for et, dt in zip(ex, data)]
grad = encode_adjoint(resid, masks, n1, n2, coils)
m = [[x - step * g for x, g in zip(fx, fg)] for fx, fg in zip(xs, grad)]
if history is not None:
history.append(objective(low, sparse, data, masks, n1, n2, lam_l, lam_s, coils))
return low, sparse # @line L7
test_low_rank_plus_sparse_mri.py 188 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/low-rank-plus-sparse-mri/. The authors are listed in prov/FVJ0PD.jsonl.
import math
import random
from imgkit import disk_phantom
from imgla import svd
from low_rank_plus_sparse_mri import (
encode,
encode_adjoint,
l_plus_s,
nuclear_norm,
objective,
soft,
svt,
temporal_ft,
temporal_ift,
)
def rand_series(rng, nt, npix):
return [[complex(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in range(npix)] for _ in range(nt)]
def rand_masks(rng, nt, npix, p=0.5):
return [[1 if rng.random() < p else 0 for _ in range(npix)] for _ in range(nt)]
def two_coils(rng, npix):
"""Two coil maps with |c_1|^2 + |c_2|^2 = 1 at every pixel."""
c1, c2 = [], []
for _ in range(npix):
a = complex(rng.gauss(0, 1), rng.gauss(0, 1))
b = complex(rng.gauss(0, 1), rng.gauss(0, 1))
s = math.sqrt(abs(a) ** 2 + abs(b) ** 2)
c1.append(a / s)
c2.append(b / s)
return [c1, c2]
def inner(u, v):
return sum(a.conjugate() * b for fu, fv in zip(u, v) for a, b in zip(fu, fv))
def inner3(u, v):
return sum(inner(a, b) for a, b in zip(u, v))
def sq_dist(u, v):
return sum(abs(a - b) ** 2 for fu, fv in zip(u, v) for a, b in zip(fu, fv))
def rel_err(u, v):
return math.sqrt(sq_dist(u, v) / sum(abs(b) ** 2 for fv in v for b in fv))
def embed(c):
"""The real matrix [[Re C, -Im C], [Im C, Re C]]."""
top = [[v.real for v in row] + [-v.imag for v in row] for row in c]
bot = [[v.imag for v in row] + [v.real for v in row] for row in c]
return top + bot
def test_encode_adjoint():
rng = random.Random(1)
n1, n2, nt = 4, 4, 3
x = rand_series(rng, nt, n1 * n2)
masks = rand_masks(rng, nt, n1 * n2)
for coils in (None, two_coils(rng, n1 * n2)):
nc = 1 if coils is None else 2
y = [[[complex(rng.gauss(0, 1), rng.gauss(0, 1)) * m for m in masks[t]] for _ in range(nc)] for t in range(nt)]
lhs = inner3(encode(x, masks, n1, n2, coils), y)
rhs = inner(x, encode_adjoint(y, masks, n1, n2, coils))
assert abs(lhs - rhs) < 1e-10 * abs(lhs)
def test_encoding_norm_at_most_one():
rng = random.Random(2)
n1, n2, nt = 4, 4, 3
coils = two_coils(rng, n1 * n2)
full = [[1] * (n1 * n2) for _ in range(nt)]
for _ in range(3):
x = rand_series(rng, nt, n1 * n2)
nx = inner(x, x).real
ex = encode(x, rand_masks(rng, nt, n1 * n2), n1, n2, coils)
assert sum(inner(e, e).real for e in ex) <= nx * (1 + 1e-12)
ex = encode(x, full, n1, n2, coils)
assert abs(sum(inner(e, e).real for e in ex) - nx) < 1e-10 * nx
def test_temporal_transform_is_unitary():
rng = random.Random(3)
x = rand_series(rng, 6, 5)
tx = temporal_ft(x)
assert abs(inner(tx, tx).real - inner(x, x).real) < 1e-10 * inner(x, x).real
assert sq_dist(temporal_ift(tx), x) < 1e-20 * inner(x, x).real
const = [[2.0 + 1j] * 5 for _ in range(6)]
tc = temporal_ft(const)
assert all(abs(v) < 1e-12 for frame in tc[1:] for v in frame)
def test_svt_matches_real_svd():
rng = random.Random(4)
x = rand_series(rng, 4, 7)
casorati = [[x[t][p] for t in range(4)] for p in range(7)]
u, s, v = svd(embed(casorati))
assert abs(nuclear_norm(x) - sum(s) / 2) < 1e-10
for tau in (0.0, 0.5, s[2], 2.0):
low = svt(x, tau)
shr = [max(si - tau, 0.0) for si in s]
e = [[sum(u[i][k] * shr[k] * v[j][k] for k in range(len(s))) for j in range(len(v))] for i in range(len(u))]
got = embed([[low[t][p] for t in range(4)] for p in range(7)])
assert max(abs(got[i][j] - e[i][j]) for i in range(14) for j in range(8)) < 1e-9
def test_soft_threshold():
assert soft(3 + 4j, 1.0) == (3 + 4j) * 0.8
assert soft(0.5j, 1.0) == 0j
assert soft(0j, 0.0) == 0j
def test_full_sampling_known_answers():
rng = random.Random(5)
n1, n2, nt = 4, 4, 4
x = rand_series(rng, nt, n1 * n2)
full = [[1] * (n1 * n2) for _ in range(nt)]
d = encode(x, full, n1, n2)
low, sparse = l_plus_s(d, full, n1, n2, 0.7, 1e9, 1.0, 3)
assert sq_dist(low, svt(x, 0.7)) < 1e-18 and sq_dist(sparse, [[0j] * 16] * nt) == 0
low, sparse = l_plus_s(d, full, n1, n2, 1e9, 0.4, 1.0, 3)
want = temporal_ift([[soft(v, 0.4) for v in frame] for frame in temporal_ft(x)])
assert sq_dist(sparse, want) < 1e-18 and nuclear_norm(low) < 1e-12
def test_sufficient_decrease():
rng = random.Random(6)
n1, n2, nt = 4, 4, 4
coils = two_coils(rng, n1 * n2)
x = rand_series(rng, nt, n1 * n2)
masks = rand_masks(rng, nt, n1 * n2)
d = encode(x, masks, n1, n2, coils)
for step in (0.5, 0.9):
prev = None
for k in range(7):
low, sparse = l_plus_s(d, masks, n1, n2, 0.3, 0.1, step, k, coils)
f = objective(low, sparse, d, masks, n1, n2, 0.3, 0.1, coils)
if prev is not None:
change = sq_dist(low, prev[0]) + sq_dist(sparse, prev[1])
assert f <= prev[2] - (1 / step - 1) * change + 1e-10
prev = (low, sparse, f)
def test_boundary_step_is_monotone():
rng = random.Random(7)
n1, n2, nt = 4, 4, 4
x = rand_series(rng, nt, n1 * n2)
masks = rand_masks(rng, nt, n1 * n2)
d = encode(x, masks, n1, n2)
hist = []
l_plus_s(d, masks, n1, n2, 0.2, 0.05, 1.0, 15, None, hist)
assert all(b <= a + 1e-10 for a, b in zip(hist, hist[1:]))
def test_beats_zero_filling_on_a_dynamic_phantom():
n1 = n2 = nt = 8
bg = [v for row in disk_phantom(8, 0.8) for v in row]
curve = [1.0, 1.4, 1.7, 1.8, 1.7, 1.5, 1.3, 1.2]
x = []
for t in range(nt):
f = [complex(v) * curve[t] for v in bg]
f[27] += 0.5 * math.cos(2 * math.pi * t / nt)
f[28] += 0.5 * math.sin(2 * math.pi * 2 * t / nt)
f[36] += 0.5 * math.cos(2 * math.pi * 3 * t / nt)
x.append(f)
rng = random.Random(1)
masks = []
for t in range(nt):
rows = {0}
while len(rows) < 3:
rows.add(rng.randrange(n1))
masks.append([1 if i in rows else 0 for i in range(n1) for _ in range(n2)])
d = encode(x, masks, n1, n2)
zero_filled = rel_err(encode_adjoint(d, masks, n1, n2), x)
low, sparse = l_plus_s(d, masks, n1, n2, 0.3, 0.1, 0.9, 40)
rec = [[a + b for a, b in zip(fl, fs)] for fl, fs in zip(low, sparse)]
assert zero_filled > 0.4
assert rel_err(rec, x) < 0.6 * zero_filled
History
Robust PCA, the split of a matrix into a low rank part and a sparse part by the nuclear norm plus the norm, was analyzed by Candès, Li, Ma and Wright and by Chandrasekaran and coauthors around 2009 to 2011. In MRI, low rank models of dynamic data go back to the partial separability model of Liang (2007), and Lingala et al. (2011) combined low rank and sparse penalties on one series in k-t SLR. Otazo, Candès and Sodickson published L+S in Magnetic Resonance in Medicine in 2015. They used it on cardiac perfusion and cine, abdominal and breast contrast scans and angiography, with Cartesian and radial sampling, and they gave a simple iterative soft thresholding algorithm.
References
- Ricardo Otazo, Emmanuel Candès and Daniel K. Sodickson, Low-rank plus sparse matrix decomposition for accelerated dynamic MRI with separation of background and dynamic components, Magnetic Resonance in Medicine 73(3), 2015, 1125 to 1136, Theory, the sections on L+S matrix decomposition and on L+S reconstruction of undersampled dynamic MRI (Table 1) and on the selection of the step size; Methods, image reconstruction (the encoding operator, the transforms and the choice of the weights)
- Emmanuel J. Candès, Xiaodong Li, Yi Ma and John Wright, Robust principal component analysis?, Journal of the ACM 58(3), Article 11, 2011, principal component pursuit and its exact recovery theorem for fully observed matrices (general locator)
- Jian-Feng Cai, Emmanuel J. Candès and Zuowei Shen, A singular value thresholding algorithm for matrix completion, SIAM Journal on Optimization 20(4), 2010, 1956 to 1982, the singular value shrinkage operator as the proximal map of the nuclear norm (general locator)
- Amir Beck and Marc Teboulle, A fast iterative shrinkage-thresholding algorithm for linear inverse problems, SIAM Journal on Imaging Sciences 2(1), 2009, 183 to 202, the O(1/k) rate of proximal gradient with the step 1/Lip and the accelerated method (general locator)
- Patrick L. Combettes and Valérie R. Wajs, Signal recovery by proximal forward-backward splitting, Multiscale Modeling and Simulation 4(4), 2005, 1168 to 1200, convergence of forward-backward splitting for steps below 2/Lip (general locator)
- Sajan Goud Lingala, Yue Hu, Edward DiBella and Mathews Jacob, Accelerated dynamic MRI exploiting sparsity and low-rank structure, k-t SLR, IEEE Transactions on Medical Imaging 30(5), 2011, 1042 to 1054, the joint low rank and sparse penalty on one dynamic series (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag FVJ0PD Edit this page History Report an error Markdown