Learn R Programming

freesurferformats (version 1.1.0)

write.fs.transform.xfm: Write an MNI transform (xfm) file.

Description

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.

Usage

write.fs.transform.xfm(tf, filepath, type = "Linear")

Value

the fs.transform instance tf, invisibly.

Arguments

tf

an fs.transform instance whose matrix maps RAS coordinates to RAS coordinates.

filepath

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

type

character string, the value of the Transform_Type entry, 'Linear' by default.

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.lta()

Examples

Run this code
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)

Run the code above in your browser using DataLab