spyrit.core.recon.PinvNet

class spyrit.core.recon.PinvNet(noise, prep, denoi=Identity())[source]

Bases: Module

Pseudo inverse reconstruction network

Args:

noise: Acquisition operator (see noise)

prep: Preprocessing operator (see prep)

denoi (optional): Image denoising operator (see nnet). Default Identity

Input / Output:

input: Ground-truth images with shape \((B,C,H,W)\) corresponding to the batch size, number of channels, height, and width.

output: Reconstructed images with shape \((B,C,H,W)\) corresponding to the batch size, number of channels, height, and width.

Attributes:

Acq: Acquisition operator initialized as noise

prep: Preprocessing operator initialized as prep

pinv: Analytical reconstruction operator initialized as PseudoInverse()

Denoi: Image denoising operator initialized as denoi

Example:
>>> B, C, H, M = 10, 1, 64, 64**2
>>> Ord = torch.ones((H,H))
>>> meas = HadamSplit(M, H, Ord)
>>> noise = NoNoise(meas)
>>> prep = SplitPoisson(1.0, M, H*H)
>>> recnet = PinvNet(noise, prep)
>>> x = torch.FloatTensor(B,C,H,H).uniform_(-1, 1)
>>> z = recnet(x)
>>> print(z.shape)
>>> print(torch.linalg.norm(x - z)/torch.linalg.norm(x))
torch.Size([10, 1, 64, 64])
tensor(5.8912e-06)

Methods

acquire(x)

Simulates data acquisition

forward(x)

Full pipeline of reconstrcution network

meas2img(y)

Returns images from raw measurement vectors

reconstruct(x)

Preprocesses, reconstructs, and denoises raw measurement vectors.

reconstruct_expe(x)

Reconstruction step of a reconstruction network

reconstruct_pinv(x)

Preprocesses and reconstructs raw measurement vectors.