clinicadl.data.datasets.examples.CapsDLBS

class clinicadl.data.datasets.examples.CapsDLBS(pet: bool = False, cropped: bool = True, 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 CAPS version of BidsDLBS.

T1 images have been processed with Clinica’s t1-linear pipeline and PET images with the pet-linear pipeline.

The dataset is composed of 5 subjects, with a single session per subject. Image resolution is 1mm isotropic for all images.

Parameters:
  • pet (bool) – Whether to load PET data. Otherwise T1w data will be loaded.

  • cropped (bool, default=True) – Whether to use cropped images returned by Clinica’s t1-linear (169×208×179). Only relevant if pet=False.

  • 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 CapsDLBS
>>> caps = CapsDLBS(pet=False, cropped=True, columns=["AgeMRI"])
>>> len(caps)
5
>>> caps[0].image_path
(PosixPath('..cache/clinicadl/bids/CapsDLBS/subjects/sub-1003/ses-wave1/t1_linear/sub-1003_ses-wave1_acq-MPRAGE_run-1_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_T1w.nii.gz'),)
>>> caps[0].spatial_shape
(169, 208, 179)
>>> caps = CapsDLBS(pet=False, cropped=False, columns=["AgeMRI"])
>>> caps[0].spatial_shape
(193, 229, 193)
>>> caps = CapsDLBS(pet=True, columns=["AgePETAmy"])
>>> caps[0].image_path
(PosixPath('..cache/clinicadl/bids/CapsDLBS/subjects/sub-1003/ses-wave1/pet_linear/sub-1003_ses-wave1_trc-18FAV45_run-1_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-cerebellumPons2_pet.nii.gz'),)
>>> caps[0].spatial_shape
(169, 208, 179)
property download_url: str

The URL where the dataset can be downloaded.

property dir: Path

The directory where the dataset is saved.