spyrit.core.recon.DCNet

class spyrit.core.recon.DCNet(acqu: HadamSplit2d, prep: Rescale | RescaleEstim, sigma: tensor, denoi=Identity(), *, device: device = device(type='cpu'))[source]

Bases: _PrebuiltFullNet

A FullNet with a Tikhonov-based reconstruction module.

It simulates noisy measurements

\[y =\mathcal{N}\left(Ax\right),\]

where \(\mathcal{N}\) represents a noise operator (e.g., Poisson), \(A\) is the acquisition matrix, \(x\) is the signal of interest.

It estimates the signal from the noisy measurements in three steps [1]:

  1. Preprocessing of the measurements:

\[\tilde{m} = By,\]

where \(B\) represents a preprocessing step.

  1. Denoised completion:

\[x^{\text{dc}} = R^{\text{dc}}(\Sigma,\Sigma_\alpha,x_0)(\tilde{m}).\]

where the linear reconstruction operator \(R^{\text{dc}}\) depends on the covariance of the noise \(\Sigma_\alpha\), the covariance of the full measurements \(\Sigma\) and the mean of the signal \(x_0\).

Note

We assume that the preprocessed measurements are obtained by subsampling a full transform, i.e., \(BA = GF\) where \(F\) is a “full” (e.g., Hadamard) transform and \(G\) is a subsampling operator. Denoised completion approximates:

\[\arg\min_x \|\tilde{m} - GFx \|^2_{\Sigma^{-1}_\alpha} + \|F(x - x_0)\|^2_{\Sigma^{-1}}.\]

For details, see TikhonovMeasurementPriorDiag and the forward() method.

  1. Denoising/artefact correction

\[\hat{x} = \mathcal{G}_\theta(x^{\text{dc}}),\]

where \(\mathcal{G}_\theta\) is a neural network with learnable parameters \(\theta\).

References:
Args:

acqu: Acquisition operator \(\mathcal{N}\circ A\) (e.g., see HadamSplit2d).

prep: Preprocessing operator \(B\) (see prep).

sigma: Measurement covariance \(\Sigma\) (for details, see TikhonovMeasurementPriorDiag()).

denoi (optional): Image denoising operator (see nnet) \(\mathcal{G}_\theta\). Default Identity.

Attributes:

acqu: Acquisition operator initialized as acqu

acqu_modules (nn.Sequential): Measurement module. Only contains acqu.

prep: Preprocessing operator initialized as prep

tikho: Tikhonov regularization operator initialized as a TikhonovMeasurementPriorDiag operator.

denoi: Image denoising operator initialized as denoi

recon_modules (nn.Sequential): Reconstruction modules. Contains the preprocessing operator, the Tikhonov regularization operator, and the denoising operator.

Input / Output:

input: Ground-truth images with shape \((b,c,h,w)\), with \(b\) being the batch size, \(c\) the number of channels, and \(h\) and \(w\) the height and width of the images.

output: Reconstructed images with shape \((b,c,h,w)\).

Example:
>>> from spyrit.core.meas import HadamSplit2d
>>> from spyrit.core.prep import UnsplitRescale
>>> from spyrit.core.recon import DCNet
>>> import torch
>>> acqu = HadamSplit2d(32)
>>> prep = UnsplitRescale()
>>> sigma = torch.eye(32*32,32*32)
>>> dcnet = DCNet(acqu, prep, sigma)
>>> y = torch.randn(10, 1, 2048)
>>> z = dcnet.reconstruct(y)
>>> print(z.shape)
torch.Size([10, 1, 32, 32])

Methods

acquire(x)

Apply the measurement modules to the input signal.

forward(x)

Apply the full network to the input signal.

reconstruct(y)

Reconstruct an image from measurements.

reconstruct_pinv(y)

Reconstruct an image from measurements without denoising.