Learn R Programming

freesurferformats (version 1.1.0)

read.dti.grad: Read a gradient table in MRtrix3 format.

Description

Reads a diffusion gradient table in MRtrix format: a plain text file with one line per DWI volume, each line holding the four space-separated values [ x y z b ], with the direction in scanner space and the b-value in s/mm^2. This is the format expected by the -grad option of the MRtrix3 commands (and produced by -export_grad_mrtrix), and it is also the format in which MRtrix3 stores the table in the dw_scheme entry of a .mif header. A first line consisting of a single integer is accepted as a volume count header.

Usage

read.dti.grad(filepath, layout = "auto")

Value

a numeric matrix with n rows and 4 columns named 'x', 'y', 'z' and 'b', one row per volume. The directions are in scanner space.

Arguments

filepath

character string, path to the file. There is no fixed file name convention, grad.b and encoding.b are common. Gzip-compressed files are supported.

layout

character string, one of 'auto', 'components' or 'volumes'. volumes means one volume per line (4 values per line, the MRtrix layout), components the transposed variant (4 lines). With 'auto' (the default), the layout is derived from the matrix dimensions.

See Also

Other dti functions: read.dti.bval(), read.dti.bvec(), read.dti.gradients(), write.dti.bval(), write.dti.bvec(), write.dti.grad()