Write the data for the left or right cortex to a metric GIFTI file.
write_metric_gifti(
x,
gifti_fname,
hemisphere = c("left", "right"),
intent = NULL,
data_type = NULL,
encoding = NULL,
endian = c("LittleEndian", "BigEndian"),
col_names = NULL,
label_table = NULL
)
A \(V x T\) data matrix (V vertices, T measurements). This can also
be an object from gifti::readgii
, or a length \(T\) list of length
\(V\) vectors.
Where to write the GIFTI file.
"left"
(default) or "right"
. Ignored if
data
is already a "gifti"
object.
"NIFTI_INTENT_*". NULL
(default) will use
metadata if data
is a "gifti"
object, or "NONE" if it cannot be
inferred. If not NULL
and data
is a "gifti"
object, it will
overwrite the existing intent. See
https://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/group__NIFTI1__INTENT__CODES.html/document_view .
the type of data
:
"NIFTI_TYPE_*" where * is "INT32" or "FLOAT32". If NULL
(default), the
data type will be inferred. If not NULL
and data
is a
"gifti"
object, it will overwrite the existing data type.
One of "ASCII", "Base64Binary", or "GZipBase64Binary". If
NULL
(default), will use the metadata if data
is a GIFTI object,
or "ASCII" if the data_type
is "NIFTI_TYPE_INT32" and
"GZipBase64Binary" if the data_type
is "NIFTI_TYPE_FLOAT32". If not
NULL
and data
is a "gifti"
object, it will overwrite the
existing data type.
"LittleEndian" (default) or "BigEndian". If data
is a
"gifti"
object, it will overwrite the existing endian.
The names of each data column in gii
(or entries in
gii$data
).
A data.frame with labels along rows. The row names should be the label names. The column names should be among: "Key", "Red", "Green", "Blue", and "Alpha". The "Key" column is required whereas the others are optional (but very often included). Values in the "Key" column should be non-negative integers, typically beginning with 0. The other columns should be floating-point numbers between 0 and 1.
Although CIFTI files support a different label table for each data column, GIFTI files only support a single label table. So this label table should be applicable to each data column.
Whether the GIFTI was successfully written
Other functions for writing CIFTI or GIFTI data:
separate_cifti()
,
write_cifti()
,
write_subcort_nifti()
,
write_surf_gifti()