The inverse operation of transform2world: given a transformation that operates
on world coordinates, compute the matrix that maps voxel indices of one volume to voxel indices of another.
The result can be saved as an FSL matrix, see write.fs.transform.fslmat.
Arguments
- tf
an
fs.transforminstance with a matrix in voxel coordinates (space_inandspace_outare 'voxel'). A transformation that already operates on world coordinates is returned unchanged.- src
NULLor the volume the transformation maps from (the-inimage of FSL, thesrcvolume of an LTA). Required for FSL matrices, since their files do not record the volumes.- dst
NULLor the volume the transformation maps to (the-refimage of FSL, thedstvolume of an LTA). Required for FSL matrices.
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(),
transform2world(),
write.fs.transform(),
write.fs.transform.dat(),
write.fs.transform.fslmat(),
write.fs.transform.itk(),
write.fs.transform.lta(),
write.fs.transform.xfm()
Examples
lta_file <- system.file("extdata", "talairach.lta", package = "freesurferformats", mustWork = TRUE)
tf_world <- transform2world(read.fs.transform(lta_file))
tf_voxel <- transform2voxel(tf_world)
max(abs(tf_voxel$matrix - read.fs.transform(lta_file)$matrix)) # back where we started
#> [1] 7.105427e-15