write_metric_gifti {ciftiTools}R Documentation

Write a data matrix to a GIFTI metric file

Description

Write the data for the left or right cortex to a metric GIFTI file.

Usage

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
)

Arguments

x

A V \times 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.

gifti_fname

Where to write the GIFTI file.

hemisphere

"left" (default) or "right". Ignored if data is already a "gifti" object.

intent

"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 .

data_type

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.

encoding

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.

endian

"LittleEndian" (default) or "BigEndian". If data is a "gifti" object, it will overwrite the existing endian.

col_names

The names of each data column in gii (or entries in gii$data).

label_table

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.

Value

Whether the GIFTI was successfully written

See Also

Other writing: separate_cifti(), write_cifti(), write_subcort_nifti(), write_surf_gifti(), write_xifti2()


[Package ciftiTools version 0.14.0 Index]