MRIMixin#

class deepinv.physics.MRIMixin[source]#

Bases: object

Mixin base class for MRI functionality.

Base class that provides helper functions for FFT and mask checking.

check_mask(mask: Tensor | None = None, three_d: bool = False, device: str = 'cpu', **kwargs) None[source]#

Updates MRI mask and verifies mask shape to be B,C,…,H,W where C=2.

Parameters:
  • mask (torch.nn.Parameter, torch.Tensor) – MRI subsampling mask.

  • three_d (bool) – If False the mask should be min 4 dimensions (B, C, H, W) for 2D data, otherwise if True the mask should have 5 dimensions (B, C, D, H, W) for 3D data.

  • device (torch.device, str) – mask intended device.

static fft(x: Tensor, dim=(-2, -1), norm='ortho')[source]#

Centered, orthogonal fft

Parameters:
  • x (torch.Tensor) – input image of complex dtype of shape [B,…] where … is all dims to be transformed

  • dim (tuple) – fft transform dims, defaults to (-2, -1)

  • norm (str) – fft norm, see docs for torch.fft.fftn(), defaults to “ortho”

static from_torch_complex(x: Tensor)[source]#

[B,…,H,W] complex -> [B,2,…,H,W] real

static ifft(x: Tensor, dim=(-2, -1), norm='ortho')[source]#

Centered, orthogonal ifft

Parameters:
  • x (torch.Tensor) – input kspace of complex dtype of shape [B,…] where … is all dims to be transformed

  • dim (tuple) – fft transform dims, defaults to (-2, -1)

  • norm (str) – fft norm, see docs for torch.fft.fftn(), defaults to “ortho”

static to_torch_complex(x: Tensor)[source]#

[B,2,…,H,W] real -> [B,…,H,W] complex

Examples using MRIMixin:#

A tour of forward sensing operators

A tour of forward sensing operators

Self-supervised MRI reconstruction with Artifact2Artifact

Self-supervised MRI reconstruction with Artifact2Artifact

Self-supervised learning with Equivariant Imaging for MRI.

Self-supervised learning with Equivariant Imaging for MRI.