clinicaio.dataset.BIDSDataset#

class clinicaio.dataset.BIDSDataset(bids_path: str | pathlib.Path, description: clinicaio.dataset_description.BIDSDatasetDescription)#

A BIDS dataset. See the general organisation of the library.

Examples

Creates a new BIDS dataset. Useful when you want to write a new dataset to the filesystem.

Parameters:
bids_path: pathlib.Path#
description: clinicaio.dataset_description.BIDSDatasetDescription#

Methods#

subject_by_id(→ Optional[clinicaio.subject.Subject])

Retrieves from this dataset the given subject by its ID.

all_subjects(→ Iterable[clinicaio.subject.Subject])

Retrieves all the subjects that are part of this dataset.

subjects_count(→ int)

Retrieves the number of subjects that are part of this dataset.

all_sessions(→ Iterable[clinicaio.session.Session])

Retrieves all the sessions that this dataset's subjects are part of.

all_images(→ Iterable[clinicaio.image.Image])

Retrieves all the images present in this dataset.

populate_subjects_info_from_df(→ None)

Populates the subjects information from the given dataframe.

populate_from_dir(→ BIDSDataset)

Read a BIDS dataset from the given BIDS directory.

add_subject(→ clinicaio.subject.Subject)

Adds a new subject to this dataset.

write_to_folder(→ None)

Creates the dataset folder, writes the dataset description JSON and readme, creates the subjects and sessions

write_root_file(→ IO[Any])

Creates and opens for writing the given file at the root of the dataset, eventually in "binary" mode

query_images(→ Iterable[clinicaio.image.Image])

Returns all the images matching the query.

query_images_nifti_paths(→ Iterable[pathlib.Path])

Convenience function that only returns the NIFTI image paths instead of the images themselves.

query_images_companions_paths(→ Iterable[pathlib.Path])

Convenience function that only returns the companion image paths with the given file extension