EquispacedMaskGenerator#

class deepinv.physics.generator.EquispacedMaskGenerator(img_size: Tuple, acceleration: int = 4, center_fraction: float | None = None, rng: Generator | None = None, device='cpu', *args, **kwargs)[source]#

Bases: BaseMaskGenerator

Generator for MRI Cartesian acceleration masks using uniform (equispaced) non-random undersampling with random offset.

Generate a mask of vertical lines for MRI acceleration with fixed sampling in low frequencies (center of k-space) and equispaced undersampling in the high frequencies.

The number of lines selected with equal spacing are at a proportion that reaches the desired acceleration rate taking into consideration the number of low-freq lines, so that the total number of lines is (N / acceleration).

Supports k-t sampling, where the uniform mask is sheared across time.

The mask is repeated across channels and the offset varies randomly across batch dimension. Based off fastMRI code facebookresearch/fastMRI

For parameter descriptions see deepinv.physics.generator.mri.BaseMaskGenerator


Examples:

Equispaced k-t mask generator for a 8x64x64 video:

>>> from deepinv.physics.generator import EquispacedMaskGenerator
>>> generator = EquispacedMaskGenerator((2, 8, 64, 64), acceleration=8, center_fraction=0.04) # C, T, H, W
>>> params = generator.step(batch_size=1)
>>> mask = params["mask"]
>>> mask.shape
torch.Size([1, 2, 8, 64, 64])
sample_mask(mask: Tensor) Tensor[source]#

Given empty mask, sample lines according to child class sampling strategy.

This must be implemented in child classes. Time dimension is specified but can be ignored if needed.

Parameters:

mask (torch.Tensor) – empty mask of shape (B, C, T, H, W)

Return torch.Tensor:

sampled mask of shape (B, C, T, H, W)

Examples using EquispacedMaskGenerator:#

A tour of forward sensing operators

A tour of forward sensing operators