Learn R Programming

freesurferformats (version 1.1.0)

write.fs.transform.itk: Write an ITK text transform file.

Description

Write a transformation in the text file format of ITK, which the tools built on ITK read: 3D Slicer (which calls it the 'ITK Transform' format), ANTs (via ConvertTransformFile), SimpleITK, and the workflows that write their transformations with them. The file name extension is usually .tfm or .txt.

An ITK transform operates on the world coordinates of the images, which in ITK are left-posterior-superior, so only a transformation that maps LPS coordinates can be written. Use transform2lps to convert a transformation in RAS coordinates.

Usage

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

Value

the fs.transform instance tf, invisibly.

Arguments

tf

an fs.transform instance whose matrix maps LPS coordinates to LPS 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.lta(), write.fs.transform.xfm()

Examples

Run this code
xfm_file <- system.file("extdata", "talairach.xfm", package = "freesurferformats", mustWork = TRUE)
out_file <- tempfile(fileext = ".tfm")
write.fs.transform.itk(transform2lps(read.fs.transform(xfm_file)), out_file)
readLines(out_file)
unlink(out_file)

Run the code above in your browser using DataLab