Load an image catalog previously saved with write_catalog().
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>[^/]+)")
manifest <- tempfile(fileext = ".json")
write_catalog(catalog, manifest)
catalog2 <- read_catalog(manifest)
catalog2
#> Image Catalog
#> Files: 4
#> Root: /tmp/Rtmp17Odxi/study_1cec74c9afa5
#> Pattern: sub-*/*.nii.gz
#> Metadata columns: subject
#> Subjects: 2 (01, 02)
unlink(c(manifest, root), recursive = TRUE)