SPM/BIDS

= Brain Imaging Data Structure =

The Brain Imaging Data Structure (BIDS) is a simple and intuitive way to organise and describe neuroimaging and behavioural data.

Standard specification

 * Current release
 * Current draft

Validator

 * BIDS Validator: online or from the command line.

Discussion Forums

 * Google Groups
 * NeuroStars

Tutorials

 * BIDS Examples
 * BIDS Starter Kit

Publications
The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments. Gorgolewski K.J., Auer T., Calhoun V.D., Craddock R.C., Das S., Duff E.P., Flandin G., Ghosh S.S., Glatard T., Halchenko Y.O., Handwerker D.A., Hanke M., Keator D., Li X., Michael Z., Maumet C., Nichols B.N., Nichols T.E., Pellman J., Poline J.-B., Rokem A., Schaefer G., Sochat V., Triplett W., Turner J.A., Varoquaux G. & Poldrack R.A. Scientific Data 3, 160044 (2016).

BIDS apps: Improving ease of use, accessibility, and reproducibility of neuroimaging data analysis methods. Gorgolewski K.J., Alfaro-Almagro F., Auer T., Bellec P., Capota M., Chakravarty M.M., Churchill N.W., Cohen A.L., Craddock R.C., Devenyi G.A., Eklund A., Esteban O., Flandin G., Ghosh S.S., Guntupalli J.S., Jenkinson M., Keshavan A., Kiar G., Liem F., Raamana P.R., Raffelt D., Steele C.J., Quirion P.-O., Smith R.E., Strother S.C., Varoquaux G., Wang Y., Yarkoni T. & Poldrack R.A. PLoS Computational Biology 13(3):e1005209 (2017).

MEG-BIDS, the brain imaging data structure extended to magnetoencephalography. Niso G., Gorgolewski K.J., Bock E., Brooks T.L., Flandin G., Gramfort A., Henson R.N., Jas M., Litvak V., Moreau J.T., Oostenveld R., Schoffelen J.-M., Tadel F., Wexler J. & Baillet S. Scientific Data 5, 180110 (2018).

EEG-BIDS, an extension to the brain imaging data structure for electroencephalography. Pernet C.R., Appelhoff S., Gorgolewski K.J., Flandin G., Phillips C., Delorme A. & Oostenveld R. Scientific Data 6, 103 (2019).

BIDS Tools in SPM/MATLAB
SPM provides a number of functionalities (MATLAB/Octave functions) to facilitate the creation or use of datasets formatted according to BIDS.

JSON files
A JSON file can be read/written using  and.

These functions are also independently available in JSONio, a JSON library for MATLAB and Octave. They are compatible with MATLAB's jsonencode and jsondecode.

TSV files
A tab-separated values (TSV) file can be read/written using  and.

These functions are compatible with MATLAB table array and handle gzip compression transparently.

NIfTI files
NIfTI files can be read/written using  or.

By default, SPM does not support compressed NIfTI files but MATLAB/Octave provide gzip/gunzip functions if needed and they are also available through the batch interface from.

BIDS parser and queries
A data directory organised according to BIDS can be parsed with.

Here is an example using the ds007 dataset:

Formatting datasets into BIDS
Helper functions  and   might come handy, as well as previously mentionned   and.

For example, the following piece of code using :

creates this directory hierarchy:

while  makes it easier to copy files and their attached metadata (e.g. sidecar JSON files) with compression on the fly.

See also these options in the batch interface: matlabbatch{1}.spm.util.import.dicom.convopts.meta = true; matlabbatch{1}.spm.util.cat.RT = TR;
 * The  batch module has an option to create metadata sidecar JSON files:
 * The  batch module has an option to store the TR in the NIfTI header: