Functions to convert to and from BIDS JSON format for image metadata. They
are wrappers around functions from the jsonlite
package, with the
additional ability to convert between divest
's tag naming convention
and the BIDS equivalent. The differences are mostly in capitalisation, and
the units used for magnetic resonance echo, repetition and inversion times.
fromBidsJson(source, rename = FALSE)toBidsJson(source, path = NULL, rename = FALSE)
fromBidsJson
returns a list of image attributes.
toBidsJson
returns a character vector if path
is
NULL
, otherwise nothing.
A list containing metadata (see imageAttributes
)
or, for fromBidsJson
, a string containing literal JSON or the path
to a file containing it.
Logical value. If TRUE
, element names are also
converted to or from the BIDS convention; otherwise this is just a
conversion between an R list and a JSON string.
For toBidsJson
, the path to write the JSON output to. If
NULL
, the default, the JSON text is returned in an object.
Jon Clayden code@clayden.org
More information about metadata captured by the BIDS format can be found at https://bids.neuroimaging.io or in the paper cited below.
K.J. Gorgolewski, T. Auer, V.D. Calhoun, et al. The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments (2016). Scientific Data 3:160044. tools:::Rd_expr_doi("10.1038/sdata.2016.44").