Skip to contents

Get the brain model entries for one matrix dimension of a CIFTI-2 file, i.e. the mapping from matrix indices to surface vertices or volume voxels. Note that a brain structure can appear in several brain model entries: a grayordinates file can contain a surface part and a volume part for the same structure, and a structure can be split into several index ranges. Always use the index ranges from this table to map data values, never the structure names.

Usage

cifti.structures(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 brain model entry and the columns 'structure' (character string, the brain structure in the spelling used in the file), 'structure_short' (character string, the normalized name without the CIFTI_STRUCTURE_ prefix, e.g. 'CORTEX_LEFT'), 'model_type' ('SURFACE' or 'VOXELS'), 'index_offset' (integer, 0-based index of the first matrix entry covered by this brain model), 'index_count' (integer, the number of matrix entries covered) and 'surface_number_of_vertices' (integer, the number of vertices of the complete surface, for surface models; NA for volume models). Use index_offset and index_count to extract the data values for a brain model from the data matrix.

Examples

cifti_file <- system.file("extdata", "cifti", "tiny.dscalar.nii", package = "freesurferformats")
cii <- read.cifti.header(cifti_file)
cifti.structures(cii, dim = 1L)
#>                      structure structure_short model_type index_offset
#> 1  CIFTI_STRUCTURE_CORTEX_LEFT     CORTEX_LEFT    SURFACE            0
#> 2 CIFTI_STRUCTURE_CORTEX_RIGHT    CORTEX_RIGHT    SURFACE           10
#>   index_count surface_number_of_vertices
#> 1          10                         10
#> 2          12                         12