View source: R/write_cifti_connectome.R
| write.fs.parcellated.cifti | R Documentation |
Write data that has one value (or one time series) per parcel to a
parcellated CIFTI-2 file: a .pscalar (scalar maps, e.g. a mean value per region) or a
.ptseries (a time series per region). The parcellated dimension of these file types
is matrix dimension 1, and the order of the parcels is the order of the parcels axis,
which comes from a template file or from a parcels axis that you build (see
cifti.axis.parcels.from.annot for a parcellation of this package, e.g.
the annotations of a FreeSurfer atlas).
The file type is derived from the file name: a name ending in .pscalar.nii gets a
scalars dimension (the map names come from map_names), one ending in .ptseries.nii
a series dimension (described by start, step and unit). Use
write.cifti directly for the other parcellated types (.pconn, the
mixed connectome types) or for a file with a non-standard name.
write.fs.parcellated.cifti(
filepath,
data,
template = NULL,
axes = NULL,
map_names = NULL,
start = 0,
step = 1,
unit = "SECOND",
metadata = NULL
)
filepath |
character string, the path of the file to write, ending in
|
data |
numeric vector or matrix, the data: a vector with one value per parcel (a
|
template |
character string (the path of a CIFTI-2 file), an |
axes |
list of two axes or a single parcels axis (see
|
map_names |
character vector or |
start |
numeric, the value of the first series point of a |
step |
numeric, the difference between consecutive series points. |
unit |
character string, the unit of the series, one of 'SECOND', 'HERTZ', 'METER' or 'RADIAN'. |
metadata |
named character vector or named list, or |
the axes that were written, invisibly.
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.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.parcellation.cifti(),
write.fs.series.cifti()
template <- system.file("extdata", "cifti", "tiny.ptseries.nii", package = "freesurferformats")
data <- matrix(seq_len(3 * 4), nrow = 4L) # 4 series points, 3 parcels
out_file <- file.path(tempdir(), "written.ptseries.nii")
write.fs.parcellated.cifti(out_file, data, template = template, step = 0.5)
dim(read.cifti(out_file)$data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.