OpenNeuro is the largest open neuroimaging data repository, hosting thousands of BIDS-formatted datasets spanning MRI, EEG, MEG, and more. Accessing these datasets programmatically — searching by modality, downloading specific subjects, managing local caches — typically requires juggling GraphQL queries, S3 URLs, and file-system bookkeeping.
The openneuro package handles all of that so you can
focus on your analysis. With a few function calls you can search the
catalogue, inspect dataset contents, and download exactly the files you
need.
Search the OpenNeuro catalogue. Results come back as a tibble:
#> # A tibble: 10 x 3
#> id name n_subjects
#> <chr> <chr> <int>
#> 1 ds000001 Balloon Analog Risk-taking Task 16
#> 2 ds000002 Classification Learning 17
#> 3 ds000003 Rhyme Judgment 13
#> ...
You can filter by modality:
#> [1] "ds000001" "ds000002" "ds000003" "ds000005" "ds000006" "ds000007"
Inspect a single dataset:
Each dataset has one or more snapshots (versioned releases):
#> # A tibble: 3 x 3
#> tag created size
#> <chr> <chr> <chr>
#> 1 1.0.0 2018-02-02T00:00:00.000Z 2.1 GB
#> ...
List files from the latest snapshot:
#> # A tibble: 6 x 3
#> filename size directory
#> <chr> <chr> <lgl>
#> 1 dataset_description.json 1.2 kB FALSE
#> 2 participants.tsv 800 B FALSE
#> ...
Download specific files to your local cache:
res <- on_download(
id = "ds000001",
files = c("dataset_description.json", "participants.tsv"),
quiet = FALSE
)
resDownload by subject IDs — the package normalises bare numbers and
"sub-" prefixed IDs automatically:
Use a regex to select subjects by pattern:
Many OpenNeuro datasets have community-contributed derivative outputs (e.g. fMRIPrep, MRIQC). You can list them:
Inspect available output spaces for a derivative:
Download derivative outputs for specific subjects and spaces:
vignette("openneuro-fmriprepper-e2e") — a full
end-to-end workflow that downloads an OpenNeuro dataset and processes it
with fMRIPrep via fmriprepper.?on_search, ?on_download,
?on_derivatives — detailed function documentation.