cifti.grayordinates: Get the brainordinate table of a CIFTI-2 file.

View source: R/read_cifti.R

cifti.grayordinatesR Documentation

Get the brainordinate table of a CIFTI-2 file.

Description

Get the mapping from the matrix indices of one dimension to the individual surface vertices and volume voxels a CIFTI-2 file contains. This is the per-index version of the table returned by cifti.structures, which reports index ranges instead of single indices. It is useful to find out which vertex or voxel a data row belongs to, or to find the data index of a vertex or voxel.

Note that the same vertex or voxel can only appear once per dimension (the matrix has one entry per brainordinate), but a structure can be split over several brain model entries, and the vertices of a grayordinates file are a subset of the vertices of the surface it refers to.

Usage

cifti.grayordinates(cii, dim = 0L)

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.

Value

a data.frame with one row per index of the matrix dimension and the columns 'index' (integer, 0-based matrix index), 'structure' (character string, the brain structure as spelled in the file), 'structure_short' (without the CIFTI_STRUCTURE_ prefix), 'model_type' ('SURFACE' or 'VOXELS'), 'vertex_index' (integer, 0-based index of the vertex in the surface for surface models, NA for volume models) and 'i', 'j', 'k' (integer, 0-based voxel indices for volume models, NA for surface models).

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.header.from.axes(), cifti.label.table(), 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.dscalar.nii", package = "freesurferformats")
cii <- read.cifti.header(cifti_file)
grayordinates <- cifti.grayordinates(cii, dim = 1L)
head(grayordinates)


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