Learn R Programming

freesurferformats (version 0.1.18)

colortable.from.annot: Extract color lookup table (LUT) from annotation.

Description

Extract a colortable lookup table (LUT) from an annotation. Such a LUT can also be read from files like `FREESURFER_HOME/FreeSurferColorLUT.txt` or saved as a file, check the 'See Also' section below.

Usage

colortable.from.annot(annot, compute_colorcode = FALSE)

Value

the colortable data.frame extracted from the annotation.

Arguments

annot

An annotation, as returned by read.fs.annot. If you want to assign specific indices, you can add a column named 'struct_index' to the data.frame annot$colortable_df. If there is no such columns, the indices will be created automatically in the order of the regions, starting at zero.

compute_colorcode

logical, indicates whether the unique color codes should be computed and added to the returned data.frame as an extra integer column named 'code'. Defaults to FALSE.

See Also

Other atlas functions: read.fs.annot(), read.fs.colortable(), write.fs.annot.gii(), write.fs.annot(), write.fs.colortable()

Other colorLUT functions: read.fs.colortable(), write.fs.colortable()

Examples

Run this code
    annotfile = system.file("extdata", "lh.aparc.annot.gz",
     package = "freesurferformats", mustWork = TRUE);
    annot = read.fs.annot(annotfile);
    colortable = colortable.from.annot(annot);
    head(colortable);

Run the code above in your browser using DataLab