make_cortex: Make the cortical components of a '"xifti"'

View source: R/make_xifti_components.R

make_cortexR Documentation

Make the cortical components of a "xifti"

Description

Coerce a path to a GIFTI file, metric or label "gifti" object, data matrix or vector to a data matrix representing cortical data (and optionally a corresponding mask). That is, entries for xifti$data$cortex_\[left/right\] and xifti$meta$cortex$medial_wall_mask$\[left/right\]. If cortex is a path to a GIFTI file or a metric "gifti", any column names or a non-empty label table will also be extracted.

Usage

make_cortex(
  cortex,
  mwall = NULL,
  idx = NULL,
  cortex_is_masked = NULL,
  rm_blank_mwall = TRUE,
  rm_bad_mwall = TRUE,
  mwall_values = NULL,
  side = NULL,
  mwall_source = NULL
)

Arguments

cortex

A path to a metric or label GIFTI file, metric or label "gifti", or numeric vector/matrix representing cortical data.

If cortex is a path to a GIFTI file or "gifti", the column names and the label table will also be extracted if they exist in the GIFTI.

mwall

A path to a metric or label GIFTI file, metric or label "gifti", V_{[L/R]} x 1 logical matrix or length V_{[L/R]} logical vector representing the medial wall mask. FALSE values should indicate vertices that make up the medial wall. If the medial wall is unknown, use NULL (default).

idx

Only applies if cortex is a GIFTI file path. This is a numeric vector indicating the data indices to read. If NULL (default), read all the data. Must be a subset of the indices present in the file, or an error will occur.

cortex_is_masked

Has the medial wall been masked from cortex yet? NULL (default) indicates whether it has been masked or not is unknown.

If !cortex_is_masked, cortex should be V_{[L/R]} x T. If cortex_is_masked, cortex should be (V_{[L/R]} - mwall_{[L/R]}) x T. If is.null(cortex_is_masked), it may be either or.

rm_blank_mwall

If the medial wall mask is all TRUE (indicating no medial wall vertices), should it be discarded? Default: TRUE. If FALSE, keep it.

rm_bad_mwall

If the medial wall mask doesn't match up with the data (e.g. the vertex count doesn't add up), should it be discarded? Default: TRUE. If FALSE, raise an error.

mwall_values

If the medial wall mask was not provided (or if it was discarded), infer it from rows in cortex that are constantly one of these values. Example: c(0, NA, NaN). If NULL (default), do not attempt to infer the medial wall mask from the data values.

side

"left" or "right"? Just used to print warnings.

mwall_source

Description of where the mwall came from. Just used to print warnings.

Value

A list with components "data", "mwall", "col_names" and "labels".


mandymejia/ciftiTools documentation built on Feb. 28, 2024, 11:20 a.m.