View source: R/read_fs_transform.R
| read.fs.transform.fslmat | R Documentation |
Read the plain text 4x4 matrix that FSL's flirt writes with the -omat option, and that FSL,
MRtrix3 and FreeSurfer read as the registration between two images.
read.fs.transform.fslmat(filepath)
filepath |
character string, the full path to the transform file. |
an fs.transform instance. An FSL matrix maps the voxel coordinates of the image given to flirt -in to those of the image given to flirt -ref. Both are voxel indices, so space_in and space_out are
'voxel' and voxel_base is 0 (FSL voxel indices are zero-based). The two images are not recorded in the
file, so src and dst are NULL and the volumes have to be passed to transform2world
to interpret the matrix in world coordinates.
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.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(),
write.fs.transform.xfm()
# Write the example LTA as an FSL matrix and read it back: no FSL installation is needed for that.
lta_file <- system.file("extdata", "talairach.lta", package = "freesurferformats", mustWork = TRUE)
mat_file <- tempfile(fileext = ".mat")
write.fs.transform(read.fs.transform(lta_file), mat_file, format = "fslmat")
read.fs.transform(mat_file)$matrix
unlink(mat_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.