tf <- read.fs.transform(system.file("extdata", "talairach.lta",
package = "freesurferformats", mustWork = TRUE
))
out_file <- tempfile(fileext = ".mat")
# An LTA of type 0 is a voxel-to-voxel transformation, so it can be written as an FSL matrix.
write.fs.transform(tf, out_file, format = "fslmat")
read.fs.transform(out_file)$matrix
unlink(out_file)
# The same transformation can be written in the FreeSurfer formats of the spaces it maps between.
out_file <- tempfile(fileext = ".lta")
write.fs.transform(tf, out_file)
unlink(out_file)
Run the code above in your browser using DataLab