Specify which files correspond to which statistical assays (beta, se, var, t).
This mapping is used by as_gds.image_catalog() to construct the GDS.
Examples
# Build a tiny study tree with empty placeholder files
root <- tempfile("study_")
for (s in c("01", "02")) {
d <- file.path(root, paste0("sub-", s))
dir.create(d, recursive = TRUE)
invisible(file.create(file.path(d, c("cope1.nii.gz", "varcope1.nii.gz"))))
}
catalog <- image_catalog(root, "sub-*/*.nii.gz",
path_regex = "sub-(?<subject>[^/]+)")
# By filename pattern (regex matched against basenames)
catalog <- map_assays(catalog,
beta = "^cope[0-9]+\\.nii",
var = "^varcope[0-9]+\\.nii"
)
# By metadata column value
catalog <- assign_meta(catalog, "stat_type", "^([a-z]+)[0-9]+")
catalog <- map_assays(catalog,
beta = list(stat_type = "cope"),
var = list(stat_type = "varcope")
)
summary(catalog)
#> Image Catalog Summary
#> =====================
#> Total files: 4
#> Root directory: /tmp/Rtmp17Odxi/study_1cec7b1afb8f
#> Discovery pattern: sub-*/*.nii.gz
#>
#> Metadata columns:
#> basename: 2 unique
#> subject: 2 unique
#> stat_type: 2 unique
#>
#> Assay mappings:
#> beta: stat_type == 'cope'
#> var: stat_type == 'varcope'
unlink(root, recursive = TRUE)