Learn R Programming

freesurferformats (version 1.1.0)

write.fs.transform.lta: Write a FreeSurfer linear transform array (LTA) file.

Description

Write a transformation in the LTA format, which is the format FreeSurfer uses to exchange linear transformations and that is read by mri_vol2vol, tkregister2, mri_register and lta_convert.

The file states in its header whether the matrix operates on voxel indices (type 0, LINEAR_VOX_TO_VOX) or on RAS coordinates (type 1, LINEAR_RAS_TO_RAS), so the spaces of the transformation determine the type that is written. The geometry of the volumes is written from the src and dst descriptors, which makes the file self-contained: FreeSurfer can convert it to other spaces without being given the volumes again.

Usage

write.fs.transform.lta(tf, filepath)

Value

the fs.transform instance tf, invisibly.

Arguments

tf

an fs.transform instance whose matrix maps either voxel coordinates to voxel coordinates, or RAS coordinates to RAS coordinates.

filepath

character string, the full path of the file to write.

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.fslmat(), 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.xfm()

Examples

Run this code
lta_file <- system.file("extdata", "talairach.lta", package = "freesurferformats", mustWork = TRUE)
tf <- read.fs.transform(lta_file)
out_file <- tempfile(fileext = ".lta")
write.fs.transform.lta(tf, out_file)
max(abs(read.fs.transform(out_file)$matrix - tf$matrix)) # 0, the matrix survives the round trip
unlink(out_file)

Run the code above in your browser using DataLab