mris_label2annot: Convert Label to Annotation

View source: R/fs-utils.R

mris_label2annotR Documentation

Convert Label to Annotation

Description

If you have labels rather than a full annotation file, these can be combined with FreeSurfer's mris_label2annot.

Usage

mris_label2annot(
  labels,
  hemisphere = "rh",
  ctab,
  subject = "fsaverage5",
  subjects_dir = fs_subj_dir(),
  output_dir = subjects_dir,
  opts = NULL,
  verbose = TRUE
)

Arguments

labels

label file path vector

hemisphere

hemisphere, either "rh" or "lh"

ctab

colourtable file

subject

Freesurfer subject, must exist in whatever subject directory specified or set in the environment with $SUBJECTS_DIR

subjects_dir

Freesurfer subject directory

output_dir

output directory path

opts

other arguments to freesurfer command

verbose

logical indicating to be verbose or not

Examples

if(freesurfer::have_fs()){
# for freesurfer help see:
freesurfer::fs_help("mris_label2annot")

subj_dir <- freesurfer::fs_subj_dir()
# Split up aparc annot into labels
mri_annotation2label(annot_name = "aparc")

# get annot for colour labels
annot <- freesurfer::read_annotation(
              file.path(subj_dir, 
                        "fsaverage5/label/rh.aparc.annot"))

labels <- list.files(
   file.path(subj_dir, "fsaverage5/label/aparc"), 
    full.names = TRUE)

# Combine them again into annot.
mris_label2annot(labels, annot$colortable)

}

LCBC-UiO/ggsegExtra documentation built on May 9, 2022, 1:07 a.m.