These functions are used to transform points from dimensionless pixel or
voxel coordinates to “real-world” coordinates, typically in millimetres,
and back. Actual pixel units can be obtained using the
pixunits function. The origin function gives the voxel
coordinates of the real-world origin.
voxelToWorld(points, image, simple = FALSE, ...)
worldToVoxel(points, image, simple = FALSE, ...)
origin(image, ...)A vector giving the coordinates of a point, or a matrix with one point per row.
The image in whose space the points are given, or a 4x4 numeric xform matrix.
A logical value: if TRUE then the transformation is
performed simply by rescaling the points according to the voxel dimensions
recorded in the image. Otherwise the full xform matrix is used.
Additional arguments to xform.
A vector or matrix of transformed points.
Voxel coordinates are assumed by these functions to use R's indexing convention, beginning from 1.
im <- readNifti(system.file("extdata", "example.nii.gz", package="RNifti"))
# Find the origin
origin(im)
#> [1] 49.81356 39.07409 23.01525