Converts a fetched OpenNeuro dataset handle into a bidser bids_project
object, enabling BIDS-aware data access to subjects, sessions, files,
and derivatives.
Arguments
- handle
An
openneuro_handleobject, typically created withon_handle()and fetched withon_fetch(). If the handle is in "pending" state, it will be automatically fetched first.- fmriprep
Logical. If
TRUE, include fMRIPrep derivatives from the defaultderivatives/fmripreppath. Ignored ifprep_diris specified. Default isFALSE.- prep_dir
Character. Path to derivatives directory relative to the dataset root. If specified, takes precedence over
fmriprep. Default is"derivatives/fmriprep".
Details
This function provides a bridge between OpenNeuro's download system
and bidser's BIDS-aware data structures. The resulting bids_project
object exposes:
Subject and session information
BIDS file listings by modality
Derivatives access (if available)
The bidser package is required but listed as an optional dependency (Suggests). If not installed, a helpful message guides installation.
Derivatives Handling
When fmriprep = TRUE, the function looks for derivatives at
derivatives/fmriprep within the dataset. You can specify a custom
derivatives path with prep_dir.
If prep_dir is set to a non-default value, it takes precedence over
fmriprep = TRUE. A warning is issued if the requested derivatives
path does not exist.
See also
on_handle() to create a handle, on_fetch() to download data.
Examples
if (FALSE) { # \dontrun{
# Basic usage
handle <- on_handle("ds000001")
handle <- on_fetch(handle)
bids <- on_bids(handle)
# Auto-fetch if needed
handle <- on_handle("ds000002")
bids <- on_bids(handle) # Fetches automatically
# Include fMRIPrep derivatives
bids <- on_bids(handle, fmriprep = TRUE)
# Custom derivatives path
bids <- on_bids(handle, prep_dir = "derivatives/custom-pipeline")
} # }