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 (errors, warnings) {console.log(errors, 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()
The BIDS Validator currently works in the browser with browserify. You can add it to a browserify project by cloning the validator and requiring it with browserify syntax var validate = require('bids-validator');.
The BIDS validator works like most npm packages. You can install it by running npm install bids-validator.
If you install the bids validator globally by using npm install -g bids-validator you will be able to use it as a command line tool. Once installed you should be able to run bids-validator /path/to/your/bids/directory and see any validation issues logged to the terminal. Run bids-validor without a directory path to see available options.
To develop locally, clone the project and run npm install from the project root. This will install external dependencies.
A note about OS X, the dependencies for the browser require a npm package called node-gyp which needs xcode to be installed in order to be compiled.
- Create a seperate directory with the gh-pages branch in it.
- The local version of the validator needs to be added to npm. This is done through the command
npm --save relative/path/to/bids-validator. - In the gh-pages package.json file replace
bids-validator: "latest"withbids-validator: "relative/path/to/bids-validatorso if the normal bids-validator project is in the same directory as the gh-pages project this line would read `bids-validator: "../bids-validator". This will install your local version of the bids-validator project instead of going to the central npm repository. - The default gh-pages application minifies javascript. This make it difficult to test things locally. To disable minification of javascript comment out the line
.pipe(uglify())in gulpfule.js - In the gh-pages directory execute
npm installand thengulp buildthis will install all the dependencies of the bids-validator browser application and build it. - Any subsequent changes to the bids-validator will require the source to be reinstalled and the gh-pages application rebuilt. From the gh-pages directory a one liner to do this is
rm -rv node_modules/bids-validator/ && npm install && gulp buildThe rm removes the installed version of bids-validator, npm install will recopy it from your local repositroy, and then finally the gulp rebuild. - Via Chrome you can now open the index.html in gh-pages generated by gulp.
To start the test suite run npm test from the project root.