Extract color lookup table (LUT) from annotation.
Source:R/read_fs_annot.R
colortable.from.annot.RdExtract 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.
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.frameannot$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(),
write.fs.annot.gii(),
write.fs.colortable()
Other colorLUT functions:
read.fs.colortable(),
write.fs.colortable()
Examples
annotfile <- system.file("extdata", "lh.aparc.annot.gz",
package = "freesurferformats", mustWork = TRUE
)
annot <- read.fs.annot(annotfile)
colortable <- colortable.from.annot(annot)
head(colortable)
#> struct_index struct_name r g b a
#> 1 0 unknown 25 5 25 0
#> 2 1 bankssts 25 100 40 0
#> 3 2 caudalanteriorcingulate 125 100 160 0
#> 4 3 caudalmiddlefrontal 100 25 0 0
#> 5 4 corpuscallosum 120 70 50 0
#> 6 5 cuneus 220 20 100 0