Load a BIDS Dataset

Load a BIDS Dataset#

Before you can query or modify your data, you need to “load” your dataset available to ancpBIDS.

With the path to your dataset and BIDSLayout() you can create the in-memory graph of it, from where you can easily retrieve information.

from ancpbids.pybids_compat import BIDSLayout
layout = BIDSLayout(dataset_path)

The output (layout object) contains both the loaded dataset and the schema.

Alternative way to load a dataset#

Alternatively, you may also use the function load_dataset() along with path to your dataset to load the dataset.

from ancpbids import load_dataset
dataset = load_dataset(dataset_path)
#print(dataset)
#{'name': 'ds003483'}
from ancpbids import load_dataset, DatasetOptions
dataset = load_dataset(dataset_path, DatasetOptions(ignore=False, infer_artifact_datatype=True))
#print(dataset)
#{'name': 'ds003483'}

Next section#

Now that your dataset is loaded and mapped into a layout, you’re ready to start extracting useful information from it. In the next sections, we’ll show how to: