Warning: This document is for an old version of smriprep. The main version is master.

smriprep.utils.bids module

Utilities to handle BIDS inputs.

smriprep.utils.bids.collect_derivatives(derivatives_dir, subject_id, std_spaces, spec=None, patterns=None)[source]

Gather existing derivatives and compose a cache.

smriprep.utils.bids.write_bidsignore(deriv_dir)[source]
smriprep.utils.bids.write_derivative_description(bids_dir, deriv_dir)[source]

Write a dataset_description.json for the derivatives folder.

>>> from smriprep.data import load
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> tmpdir = TemporaryDirectory()
>>> bids_dir = load('tests')
>>> deriv_desc = Path(tmpdir.name) / 'dataset_description.json'

>>> write_derivative_description(bids_dir, deriv_desc.parent)
>>> deriv_desc.is_file()
True
>>> tmpdir.cleanup()