clinicadl.data.datasets.examples.BidsDLBS¶
- class clinicadl.data.datasets.examples.BidsDLBS(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 longitudinal
BidsDatasetdataset with T1w or PET images. Adapted from The Dallas Lifespan Brain Study.The dataset is composed of 30 subjects, with up to 3 sessions per subject. Image resolution is 1mm 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 (amongSex,AgeMRI,AgePETAmyandHandednessScore);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 isNone, 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 apandas.Series. For example, it is useful to convert string labels to integer labels for classification.
Examples
>>> from clinicadl.data.datasets.examples import BidsDLBS >>> bids = BidsDLBS(pet=False, columns=["AgeMRI"]) >>> len(bids) 66 >>> bids[0].image_path (PosixPath('..cache/clinicadl/bids/BidsDLBS/sub-1003/ses-wave1/anat/sub-1003_ses-wave1_acq-MPRAGE_run-1_T1w.nii.gz'),)
>>> bids = BidsDLBS(pet=True, columns=["AgePETAmy"]) >>> len(bids) 61 >>> bids[0].image_path (PosixPath('..cache/clinicadl/bids/BidsDLBS/sub-1003/ses-wave1/pet/sub-1003_ses-wave1_trc-18FAV45_run-1_pet.nii.gz'),)