Learn R Programming

freesurferformats (version 1.1.0)

read.dti.trk.header: Read the header of a TrackVis TRK file.

Description

Reads and parses the 1000 byte header of a TRK file without touching the track data. This is cheap even for huge tractograms and can be used to inspect a file before deciding whether to read its tracks.

Usage

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

Value

named list, the header. It contains all fields of the TRK header as described at http://trackvis.org/docs/?subsect=fileformat, plus vox2ras (the matrix stored in the file) and, if shift_origin is TRUE, vox2ras_corrected.

Arguments

filepath

character string, path to a file in TRK format. Gzip-compressed files (typically named .trk.gz) are supported, the compression is detected from the file content, not from the file name.

shift_origin

logical, whether to compute the corrected vox2ras matrix, see read.dti.trk.

Examples

Run this code
if (FALSE) {
hdr <- read.dti.trk.header("brain.trk");
hdr$n_count;      # number of tracks stated in the header
hdr$voxel_order;
}

Run the code above in your browser using DataLab