View source: R/write_fs_transform.R
| write.fs.transform.dat | R Documentation |
Write a transformation in the FreeSurfer tkregister format (register.dat), the format that
mri_vol2vol --reg, tkregister2 and bbregister use. Such a matrix maps the voxel coordinates of the
movable volume (the source) to RAS coordinates in the tkregister frame of the target volume, see
mghheader.vox2ras.tkreg, so a transformation can only be written if this is what it maps.
write.fs.transform.dat(
tf,
filepath,
subject = NULL,
in_plane_resolution = NULL
)
tf |
an |
filepath |
character string, the full path of the file to write. |
subject |
|
in_plane_resolution |
|
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.fslmat(),
write.fs.transform.itk(),
write.fs.transform.lta(),
write.fs.transform.xfm()
dat_file <- system.file("extdata", "register.dat", package = "freesurferformats", mustWork = TRUE)
tf <- read.fs.transform(dat_file)
out_file <- tempfile(fileext = ".dat")
write.fs.transform.dat(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.