Skip to contents

Build "supersubject" by stacking all vertex data in one large file-backed matrix with dimensions n_subjects x n_vertices.

Usage

build_supersubject(
  subj_dir,
  folder_ids,
  outp_dir,
  measure,
  hemi,
  fwhmc = "fwhm10",
  target = "fsaverage",
  backing = file.path(outp_dir, paste(hemi, measure, target, "supersubject.bk", sep =
    ".")),
  error_cutoff = 20,
  mask = TRUE,
  save_rds = FALSE,
  cluster,
  verbose = TRUE
)

Arguments

subj_dir

: path to the FreeSurfer data, this expects a verywise structure.

folder_ids

: the vector of observations to include. This holds the relative path (from `subj_dir`) to the FreeSurfer data folder (e.g. "site1/sub-1_ses-01").

outp_dir

: output path, where logs, backing files and the matrix itself (if `save_rds == TRUE`) will be stored.

measure

: vertex-wise measure, used to identify files.

hemi

: hemisphere, used to identify files.

fwhmc

: (default = "fwhm10") full-width half maximum value, used to identify files.

target

: (default = "fsaverage"), used to identify files.

backing

: (default = `outp_dir`) location to save the matrix backingfile.

error_cutoff

: (default = 20) how many missing directories or brain surface files for the function to stop with an error. If < `error_cutoff` directories/files are not found a warning is thrown and missing files are registered in the `issues.log` file.

mask

: (default = TRUE) only keep cortical vertices, according to FreeSurfer cortical map.

save_rds

: (default = FALSE) save the supersubject file metadata for re-use in other sessions.

cluster

: the parallel cluster

verbose

: (default = TRUE)

Value

A Filebacked Big Matrix with vertex data for all subjects (dimensions: n_subjects x n_vertices)

Author

Serena Defina, 2024.