View source: R/write_fs_transform.R
| write.fs.transform.xfm | R Documentation |
Write a transformation in the FreeSurfer xfm format, the format of talairach.xfm files, which
store the transformation from the RAS space of a subject to the RAS space of an MNI or Talairach template.
Only the first three rows of the matrix are stored, so the transformation must be affine, and it must map RAS
coordinates to RAS coordinates.
write.fs.transform.xfm(tf, filepath, type = "Linear")
tf |
an |
filepath |
character string, the full path of the file to write. |
type |
character string, the value of the |
the fs.transform instance tf, invisibly.
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.lta()
xfm_file <- system.file("extdata", "talairach.xfm", package = "freesurferformats", mustWork = TRUE)
tf <- read.fs.transform(xfm_file)
out_file <- tempfile(fileext = ".xfm")
write.fs.transform.xfm(tf, out_file)
max(abs(read.fs.transform(out_file)$matrix - tf$matrix)) # 0
unlink(out_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.