Learn R Programming

freesurferformats (version 1.1.0)

write.dti.grad: Write a gradient table in MRtrix3 format.

Description

Writes a diffusion gradient table to a plain text file with one line per DWI volume, each line holding the four space-separated values [ x y z b ]. This is the format that the -grad option of the MRtrix3 commands expects, and the format of the dw_scheme entry in the header of a .mif image.

Usage

write.dti.grad(filepath, bvec, bval = NULL, layout = "volumes")

Value

NULL, invisibly. Called for the side effect of writing the file.

Arguments

filepath

character string, path to the output file. Files ending in .gz are gzip-compressed.

bvec

numeric matrix with 3 columns (one row per volume) or 3 rows (one column per volume), the gradient directions. Alternatively a full gradient table, i.e. a numeric matrix with 4 columns named or ordered 'x', 'y', 'z' and 'b', as returned by read.dti.grad. If a full table is given, the bval parameter must be left at NULL.

bval

numeric vector, the b-value of each volume, in s/mm^2. Ignored if bvec is a full gradient table.

layout

character string, one of 'volumes' or 'components'. volumes (the default) writes one volume per line, which is the MRtrix layout, while components writes the transposed variant with 4 lines.

See Also

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