Home

Awesome

<!-- markdown-link-check-disable --> <!-- .. only:: html -->

tests_matlab tests_octave Binder pre-commit.ci status miss hit View bids-matlab on File Exchange DOI All Contributors

<!-- markdown-link-check-enable -->

BIDS for MATLAB / Octave

This repository aims at centralising MATLAB/Octave tools to interact with BIDS (Brain Imaging Data Structure) datasets.

For more information about BIDS, visit https://bids.neuroimaging.io/.

See also PyBIDS for Python and the BIDS Starter Kit.

Installation

Requirements

BIDS-MATLAB works with:

We aim for compatibility with the latest stable release of Octave at any time. Compatibility can sometimes also be achieved with older versions of Octave but this is not guaranteed.

For MacOS and Unix system, using bids.copy_to_derivative requires a version of gunzip >= 1.6.

Download or clone

Download, unzip this repository and add its content to the MATLAB/Octave path.

unzip('https://github.com/bids-standard/bids-matlab/archive/main.zip');
addpath('bids-matlab-main');

Or clone it with git:

git clone https://github.com/bids-standard/bids-matlab.git

and then add it to your MATLAB/Octave path.

addpath('bids-matlab');

Get the latest features

Stable versions should be fetched from a specific version tag or from the Mathworkds file exchange.

A new version of BIDS matlab should be released for each new version of the BIDS specification to allow for a support of new BIDS datatypes or features.

If you want the latest features of bids-matlab that are in development are in our main branch.

To access them you can either download the main branch from there: https://github.com/bids-standard/bids-matlab/tree/main

Or clone it:

git clone --branch main https://github.com/bids-standard/bids-matlab.git

Features

What this toolbox can do

The behavior of this toolbox assumes that it is interacting with a valid BIDS dataset that should have been validated using BIDS-validator. If the Node.js version of the validator is installed on your computer, you can call it from the matlab prompt using bids.validate. Just be aware that any unvalidated components may produce undefined behavior. Although, if you're BIDS-y enough, the behavior may be predictable.

What this toolbox cannot do... yet

What will this toolbox most likely never do

Usage

BIDS matlab is structured as package, so you can easily access functions in subfolders that start with +.

To use the +bids/layout.m function:

BIDS = bids.layout('/home/data/ds000117');
bids.query(BIDS, 'subjects')

To use the +bids/+util/jsondecode.m function:

content = bids.util.jsondecode('/home/data/some_json_file.json');

Demos

There are demos and tutorials showing some of the features in the demos folder.

Reading and writing JSON files

Make sure to be familiar with the JSON 101.

Note some of the perks of working with JSON files described on the BIDS starterkit.

For BIDS-MATLAB, if you are using MATLAB R2016b or newer, nothing else needs to be installed.

If you are using MATLAB R2016a or older, or using Octave, you need to install a supported JSON library for your MATLAB or Octave. This can be any of:

Get in touch

To contact us:

Other tools (MATLAB only)

How to cite

To credit BIDS-Matlab in your work, please cite the Zenodo archive, which points to a permanent record of all BIDS-Matlab versions. We encourage you to mention the specific version you used.

@software{Gau_bids-matlab,
author = {Gau, Rémi and Flandin, Guillaume and Janke, Andrew and Duval, Tanguy and Oostenveld, Robert and Madan, Christopher and Niso, Guiomar and Szczepanik, Michał and Mutsaerts, Henk and Beliy, Nikita and Norgaard, Martin and Pernet, Cyril and Chrisophe, Phillips and Shahzad, Iqra and  Botvinik-Nezer, Rotem and Barilari, Marco and Battal, Ceren and MacLean, Michèle and Caron-Guyon, Jeanne},
license = {MIT},
title = {{bids-matlab}},
url = {https://github.com/bids-standard/bids-matlab},
doi = https://doi.org/10.5281/zenodo.3363985
}

Contributing

If you want to contribute make sure to check our contributing guidelines.

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/gllmflndn"><img src="https://avatars0.githubusercontent.com/u/5950855?v=4?s=100" width="100px;" alt="Guillaume"/><br /><sub><b>Guillaume</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=gllmflndn" title="Code">πŸ’»</a> <a href="#design-gllmflndn" title="Design">🎨</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=gllmflndn" title="Documentation">πŸ“–</a> <a href="#example-gllmflndn" title="Examples">πŸ’‘</a> <a href="#ideas-gllmflndn" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="#infra-gllmflndn" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="#maintenance-gllmflndn" title="Maintenance">🚧</a> <a href="#question-gllmflndn" title="Answering Questions">πŸ’¬</a> <a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Agllmflndn" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=gllmflndn" title="Tests">⚠️</a></td> <td align="center" valign="top" width="14.28%"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4?s=100" width="100px;" alt="Remi Gau"/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=Remi-Gau" title="Code">πŸ’»</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=Remi-Gau" title="Documentation">πŸ“–</a> <a href="#example-Remi-Gau" title="Examples">πŸ’‘</a> <a href="#ideas-Remi-Gau" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a> <a href="#question-Remi-Gau" title="Answering Questions">πŸ’¬</a> <a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3ARemi-Gau" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=Remi-Gau" title="Tests">⚠️</a></td> <td align="center" valign="top" width="14.28%"><a href="http://apjanke.net"><img src="https://avatars2.githubusercontent.com/u/2618447?v=4?s=100" width="100px;" alt="Andrew Janke"/><br /><sub><b>Andrew Janke</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=apjanke" title="Code">πŸ’»</a> <a href="#design-apjanke" title="Design">🎨</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=apjanke" title="Documentation">πŸ“–</a> <a href="#ideas-apjanke" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Aapjanke" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#infra-apjanke" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/tanguyduval"><img src="https://avatars1.githubusercontent.com/u/7785316?v=4?s=100" width="100px;" alt="tanguyduval"/><br /><sub><b>tanguyduval</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=tanguyduval" title="Code">πŸ’»</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=tanguyduval" title="Documentation">πŸ“–</a> <a href="#ideas-tanguyduval" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/robertoostenveld"><img src="https://avatars1.githubusercontent.com/u/899043?v=4?s=100" width="100px;" alt="Robert Oostenveld"/><br /><sub><b>Robert Oostenveld</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=robertoostenveld" title="Code">πŸ’»</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=robertoostenveld" title="Documentation">πŸ“–</a> <a href="#ideas-robertoostenveld" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Arobertoostenveld" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.cmadan.com"><img src="https://avatars0.githubusercontent.com/u/6385051?v=4?s=100" width="100px;" alt="Christopher Madan"/><br /><sub><b>Christopher Madan</b></sub></a><br /><a href="#content-cMadan" title="Content">πŸ–‹</a></td> <td align="center" valign="top" width="14.28%"><a href="http://guiomarniso.com"><img src="https://avatars1.githubusercontent.com/u/4451818?v=4?s=100" width="100px;" alt="Julia Guiomar Niso GalΓ‘n"/><br /><sub><b>Julia Guiomar Niso GalΓ‘n</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Aguiomar" title="Reviewed Pull Requests">πŸ‘€</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/mslw"><img src="https://avatars1.githubusercontent.com/u/11985212?v=4?s=100" width="100px;" alt="MichaΕ‚ Szczepanik"/><br /><sub><b>MichaΕ‚ Szczepanik</b></sub></a><br /><a href="#infra-mslw" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="#ideas-mslw" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/bids-standard/bids-matlab/commits?author=mslw" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.ExploreASL.org"><img src="https://avatars.githubusercontent.com/u/27774254?v=4?s=100" width="100px;" alt="Henk Mutsaerts"/><br /><sub><b>Henk Mutsaerts</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=HenkMutsaerts" title="Code">πŸ’»</a> <a href="#ideas-HenkMutsaerts" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/nbeliy"><img src="https://avatars.githubusercontent.com/u/44231332?v=4?s=100" width="100px;" alt="Nikita Beliy"/><br /><sub><b>Nikita Beliy</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=nbeliy" title="Code">πŸ’»</a> <a href="#ideas-nbeliy" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Anbeliy" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://profiles.stanford.edu/martin-noergaard"><img src="https://avatars.githubusercontent.com/u/12412821?v=4?s=100" width="100px;" alt="Martin Norgaard"/><br /><sub><b>Martin Norgaard</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3Amnoergaard" title="Bug reports">πŸ›</a> <a href="#ideas-mnoergaard" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://cpernet.github.io/"><img src="https://avatars.githubusercontent.com/u/4772878?v=4?s=100" width="100px;" alt="Cyril Pernet"/><br /><sub><b>Cyril Pernet</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/commits?author=CPernet" title="Code">πŸ’»</a> <a href="#ideas-CPernet" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.giga.uliege.be"><img src="https://avatars.githubusercontent.com/u/2011934?v=4?s=100" width="100px;" alt="Christophe Phillips"/><br /><sub><b>Christophe Phillips</b></sub></a><br /><a href="#ideas-ChristophePhillips" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/CerenB"><img src="https://avatars.githubusercontent.com/u/10451654?v=4?s=100" width="100px;" alt="CerenB"/><br /><sub><b>CerenB</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3ACerenB" title="Reviewed Pull Requests">πŸ‘€</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="http://cpplab.be"><img src="https://avatars.githubusercontent.com/u/38101692?v=4?s=100" width="100px;" alt="marcobarilari"/><br /><sub><b>marcobarilari</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Amarcobarilari" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/mwmaclean"><img src="https://avatars.githubusercontent.com/u/54547865?v=4?s=100" width="100px;" alt="MichΓ¨le MacLean"/><br /><sub><b>MichΓ¨le MacLean</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3Amwmaclean" title="Bug reports">πŸ›</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/JeanneCaronGuyon"><img src="https://avatars.githubusercontent.com/u/8718798?v=4?s=100" width="100px;" alt="Jeanne Caron-Guyon"/><br /><sub><b>Jeanne Caron-Guyon</b></sub></a><br /><a href="#ideas-JeanneCaronGuyon" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/rotemb9"><img src="https://avatars.githubusercontent.com/u/18393230?v=4?s=100" width="100px;" alt="Rotem Botvinik-Nezer"/><br /><sub><b>Rotem Botvinik-Nezer</b></sub></a><br /><a href="#ideas-rotemb9" title="Ideas, Planning, & Feedback">πŸ€”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/iqrashahzad14"><img src="https://avatars.githubusercontent.com/u/75671348?v=4?s=100" width="100px;" alt="Iqra Shahzad"/><br /><sub><b>Iqra Shahzad</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/pulls?q=is%3Apr+reviewed-by%3Aiqrashahzad14" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/DanielaMariaPinzon"><img src="https://avatars.githubusercontent.com/u/83370287?v=4?s=100" width="100px;" alt="DanielaMariaPinzon"/><br /><sub><b>DanielaMariaPinzon</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3ADanielaMariaPinzon" title="Bug reports">πŸ›</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/JeanLucAnton"><img src="https://avatars.githubusercontent.com/u/78919321?v=4?s=100" width="100px;" alt="JeanLucAnton"/><br /><sub><b>JeanLucAnton</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3AJeanLucAnton" title="Bug reports">πŸ›</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/avanaudenhaege"><img src="https://avatars.githubusercontent.com/u/75271651?v=4?s=100" width="100px;" alt="avanaudenhaege"/><br /><sub><b>avanaudenhaege</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3Aavanaudenhaege" title="Bug reports">πŸ›</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/coxroy"><img src="https://avatars.githubusercontent.com/u/26691793?v=4?s=100" width="100px;" alt="coxroy"/><br /><sub><b>coxroy</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3Acoxroy" title="Bug reports">πŸ›</a> <a href="#ideas-coxroy" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="#userTesting-coxroy" title="User Testing">πŸ““</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/achilleasNP"><img src="https://avatars.githubusercontent.com/u/4734123?v=4?s=100" width="100px;" alt="achilleasNP"/><br /><sub><b>achilleasNP</b></sub></a><br /><a href="https://github.com/bids-standard/bids-matlab/issues?q=author%3AachilleasNP" title="Bug reports">πŸ›</a></td> </tr> </tbody> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the all-contributors specification. Contributions of any kind welcome!