ciftiTools (version 0.1.6.0)

make_cortex: Make "xifti" cortical components

Description

Coerce a path to a GIFTI file, metric "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" object, any column names or a non-empty label table will also be extracted.

Usage

make_cortex(
  cortex,
  mwall = 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 GIFTI file, metric "gifti" object, or numeric vector/matrix representing cortical data.

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

mwall

A path to a metric GIFTI file, metric "gifti" object, \(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).

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".