View source: R/write_fs_transform.R
| write.fs.transform.lta | R Documentation |
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.
write.fs.transform.lta(tf, filepath)
tf |
an |
filepath |
character string, the full path of the file to write. |
the fs.transform instance tf, invisibly.
The mean and sigma header entries of an LTA file describe the registration that produced the matrix
and are not used to interpret it. They are taken from the header field of tf if it has them, and are
otherwise set to the center of the source volume and to 10000.
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()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.