Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

voxelToWorld

Transform points between voxel and “world” coordinates


Description

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.

Usage

voxelToWorld(points, image, simple = FALSE, ...)

worldToVoxel(points, image, simple = FALSE, ...)

origin(image, ...)

Arguments

points

A vector giving the coordinates of a point, or a matrix with one point per row.

image

The image in whose space the points are given, or a 4x4 numeric xform matrix.

simple

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.

Value

A vector or matrix of transformed points.

Note

Voxel coordinates are assumed by these functions to use R's indexing convention, beginning from 1.

Author(s)

Jon Clayden <code@clayden.org>

See Also

Examples

im <- readNifti(system.file("extdata", "example.nii.gz", package="RNifti"))

# Find the origin
origin(im)

RNifti

Fast R and C++ Access to NIfTI Images

v1.3.0
GPL-2
Authors
Jon Clayden [cre, aut] (<https://orcid.org/0000-0002-6608-0619>), Bob Cox [aut], Mark Jenkinson [aut], Matt Hall [ctb], Rick Reynolds [ctb], Kate Fissell [ctb], Jean-loup Gailly [cph], Mark Adler [cph]
Initial release
2020-12-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.