Learn R Programming

freesurferformats (version 1.1.0)

read.fs.transform.fslmat: Read a transformation matrix from an FSL matrix file.

Description

Read the plain text 4x4 matrix that FSL's flirt writes with the -omat option, and that FSL, MRtrix3 and FreeSurfer read as the registration between two images.

Usage

read.fs.transform.fslmat(filepath)

Value

an fs.transform instance. An FSL matrix maps the voxel coordinates of the image given to flirt -in to those of the image given to flirt -ref. Both are voxel indices, so space_in and space_out are 'voxel' and voxel_base is 0 (FSL voxel indices are zero-based). The two images are not recorded in the file, so src and dst are NULL and the volumes have to be passed to transform2world

to interpret the matrix in world coordinates.

Arguments

filepath

character string, the full path to the transform file.

See Also

Other header coordinate space: invert.fs.transform(), is.fs.transform(), mghheader.is.ras.valid(), mghheader.ras2vox(), mghheader.ras2vox.tkreg(), mghheader.scanner2tkreg(), mghheader.tkreg2scanner(), mghheader.vox2ras(), mghheader.vox2ras.tkreg(), print.fs.transform(), read.fs.transform(), read.fs.transform.dat(), read.fs.transform.itk(), read.fs.transform.lta(), read.fs.transform.xfm(), sm0to1(), sm1to0(), summary.fs.transform(), transform2lps(), transform2ras(), transform2voxel(), transform2world(), write.fs.transform(), write.fs.transform.dat(), write.fs.transform.fslmat(), write.fs.transform.itk(), write.fs.transform.lta(), write.fs.transform.xfm()

Examples

Run this code
# Write the example LTA as an FSL matrix and read it back: no FSL installation is needed for that.
lta_file <- system.file("extdata", "talairach.lta", package = "freesurferformats", mustWork = TRUE)
mat_file <- tempfile(fileext = ".mat")
write.fs.transform(read.fs.transform(lta_file), mat_file, format = "fslmat")
read.fs.transform(mat_file)$matrix
unlink(mat_file)

Run the code above in your browser using DataLab