Learn R Programming

freesurferformats (version 1.0.1)

read.dti.trk: Read fiber tracks from Diffusion Toolkit in trk format.

Description

Read fiber tracks from Diffusion Toolkit in trk format.

Usage

read.dti.trk(filepath, shift_origin = TRUE)

Value

named list, the parsed file data. The naming of the variables follows the spec at http://trackvis.org/docs/?subsect=fileformat. The returned header will contain the field `vox2ras` (the raw matrix stored in the TRK file, mapping from mm space to RAS) and, if `shift_origin` is `TRUE`, the additional field `vox2ras_corrected` (the computed matrix mapping from voxel indices to voxel center RAS coordinates).

Arguments

filepath

character string, path to file in trk format.

shift_origin

logical, whether to apply the half-voxel origin shift when computing the corrected vox2ras matrix. The TRK format stores a matrix that maps to the voxel corner, not the voxel center (as is the NIfTI convention). Set to `TRUE` (the default) to compute the corrected `vox2ras` that maps to voxel centers, as used by TrackVis. Set to `FALSE` if the file was written by DSI Studio, which does not apply this shift. See the notes for details.

Examples

Run this code
if (FALSE) {
trk = read.dti.trk("~/simple.trk");
trk2 = read.dti.trk("~/standard.trk");
trk3 = read.dti.trk("~/complex_big_endian.trk");
}

Run the code above in your browser using DataLab