Load transformation matrix from a file.

read.fs.transform(filepath, format = "auto")

Arguments

filepath

character string, the full path to the transform file.

format

character string, the file format. Currently 'auto' (guess based on file extension), 'xfm' (for xform format) or 'dat' (for tkregister style, e.g. register.dat) are supported.

Value

named list, the 'matrix field contains a '4x4 numerical matrix, the transformation matrix. Other fields may exist, depending on the parsed format.

Note

Currently this function has been tested with linear transformation files only, all others are unsupported.

See also

Examples

    tf_file = system.file("extdata", "talairach.xfm",
                               package = "freesurferformats",
                               mustWork = TRUE);
    transform = read.fs.transform(tf_file);
    transform$matrix;
#>           [,1]      [,2]     [,3]       [,4]
#> [1,]  1.111536  0.040948 0.012535  -0.803558
#> [2,] -0.029730  0.981154 0.342306 -19.558083
#> [3,]  0.022961 -0.452588 1.111222  10.044540
#> [4,]  0.000000  0.000000 0.000000   1.000000