cifti.label.table: Get a label table from a CIFTI-2 label file.

View source: R/read_cifti_header.R

cifti.label.tableR Documentation

Get a label table from a CIFTI-2 label file.

Description

Get the label table of one label map (a .dlabel file can contain several maps). The label table maps integer label keys to names and RGBA colors, and is the CIFTI analogue of a FreeSurfer color lookup table.

Usage

cifti.label.table(cii, dim = 0L, map = 1L)

Arguments

cii

an fs.cifti instance, see read.cifti.header.

dim

integer, the matrix dimension to get the brain models for. CIFTI-2 files have two dimensions, so this is usually 0 (Workbench calls it the ROW dimension) or 1 (the COLUMN dimension). See read.cifti.header for details on the dimensions.

map

integer, the number of the label map to get the label table for (1-based). A CIFTI label file can contain several maps, use cii$matrix$indices_maps or the map_name field of the result to find out which one you need.

Value

a data.frame with one row per label and the columns 'key' (integer, the label key used in the data), 'red', 'green', 'blue', 'alpha' (numeric, in range 0 to 1) and 'label' (character string, the label name), plus 'x', 'y', 'z' (numeric, the optional label coordinates; NA if not present in the file). Returns NULL if the specified matrix dimension does not contain label maps, or if the specified map has no label table.

See Also

Other cifti functions: cifti.axis.brain.models(), cifti.axis.from.template(), cifti.axis.labels(), cifti.axis.parcels(), cifti.axis.parcels.from.annot(), cifti.axis.scalars(), cifti.axis.series(), cifti.brain.model.surface(), cifti.brain.model.volume(), cifti.dim.labels(), cifti.file.type.for.axes(), cifti.grayordinates(), cifti.header.from.axes(), cifti.parcel(), cifti.parcels(), cifti.series.info(), cifti.structure.data(), cifti.structures(), cifti.volume(), print.fs.cifti(), print.fs.cifti.data(), print.fs.connectome(), read.cifti(), read.cifti.header(), read.cifti.rows(), read.fs.connectome.cifti(), write.cifti(), write.fs.connectome.cifti(), write.fs.morph.cifti(), write.fs.parcellated.cifti(), write.fs.parcellation.cifti(), write.fs.series.cifti()

Examples

cifti_file <- system.file("extdata", "cifti", "tiny.dlabel.nii", package = "freesurferformats")
cii <- read.cifti.header(cifti_file)
cifti.label.table(cii, dim = 0L, map = 1L)


freesurferformats documentation built on Sept. 25, 2026, 1:07 a.m.