MyBids is a comprehensive toolkit and example repository for working with neuroimaging data in the Brain Imaging Data Structure (BIDS) format. It bundles a demonstration BIDS dataset together with command‑line utilities and pipeline scripts so you can convert raw DICOM files, organize data, and run end‑to‑end analyses — all from a single, unified environment. There are two main components:
- MyBidsApp – a collection of Python packages providing command line tools
for BIDS data (
bidscomatic-cli,dicomatic-cli,cbrain-cli, and thebidsumbrella). These packages live incode/MyBidsApp/. See the detailed MyBidsApp README for installation and usage instructions for each tool. - Shell scripts – helper scripts for preprocessing and analysing neuroimaging
data with FSL, FreeSurfer and related utilities. Scripts reside in
code/scripts/and work with the BIDS dataset stored at the repository root. See the Shell Scripts README for usage details.
| Category | Description |
|---|---|
| DICOM → BIDS Conversion | bidscomatic-cli delivers end-to-end DICOM study orchestration — extraction, conversion, curation, preprocessing, QC & validation — so raw scans land in a polished, BIDS-compliant layout. |
| DICOM Archive Querying | dicomatic-cli connects to PACS/XNAT archives, letting you search and download series by patient, study, or accession number. |
| CBRAIN Pipeline Launcher | cbrain-cli submits and monitors jobs on the CBRAIN HPC platform (e.g. HippUnfold), handles upload/download, and writes outputs back into derivatives/ following BIDS. |
| Unified Command Hub | A single bids umbrella command re‑exports the three tools above, providing bids bidscomatic …, bids dicomatic …, and bids cbrain … for shell‑completion convenience. |
| fMRI Processing Scripts | Bash helpers under code/scripts/ run local preprocessing (skull‑stripping, TOPUP, ICA‑AROMA) and FSL FEAT first‑, second‑, and third‑level stats. |
| Project Initialisation | init_bids_project.sh spins up a clean project folder, virtual environment, and dataset_description.json skeleton in one command. |
| Templates & Configs | Ready‑made FEAT design files (design_files/) and YAML configs (config/) offer sensible defaults you can tweak. |
Uploads from the derivatives/ tree behave like regular BIDS uploads—the leading
derivatives/ component is stripped so files appear alongside the rest of the
dataset on the remote SFTP server.
- Python ≥ 3.9 — CLI tools (packaged in MyBidsApp)
- Bash — helper scripts (macOS 12+, Ubuntu 22.04, or WSL 2)
- BIDS Validator (Node.js) — compliance checking
- dcm2niix — DICOM ➜ NIfTI conversion
- FSL (BET, TOPUP, FEAT, fslmaths, etc.)
- FreeSurfer (SynthStrip optional skull‑strip)
- ICA‑AROMA — motion artefact removal (Docker image supplied)
- Docker — optional containerised pipelines
- CBRAIN — external HPC processing
- PACS / XNAT — remote DICOM archives
git clone https://github.com/rgabiazo/MyBids.git
cd MyBidspython -m venv .venv
source .venv/bin/activateChoose one of the following setups:
./code/MyBidsApp/dev_install.sh # installs umbrella `bids` commandVerify:
bids --version
bids --helpNeed only one sub‑tool? Install it in editable mode, e.g.:
pip install -e code/bidscomaticNote: FSL, Node.js (for the validator), and other externals must already be on your $PATH.
./code/MyBidsApp/init_bids_project.sh --name "My Study" --author "Alice Example"The helper renames the folder, creates .venv with all tools installed and
writes dataset_description.json before dropping you into an activated shell.
The bids umbrella command exposes three sub‑commands, all of which accept --help:
| Command | Purpose |
|---|---|
bids bidscomatic <dicom_src> <bids_dst> |
Run the end-to-end DICOM orchestration toolkit to extract, convert, curate, preprocess, QC and validate a study into BIDS. |
bids dicomatic fetch --patient-id <ID> --series "<pattern>" <outdir> |
Query & download from PACS/XNAT. |
bids cbrain --launch-tool hippunfold … |
Submit CBRAIN jobs and retrieve outputs (e.g. HippUnfold or fMRIPrep). |
# 1 Pull DICOM series by Study UID
bids dicomatic fetch --study-uid <UID> ./scratch/dicoms
# 2 Convert to BIDS format
bids bidscomatic ./scratch/dicoms /data/MyStudy
# 3 Launch HippUnfold on CBRAIN for subject sub-001
bids cbrain-cli \
--launch-tool hippunfold \
--tool-param modality=T1w \
--launch-tool-batch-group MyStudy \
--launch-tool-batch-type BidsSubject \
--launch-tool-bourreau-id 56 \
--launch-tool-results-dp-id 51
# 4 Download the derivatives
bids cbrain --download-tool hippunfold --group-id MyStudy --flatten# Preprocess fMRI
./code/scripts/fmri_preprocessing.sh
# First‑level stats
./code/scripts/feat_first_level_analysis.sh
# Second‑ & third‑level group stats
./code/scripts/second_level_analysis.sh
./code/scripts/third_level_analysis.shAll scripts display a usage prompt when run without arguments.
Pull requests are welcome! Please file an issue first for major changes. Ensure any new dependencies are documented and that pipelines still produce BIDS‑valid output.
This project is released under the MIT License. See LICENSE for details.
If you use MyBids or the bundled scripts, please cite the original tool authors. Key references include:
- DeepPrep — Ren J et al. Nat Methods 22(3), 473–476 (2025)
- SynthStrip — Hoopes A et al. NeuroImage 260, 119474 (2022)
- HippUnfold — de Kraker L et al. eLife 11, e77945 (2022)
- fMRIPrep — Esteban O et al. Nat Methods 16(1), 111–116 (2019)
- Boutiques — Glatard T et al. GigaScience 7(5), giy016 (2018)
- BIDS — Gorgolewski KJ et al. Sci Data 3, 160044 (2016)
- dcm2niix — Li X et al. Front. Neuroinform. 10, 30 (2016)
- ICA-AROMA — Pruim RHR et al. NeuroImage 112, 267–277 (2015)
- CBRAIN — Sherif T et al. Front. Neuroinform. 8, 54 (2014)
- FSL — Jenkinson M et al. NeuroImage 62(2), 782–790 (2012)
- FreeSurfer — Fischl B. NeuroImage 62(2), 774–781 (2012)
Special thanks to Dr. Lindsay Nagamatsu and the Exercise, Mobility, and Brain Health Lab at Western University for their feedback and computing resources.