Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.
brainprep.datasets.openms.OpenMSDataset¶
- class brainprep.datasets.openms.OpenMSDataset(datadir)[source]¶
Bases:
objectOpen Multiple Sclerosis (OpenMS) anatomical dataset.
This dataset [1] contains Magnetic Resonance (MR) images of Multiple Sclerosis (MS) patients with corresponding ground truth segmentations of white matter lesion changes.
- Parameters:
- datadirDirectory
Directory where data will be stored.
- Attributes:
- _urlstr
Internal URL used to fetch data.
References
Examples
>>> from brainprep.config import Config >>> from pathlib import Path >>> from brainprep.datasets import OpenMSDataset >>> >>> datadir = Path("/tmp/brainprep-data") >>> datadir.mkdir(parents=True, exist_ok=True) >>> dataset = OpenMSDataset(datadir) >>> with Config(verbose=False): ... data = dataset.fetch( ... subject="01", ... modality="T1w", ... dtype="cross_sectional", ... ) >>> data Bunch( description: PosixPath('...') anat: PosixPath('...') )
- fetch(subject, modality, dtype='cross_sectional')[source]¶
Fetch data.
- Parameters:
- subjectstr
the subject identifier. This identifier must lie in [‘01’ - ‘30’], [‘01’ - ‘20’], for cross sectional or longitudinal data respectively.
- modalitystr
the modality to be fetched: ‘T1w’, ‘T2w’ or ‘FLAIR’.
- dtypestr
the type of data to download: ‘cross_sectional’ or ‘longitudinal’. Default ‘cross_sectional’.
- Returns:
- datasetBunch
the fetched data path. Keys are either ‘sub-{subject}’ or ‘sub-{subject}_ses-{timepoint}’ for cross sectional and longitudinal data, respectively. A ‘description’ entry is also available.
- sanity_check(subject, modality, dtype='cross_sectional')[source]¶
Check that the fetch parameters are correct.
- Parameters:
- subjectstr
the subject identifier. This identifier must lie in [‘01’ - ‘30’], [‘01’ - ‘20’], for cross sectional or longitudinal data respectively.
- modalitystr
the modality to be fetched: ‘T1w’, ‘T2w’ or ‘FLAIR’.
- dtypestr
the type of data to download: ‘cross_sectional’ or ‘longitudinal’. Default ‘cross_sectional’
- Raises:
- ValueError
If the fetch input parameters are not correct.