clinicadl.data.datasets.examples.BidsDLBSSmall

class clinicadl.data.datasets.examples.BidsDLBSSmall(pet: bool = False, transforms: ~clinicadl.transforms.handlers.transforms.TransformsHandler = <clinicadl.transforms.handlers.transforms.TransformsHandler object>, columns: ~typing.Sequence[str] | dict[str, ~typing.Callable[[~pandas.core.series.Series], ~pandas.core.series.Series] | None] | None = None)[source]

A small version of BidsDLBS.

The dataset is composed of 10 subjects, with 3 sessions per subject. Image resolution is 2mm isotropic for T1 images, but not uniform across the dataset for PET images.

Parameters:
  • pet (bool) –

    Whether to load PET data. Otherwise T1w data will be loaded.

    Note

    PET data being much lighter than T1 data, loading time is faster.

  • transforms (TransformsHandler, default=TransformsHandler()) – Transformation pipeline to apply to the data after loading. The user also specifies here whether to work on images, patches, or slices. See clinicadl.transforms.TransformsHandler.

  • columns (Optional[ColumnsType], default=None) –

    Columns to get in the metadata DataFrame and to put in the output Sample.

    Can be passed via:

    • a list of strings (e.g. ["col1", "col2"]), corresponding to the names of the columns (among Sex, AgeMRI, AgePETAmy and HandednessScore);

    • or a dictionary (e.g. {"col1": <function>, "col2": None}), where the keys are the names of the columns, and the values are functions to apply to the columns. If the function is None, no function will be applied to the column.

    Note

    The potential functions applied to the columns are applied to the whole column. They must take as input a pandas.Series, and return a pandas.Series. For example, it is useful to convert string labels to integer labels for classification.

Examples

>>> from clinicadl.data.datasets.examples import BidsDLBSSmall
>>> bids = BidsDLBSSmall(pet=False, columns=["AgeMRI"])
>>> len(bids)
30
>>> bids[0].image_path
(PosixPath('..cache/clinicadl/bids/BidsDLBSSmall/sub-1003/ses-wave1/anat/sub-1003_ses-wave1_acq-MPRAGE_run-1_T1w.nii.gz'),)
>>> bids = BidsDLBSSmall(pet=True, columns=["AgePETAmy"])
>>> len(bids)
24
>>> bids[0].image_path
(PosixPath('..cache/clinicadl/bids/BidsDLBSSmall/sub-1003/ses-wave1/pet/sub-1003_ses-wave1_trc-18FAV45_run-1_pet.nii.gz'),)
property download_url: str

The URL where the dataset can be downloaded.

property dir: Path

The directory where the dataset is saved.