SimpleFastMRISliceDataset#

class deepinv.datasets.SimpleFastMRISliceDataset(root_dir: str | Path, anatomy: str = 'knee', file_name: str | Path | None = None, train: bool = True, sample_index: int | None = None, train_percent: float = 1.0, transform: Callable | None = None, download: bool = False)[source]#

Bases: Dataset

Simple FastMRI image dataset.

Loads in-memory a saved and processed subset of 2D slices from the full FastMRI slice dataset for quick loading.

Important

By using this dataset, you confirm that you have agreed to and signed the FastMRI data use agreement.

These datasets are generated using deepinv.datasets.fastmri.FastMRISliceDataset.save_simple_dataset(). You can use this to generate your own custom dataset and load using the file_name argument.

We provide a pregenerated mini saved subset for singlecoil FastMRI knees (total 2 images) and RSS reconstructions of multicoil brains (total 2 images). These originate from their respective fully-sampled volumes converted to images via root-sum-of-square (RSS). Each slice is the middle slice from one independent volume. The images are of shape (2x320x320) and are normalised per-sample (0-1) and padded. Download the dataset using download=True, and load them using the anatomy argument.

Note

Since images are obtained from RSS, the imaginary part of each sample is 0.


Examples:

Load mini demo knee dataset:

>>> from deepinv.datasets import SimpleFastMRISliceDataset
>>> from deepinv.utils import get_data_home
>>> dataset = SimpleFastMRISliceDataset(get_data_home(), anatomy="knee", download=True)
>>> len(dataset)
2
Parameters:
  • root_dir (str, Path) – dataset root directory

  • anatomy (str) – load either fastmri “knee” or “brain” slice datasets.

  • file_name (str, Path) – optional, name of local dataset to load, overrides anatomy. If None, load dataset based on anatomy parameter.

  • train (bool) – whether to use training set or test set, defaults to True

  • sample_index (int) – if specified only load this sample, defaults to None

  • train_percent (float) – percentage train for train/test split, defaults to 1.

  • transform (callable) – optional transform for images, defaults to None

  • download (bool) – If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. Default at False.

Examples using SimpleFastMRISliceDataset:#

Tour of MRI functionality in DeepInverse

Tour of MRI functionality in DeepInverse

Self-supervised learning with Equivariant Imaging for MRI.

Self-supervised learning with Equivariant Imaging for MRI.

Self-supervised MRI reconstruction with Artifact2Artifact

Self-supervised MRI reconstruction with Artifact2Artifact