|
Download README.md from medarc/ReadyNeuro: direct link, hf CLI and curl.
- Browser
- Download file 6.19 kB
-
https://huggingface.co/datasets/medarc/ReadyNeuro/resolve/main/README.md
- Command line
-
hf download hf://datasets/medarc/ReadyNeuro/README.md
-
curl -L -o README.md https://huggingface.co/datasets/medarc/ReadyNeuro/resolve/main/README.md
6.19 kB
| license: cc0-1.0 | |
| tags: | |
| - fmri | |
| - neuroscience | |
| - brain | |
| - openneuro | |
| - webdataset | |
| size_categories: | |
| - n<1K | |
| viewer: false | |
| # ReadyNeuro | |
| **This is a 500 GB subset of ReadyNeuro. The full corpus (15.9 TB, 817 studies) is on S3; access | |
| instructions are [below](#full-corpus).** | |
| The subset has one subject from each of 672 OpenNeuro studies: 725 h of BOLD in 5,493 runs. | |
| - Paper: <https://openreview.net/forum?id=rLMKAJCLc1> | |
| - Blog post: <https://sophont.med/blog/native-fmri/> | |
| - Data code: <https://github.com/SophontAI/ReadyNeuro> | |
| - Model code: <https://github.com/SophontAI/CortexMAE-ReadyNeuro> | |
| - Model: [medarc/CortexMAE-ReadyNeuro](https://huggingface.co/medarc/CortexMAE-ReadyNeuro) | |
| ## Contents | |
| - `shards/<accession>__<subject>.tar`: one WebDataset tar per subject, identical to the full | |
| corpus's shard. | |
| - `subset_manifest.tsv`: one row per shard. `bytes` is the tar size, `hours` the stored BOLD | |
| hours, `tr_acq` the acquired TR in seconds (stored at 1 s), and `license` the study's license as | |
| its metadata gives it (`other: pd` is public domain). `age` and `sex` are blank when unknown. | |
| Scans are rigidly aligned to a shared 2 mm grid (MNI152NLin2009cAsym, 97×115×97). Each tar holds: | |
| - a subject sample: T1 (1 mm), BOLD-grid masks and segmentation (`.npy`), and a `.json` with age | |
| (a string) and sex when they are known; | |
| - one sample per BOLD run (`<subject>__func_<task>_<i>`): int8 values at 1 s per frame, per-voxel | |
| mean and std (`.npy`), and a `.json`. | |
| The two sample types have different fields, so `datasets`' WebDataset loader and the viewer don't | |
| apply. | |
| ## Selection | |
| The top 672 subjects of a ranking that spreads picks across studies, tasks, age, sex and TR, and | |
| favors complete metadata and longer recordings. The ranking excludes studies overlapping the | |
| paper's HCP-YA evaluation, subjects stored twice, and studies not licensed CC0, PDDL or public | |
| domain. | |
| ## Use | |
| ```python | |
| from huggingface_hub import snapshot_download | |
| # One 77 MB shard and the manifest; drop allow_patterns to download all 500 GB. | |
| root = snapshot_download( | |
| "medarc/ReadyNeuro", | |
| repo_type="dataset", | |
| allow_patterns=["shards/ds004604__022.tar", "subset_manifest.tsv"], | |
| ) | |
| ``` | |
| To train with the [model code](https://github.com/SophontAI/CortexMAE-ReadyNeuro), set the data config's `urls` to `<root>/shards`. | |
| Validation still reads the `b31` holdout from the full corpus, so also set up the | |
| `openneuro-public` profile ([below](#full-corpus)) or pass `--validation.enabled=false`. | |
| ## Stream samples | |
| Each shard is one subject. Its first sample holds the T1, the tissue masks and the grid | |
| geometry. Every later sample is one BOLD run. Voxels are stored packed: `*_idx.npy` holds flat | |
| C-order indices of the in-brain voxels, and `*_values.npy` holds one row per index. BOLD is | |
| z-scored per voxel within the run, stored as int8 at one frame per second. This reads T1 and BOLD | |
| with `pip install webdataset numpy`: | |
| ```python | |
| import io, json | |
| import numpy as np | |
| import webdataset as wds | |
| def dense(idx, values, shape): | |
| """Scatter packed in-brain rows back onto the grid.""" | |
| out = np.zeros((np.prod(shape), *values.shape[1:]), np.float32) | |
| out[idx] = values | |
| return out.reshape(*shape, *values.shape[1:]) | |
| url = "https://huggingface.co/datasets/medarc/ReadyNeuro/resolve/main/shards/ds004604__022.tar" | |
| # Same shard from the full corpus: "pipe:aws --profile openneuro-public s3 cp s3://openneuro/v1/openneuro-pretrain-shards-v6-b1/train/native/ds004604__022.tar -" | |
| for sample in wds.WebDataset(url, shardshuffle=False): | |
| meta = json.loads(sample["json"]) | |
| arr = lambda name: np.load(io.BytesIO(sample[name])) | |
| if meta["kind"] == "bundle": # first sample of each shard: T1, masks, geometry | |
| bold_idx, bold_shape = arr("bold_idx.npy"), meta["bold_shape"] | |
| bold_affine = arr("bold_affine.npy") # voxel -> world mm | |
| cortex = dense(bold_idx, arr("bold_cortical_gm.npy"), bold_shape) # (97, 115, 97) | |
| t1 = dense(arr("t1_idx.npy"), arr("t1_values.npy") * meta["T1_scale"], meta["T1_shape"]) | |
| else: # one sample per run: z-scored BOLD | |
| z = arr("values.npy") * np.float32(meta["scale"]) # (in-brain voxels, frames) | |
| clip = dense(bold_idx, z[:, :16], bold_shape) # first 16 s as (97, 115, 97, 16) | |
| ``` | |
| The bundle also has `bold_gm`, `bold_seg` (SynthSeg labels) and their `t1_*` counterparts. Each | |
| run has `mean.npy` and `std.npy` (multiply by `mean_scale`/`std_scale`), which undo the z-score. | |
| To find a shard on S3, look up its `batch` in [`openneuro_rebuild_manifest.jsonl.gz`](https://github.com/SophontAI/ReadyNeuro/blob/main/manifests/openneuro_rebuild_manifest.jsonl.gz): | |
| `b0` is the prefix `openneuro-pretrain-shards-v6/`, and `b<N>` is `openneuro-pretrain-shards-v6-b<N>/`. | |
| The full format is in [`tools/codec.py`](https://github.com/SophontAI/ReadyNeuro/blob/main/src/readyneuro/tools/codec.py). | |
| To cut patches for a model without building the dense volume, see | |
| [Tokenize without densifying](https://github.com/SophontAI/CortexMAE-ReadyNeuro#tokenize-without-densifying) | |
| in the model repository. | |
| ## Full corpus | |
| The full corpus is on Cloudflare R2 at `s3://openneuro/v1/`, readable with a public read-only key | |
| (AWS CLI v2.13 or later, no AWS account needed): | |
| ```sh | |
| curl -fsS https://openneuro.sophont.med/clients/aws-setup.sh -o openneuro-aws-setup.sh | |
| sh openneuro-aws-setup.sh | |
| aws --profile openneuro-public s3 ls s3://openneuro/v1/ | |
| ``` | |
| See <https://github.com/SophontAI/ReadyNeuro#get-the-data> for the layout and manifests. | |
| ## License | |
| Released under CC0 1.0. Upstream study licenses: 637 CC0, 34 PDDL, 1 public domain (per study in | |
| `subset_manifest.tsv`). | |
| Please also cite OpenNeuro and the source studies. | |
| ## Citation | |
| ```bibtex | |
| @inproceedings{liu2026scaling, | |
| title = {Scaling {fMRI} Foundation Models with Native-Space Data from Heterogeneous Public Studies}, | |
| author = {Liu, Xujin Chris and Lane, Connor and Muhammad, Hassan and Abraham, Tanishq Mathew and Scotti, Paul Steven}, | |
| booktitle = {NeurIPS 2026 Workshop on Foundation Models for the Brain and Body}, | |
| year = {2026}, | |
| url = {https://openreview.net/forum?id=rLMKAJCLc1} | |
| } | |
| ``` | |
| Contact: paul@sophont.med | |