From 50e95a6fefcac8c7afd58a126006fd4f75fa28dd Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 14 Aug 2024 11:21:14 +0200 Subject: [PATCH] update readme --- README.md | 320 +++++++++++------------------------------------------- 1 file changed, 66 insertions(+), 254 deletions(-) diff --git a/README.md b/README.md index 6dc051c..ef70e47 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,72 @@ -[![Node Tests](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml/badge.svg)](https://github.com/bids-standard/bids-validator/actions/workflows/node_tests.yml) -[![Python tests](https://github.com/bids-standard/bids-validator/actions/workflows/python_tests.yml/badge.svg)](https://github.com/bids-standard/bids-validator/actions/workflows/python_tests.yml) -[![bids-examples tests](https://github.com/bids-standard/bids-validator/actions/workflows/test-bids-examples.yml/badge.svg)](https://github.com/bids-standard/bids-validator/actions/workflows/test-bids-examples.yml) -[![CircleCI](https://circleci.com/gh/bids-standard/bids-validator.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/bids-standard/bids-validator) -[![Codecov](https://codecov.io/gh/bids-standard/bids-validator/branch/master/graph/badge.svg)](https://codecov.io/gh/bids-standard/bids-validator) +[![.github/workflows/build-test-deploy.yml](https://github.com/bids-standard/python-validator/actions/workflows/build-test-deploy.yml/badge.svg)](https://github.com/bids-standard/python-validator/actions/workflows/build-test-deploy.yml) +[![codecov](https://codecov.io/gh/bids-standard/python-validator/graph/badge.svg?token=5iz5rfzv93)](https://codecov.io/gh/bids-standard/python-validator) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3688707.svg)](https://doi.org/10.5281/zenodo.3688707) +[![PyPI version](https://badge.fury.io/py/bids-validator.svg)](https://badge.fury.io/py/bids-validator) +[![Conda version](https://img.shields.io/conda/vn/conda-forge/bids-validator)](https://anaconda.org/conda-forge/bids-validator) + +# Python BIDS-Validator + +This is a library of helper functions written in Python, +for use with BIDS compliant applications written in this language. + +The main function determines if a file extension is compliant with the BIDS specification. + +## Installation + +To install with pip: + +``` +pip install -U bids_validator +``` -# BIDS-Validator - -- [BIDS-Validator](#bids-validator) - - [Quickstart](#quickstart) - - [Support](#support) - - [Maintainers and Contributors](#maintainers-and-contributors) - - [Use](#use) - - [API](#api) - - [.bidsignore](#bidsignore) - - [Configuration](#configuration) - - [In the Browser](#in-the-browser) - - [On the Server](#on-the-server) - - [Through Command Line](#through-command-line) - - [Docker image](#docker-image) - - [Python Library](#python-library) - - [Example](#example) - - [Development](#development) - - [Running Locally in a Browser](#running-locally-in-a-browser) - - [Testing](#testing) - - [Publishing](#publishing) - - [Acknowledgments](#acknowledgments) +To install with conda: + +``` +conda install bids-validator +``` ## Quickstart -1. Web version: - 1. Open [Google Chrome](https://www.google.com/chrome/) or - [Mozilla Firefox](https://mozilla.org/firefox) (currently the only - supported browsers) - 1. Go to https://bids-standard.github.io/bids-validator/ and select a folder - with your BIDS dataset. If the validator seems to be working longer than - couple of minutes please open [developer tools ](https://developer.chrome.com/devtools) - and report the error at [https://github.com/bids-standard/bids-validator/issues](https://github.com/bids-standard/bids-validator/issues). -1. Command line version: - 1. Install [Node.js](https://nodejs.org) (at least version 18.0.0) - 1. Update `npm` to be at least version 7 (`npm install --global npm@^7`) - 1. From a terminal run `npm install -g bids-validator` - 1. Run `bids-validator` to start validating datasets. -1. Docker - 1. Install Docker - 1. From a terminal run `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data` - but replace the `/path/to/data` part of the command with your own path on your machine. -1. Python Library: - 1. Install [Python](https://www.python.org/) - 1. Install [Pip](https://pip.pypa.io/en/stable/installing/) package manager for Python, if - not already installed. - 1. From a terminal run `pip install bids_validator` to acquire the - [BIDS Validator PyPI package](https://pypi.org/project/bids-validator/) - or `conda install bids-validator` for the - [Conda package](https://anaconda.org/conda-forge/bids-validator). - 1. Open a Python terminal and type: `python` - 1. Import the BIDS Validator package `from bids_validator import BIDSValidator` - 1. Check if a file is BIDS compatible `BIDSValidator().is_bids('/relative/path/to/a/bids/file')` - 1. Note, the file path must be relative to the root of the BIDS dataset, and - a leading forward slash `/` must be added to the file path. - -## Support - -The BIDS Validator is designed to work in both the browser and in Node.js. We -target support for the latest long term stable (LTS) release of Node.js and the -latest version of Chrome. - -There is also a library of helper functions written in Python, for use with BIDS -compliant applications written in this language. - -Please report any issues you experience while using these support targets via -the [GitHub issue tracker](https://github.com/bids-standard/bids-validator/issues). -If you experience issues outside of these supported environments and believe we -should extend our targeted support feel free to open a new issue describing the -issue, your support target and why you require extended support and we will -address these issues on a case by case basis. +1. Open a Python terminal and type: `python` +1. Import the BIDS Validator package `from bids_validator import BIDSValidator` +1. Check if a file is BIDS compatible `BIDSValidator().is_bids('/relative/path/to/a/bids/file')` +1. Note, the file path must be relative to the root of the BIDS dataset, and + a leading forward slash `/` must be added to the file path. + + +### Example + +```Python +from bids_validator import BIDSValidator + +validator = BIDSValidator() + +filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"] +for filepath in filepaths: + print(validator.is_bids(filepath)) # will print True, and then False +``` + +Note, the file path must be relative to the root of the BIDS dataset, and a +leading forward slash `/` must be added to the file path. + +## Acknowledgments + +Many contributions to the `bids-validator` were done by members of the +BIDS community. See the +[list of contributors](https://bids-specification.readthedocs.io/en/stable/99-appendices/01-contributors.html). + +A large part of the development of `bids-validator` is currently done by +[Squishymedia](https://squishymedia.com/), who are in turn financed through +different grants offered for the general development of BIDS. See the list +below. + +Development and contributions were supported through the following federally +funded projects/grants: + +- [BIDS Derivatives (NIMH: R24MH114705, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH114705-01) +- [OpenNeuro (NIMH: R24MH117179, PI: Poldrack)](https://grantome.com/grant/NIH/R24-MH117179-01) +- [Spokes: MEDIUM: WEST (NSF: 1760950, PI: Poldrack & Gorgolewski)](https://grantome.com/grant/NSF/IIS-1760950) +- [ReproNim](http://repronim.org) [(NIH-NIBIB P41 EB019936, PI: Kennedy)](https://projectreporter.nih.gov/project_info_description.cfm?aid=8999833) ## Maintainers and Contributors @@ -160,32 +152,7 @@ Please also see [Acknowledgments](#acknowledgments). -## Use - -### API - -The BIDS Validator has one primary method that takes a directory as either a -path to the directory (node) or the object given by selecting a directory with a -file input (browser), an options object, and a callback. - -Available options include: - -- ignoreWarnings - (boolean - defaults to false) -- ignoreNiftiHeaders - (boolean - defaults to false) - -For example: - -`validate.BIDS(directory, {ignoreWarnings: true}, function (issues, summary) {console.log(issues.errors, issues.warnings);});` - -If you would like to test individual files you can use the file specific checks -that we expose. - -- validate.BIDS() -- validate.JSON() -- validate.TSV() -- validate.NIFTI() - -Additionally you can reformat stored errors against a new config using `validate.reformat()` +