Skip to contents

A volume axis describes the voxel grid that the volume brain models of a CIFTI-2 file refer to: its dimensions and the 4x4 transformation matrix that maps the (0-based) IJK voxel indices to coordinates. The matrix is stored row by row in the file, and the coordinates it produces are in units of 10^meter_exponent (which is -3, i.e. millimeters, for the files that Connectome Workbench writes).

Usage

cifti.volume(dimensions, transformation_matrix, meter_exponent = -3L)

Arguments

dimensions

integer vector of length 3, the dimensions of the voxel grid.

transformation_matrix

4x4 numeric matrix, the transformation from (0-based) voxel indices to coordinates. There is no default: a CIFTI-2 file does not store the voxel size or the position of a volume anywhere else, so a wrong or invented matrix silently puts the voxels of a structure in the wrong place. Pass the matrix that the template file has (see cifti.axis.from.template) if you do not know it.

meter_exponent

integer, the exponent of the unit of the coordinates.

Value

a named list with the entries 'dimensions', 'meter_exponent' and 'transformation_matrix', to be passed to cifti.axis.brain.models or cifti.axis.parcels.

Examples

volume <- cifti.volume(c(4L, 4L, 4L), diag(c(2, 2, 2, 1)))
volume$dimensions
#> [1] 4 4 4