fsbrain (version 0.0.2)

subject.label: Retrieve label data for a single subject.

Description

Load a label (like 'label/lh.cortex.label') for a subject from disk. Uses knowledge about the FreeSurfer directory structure to load the correct file.

Usage

subject.label(subjects_dir, subject_id, label, hemi,
  return_one_based_indices = TRUE)

Arguments

subjects_dir,

string. The FreeSurfer SUBJECTS_DIR, i.e., a directory containing the data for all your subjects, each in a subdir named after the subject identifier.

subject_id,

string. The subject identifier

label,

string. Name of the label file, without the hemi part (if any), but including the '.label' suffix. E.g., 'cortex.label' for '?h.cortex.label'

hemi,

string, one of 'lh' or 'rh'. The hemisphere name. Used to construct the names of the label data files to be loaded.

return_one_based_indices,

logical. Whether the indices should be 1-based. Indices are stored zero-based in the file, but R uses 1-based indices. Defaults to TRUE, which means that 1 will be added to all indices read from the file before returning them.

Value

integer vector with label data: the list of vertex indices in the label. See 'return_one_based_indices' for important information.

See Also

Other label data functions: group.label, labeldata.from.mask, mask.from.labeldata.for.hemi

Examples

Run this code
# NOT RUN {
   fsbrain::download_optional_data();
   subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
   cortex_lh = subject.label(subjects_dir, "subject1", "cortex.label", "lh");
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace