Find 1D or 3D voxel indices into a 3D image given spatial coordinates
coord2ind(coords, ...) # S3 method for default coord2ind( coords, imdims, voxdims = NULL, origin = NULL, linear.indices = TRUE, aperm = NULL, Clamp = FALSE, CheckRanges = !Clamp, ... )
spatial coordinates of image voxels.
extra arguments passed to methods.
array dimensions of 3D image OR an object for which a
as.im3d object has been defined (see Details).
vector of 3 voxels dimensions (width, height, depth).
the origin of the 3D image.
Whether or not to convert the voxel indices into a linear 1D form (the default) or to keep as 3D indices.
permutation order for axes.
Whether or not to map out of range coordinates to the nearest
in range index (default
whether to check if coordinates are out of range.
coord2ind is designed to cope with any user-defined class for
which an as.im3d method exists. Presently the only example in the nat.*
existence of an
as.im3d method implies that
dim functions can be called. This
is the necessary information required to convert i,j,k logical indices into
x,y,z spatial indices.