cifti.axis.from.template: Create a CIFTI-2 axis from a template file.

View source: R/write_cifti_axes.R

cifti.axis.from.templateR Documentation

Create a CIFTI-2 axis from a template file.

Description

Read the axes of an existing CIFTI-2 file, so that a new file can be written with the same mapping. This is the recommended way to write a file for real data: the mapping of an HCP grayordinates file (which vertices are in the file, and which volume voxels) can not be invented, it has to come from the file the data was derived from.

Usage

cifti.axis.from.template(x, dim = NULL)

Arguments

x

character string (the path of a CIFTI-2 file), an fs.cifti object (see read.cifti.header) or an fs.cifti.data object (see read.cifti).

dim

integer or NULL, the matrix dimension to get the axis for. If NULL (the default), the axes of all matrix dimensions are returned as a list.

Value

the axis of the requested dimension (a named list, see cifti.axis.brain.models), or a list of axes (one per dimension; note that a file whose dimensions share a single XML mapping returns the same axis for both, as two entries).

See Also

Other cifti functions: cifti.axis.brain.models(), 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.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")
axes <- cifti.axis.from.template(cifti_file)
length(axes)
axes[[2L]]$type


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