as.matrix_ifti {fMRItools}R Documentation

Convert CIFTI, NIFTI, or GIFTI input to T \times V matrix

Description

Convert CIFTI, NIFTI, or GIFTI input to a T \times V matrix by reading it in with the corresponding package and then separating the data from the metadata. Also works with the intermediate R objects created from reading these files: "xifti" objects from ciftiTools, "gifti" objects from gifti, "nifti" or "niftiExtension" objects from oro.nifti, and "niftiImage" objects from RNifti.

For CIFTI files, only intents supported by ciftiTools are supported: dscalar, dtseries, and dlabel. For NIFTI file or NIFTI-intermediate R objects, the data will be vectorized/masked.

Usage

as.matrix_ifti(
  x,
  meta = FALSE,
  sortSub = FALSE,
  TbyV = TRUE,
  verbose = FALSE,
  ...
)

Arguments

x

The object to coerce to a matrix

meta

Return metadata too? Default: FALSE.

sortSub

For CIFTI format input only. Sort subcortex by labels? Default: FALSE (sort by array index).

TbyV

Return the data matrix in T \times V form? Default: TRUE. If FALSE, return in V \times T form instead. Using this argument may be faster than transposing after the function call.

verbose

Print updates? Default: FALSE.

...

If x is a file path, additional arguments to the function used to read in x can be specified here. For example, if x is a path to a CIFTI file, ... might specify which idx and brainstructures to read in.

Value

If !meta, x as a matrix. If meta, a list of length two: the first entry is x as a matrix, and the second entry is the metadata of x.


[Package fMRItools version 0.4.7 Index]