clinicadl.data.datasets.examples.BidsStroke¶
- class clinicadl.data.datasets.examples.BidsStroke(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, masks: bool = True)[source]¶
A
BidsDatasetdataset with T1w images of left hemisphere chronic stroke survivors together with the lesion masks. Adapted from Precise vs. Approximate Numeracy in Stroke Participants.The dataset is composed of 50 subjects, with a single session per subject. Image resolution is 1mm isotropic.
- Parameters:
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 (see here the columns available);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.masks (bool, default=True) – Whether to load the lesion masks along with the images. If
True, it will be accessible via the key"lesion_mask".
Examples
>>> from clinicadl.data.datasets.examples import BidsStroke >>> bids = BidsStroke(columns=["age"], masks=True) >>> len(bids) 50 >>> bids[0] Sample(Keys: ('lesion_mask', 'age', 'file_type', 'image_path', 'sample_type', 'sample_position', 'image', 'participant_id', 'session_id'); images: 2) >>> bids[0].spacing (1.0, 1.0, 1.0)