Create the CIFTI-2 XML metadata for a set of axes.
Source:R/write_cifti.R
cifti.header.from.axes.RdBuild the CIFTI-2 XML document (the part of a CIFTI-2 file that describes
what the data matrix contains) from a set of axes. This is the inverse of the XML
parsing that read.cifti.header performs: pass the result of this
function to cifti.parse.xml or to read.cifti.header (after
storing it in a file) and you get back the axes you put in.
Arguments
- axes
list of axes, one per matrix dimension, as created by the
cifti.axis.*()functions or bycifti.axis.from.template. If the list is named, the names have to be the matrix dimensions ('0' and '1'), otherwise the axes are assigned to the dimensions in the order in which they are given.- metadata
named character vector or named list or
NULL, the metadata of the matrix (e.g. the provenance information), as name/value pairs.
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.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
axis_series <- cifti.axis.series(4L, start = 0, step = 2.5)
axis_brain <- cifti.axis.brain.models(list(
cifti.brain.model.surface("lh", 10L),
cifti.brain.model.surface("rh", 12L)))
xml <- cifti.header.from.axes(list(axis_series, axis_brain))
cat(substr(xml, 1, 200))
#> <?xml version="1.0" encoding="UTF-8"?>
#> <CIFTI Version="2">
#> <Matrix>
#> <MatrixIndicesMap AppliesToMatrixDimension="0" IndicesMapToDataType="CIFTI_INDEX_TYPE_SERIES" NumberOfSeriesPoints="4" SeriesS