Create a CIFTI-2 axis from a template file.
Source:R/write_cifti_axes.R
cifti.axis.from.template.RdRead 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.
Arguments
- x
character string (the path of a CIFTI-2 file), an
fs.ciftiobject (seeread.cifti.header) or anfs.cifti.dataobject (seeread.cifti).- dim
integer or
NULL, the matrix dimension to get the axis for. IfNULL(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)
#> [1] 2
axes[[2L]]$type
#> [1] "CIFTI_INDEX_TYPE_BRAIN_MODELS"