Retrieves JSON metadata for a target BIDS file. When inherit = TRUE, this
method applies BIDS-style inheritance by merging matching sidecars from less
specific to more specific locations.
Arguments
- x
A
bids_projectobject.- file
Target file path (relative to project root or absolute path).
- inherit
If
TRUE, merge inherited metadata from parent sidecars.- scope
Scope used when applying inheritance:
"auto": infer from file location"raw": raw data inheritance"derivatives": derivatives inheritance"all": allow full project ancestry
- ...
Additional arguments for methods.
Details
If multiple sidecars are equally specific at the same directory depth, they are merged in deterministic path order after less specific ancestors, so the final values are reproducible.
Examples
# \donttest{
tryCatch({
ds001_path <- get_example_bids_dataset("ds001")
proj <- bids_project(ds001_path)
f <- func_scans(proj, subid = "01")[1]
if (!is.null(f)) get_metadata(proj, f)
unlink(ds001_path, recursive = TRUE)
}, error = function(e) message("Example requires internet: ", e$message))
# }