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:
_PrebuiltFullNetA
FullNetwith 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]:
Preprocessing of the measurements:
\[\tilde{m} = By,\]where \(B\) represents a preprocessing step.
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
TikhonovMeasurementPriorDiagand theforward()method.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., seeHadamSplit2d).prep: Preprocessing operator \(B\) (seeprep).sigma: Measurement covariance \(\Sigma\) (for details, seeTikhonovMeasurementPriorDiag()).denoi(optional): Image denoising operator (seennet) \(\mathcal{G}_\theta\). DefaultIdentity.- Attributes:
acqu: Acquisition operator initialized asacquacqu_modules(nn.Sequential): Measurement module. Only containsacqu.prep: Preprocessing operator initialized aspreptikho: Tikhonov regularization operator initialized as aTikhonovMeasurementPriorDiagoperator.denoi: Image denoising operator initialized asdenoirecon_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 an image from measurements without denoising.