write_subcort_nifti: Write subcortical data to NIFTI files

View source: R/write_nifti.R

write_subcort_niftiR Documentation

Write subcortical data to NIFTI files

Description

Write subcortical data to NIFTI files representing the data values, subcortical structure labels, and volumetric mask. The input formats of subcortVol, subcortLabs, and subcortMask correspond to the data structures of xifti$data$subcort, xifti$meta$subcort$labels , and xifti$meta$subcort$mask respectively. subcortVol and subcortLabs should be vectorized, so if they are volumes consider using RNifti::writeNIfTI.

Usage

write_subcort_nifti(
  subcortVol,
  subcortLabs,
  subcortMask,
  trans_mat = NULL,
  trans_units = NULL,
  col_names = NULL,
  label_table = NULL,
  subcortVol_fname,
  subcortLabs_fname,
  ROIsubcortVol_fname = NULL,
  fill = 0
)

Arguments

subcortVol

A vectorized data matrix: V voxels by T measurements

subcortLabs

Numeric (0 and 3-22) or factor vector corresponding to subcortical structure labels. See substructure_table.

subcortMask

Logical volumetric mask. Values of 0 represent out-of-mask voxels (not subcortical), and values of 1 represent in-mask voxels (subcortical),

trans_mat

The TransformationMatrixIJKtoXYZ, or equivalently the desired sform matrix (srow_x, srow_y and srow_z) to write. If NULL, do not write it (all zeroes).

trans_units

The units of trans_mat. Currently not used.

col_names

(Optional) Column names.

label_table

(Optional) data.frame of labels and their colors.

subcortVol_fname, subcortLabs_fname, ROIsubcortVol_fname

File path to a NIFTI to save the corresponding data. ROIsubcortVol_fname is optional but the rest is required.

fill

Values to use for out-of-mask voxels. Default: 0.

Details

All file path arguments are required except ROIsubcortVol_fname. If not provided, the volumetric mask will not be written. (It's redundant with the 0 values in subcortLabs_fname because valid labels have positive indexes.)

Note that for label data (i.e. if label_table is provided) only one label table can be saved.

Value

Named character vector with the "subcortVol", "subcortLabs", and "ROIsubcortVol" file names (if written)

Connectome Workbench

This function interfaces with the "-volume-label-import" Workbench Command.

See Also

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


ciftiTools documentation built on Oct. 4, 2024, 1:12 a.m.