| coord2ind | R Documentation |
Find 1D indices into a 3D image given spatial coordinates
coord2ind(coords, ...)
## Default S3 method:
coord2ind(
coords,
imdims,
voxdims = NULL,
origin = NULL,
aperm,
Clamp = FALSE,
CheckRanges = !Clamp,
...
)
coords |
spatial coordinates of image voxels. |
... |
extra arguments passed to methods. |
imdims |
array dimensions of 3D image OR an object for which a
|
voxdims |
vector of 3 voxels dimensions (width, height, depth). |
origin |
the origin of the 3D image. |
aperm |
permutation order for axes. |
Clamp |
??? |
CheckRanges |
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.*
ecosystem is nat.templatebrains::as.im3d.templatebrain. The
existence of an as.im3d method implies that
voxdims,origin, and dim functions can be called. This
is the necessary information required to convert i,j,k logical indices into
x,y,z spatial indices.
ind2coord, sub2ind, ijkpos
coord2ind(cbind(1,2,3), imdims = c(1024,512,218),
voxdims = c(0.622088, 0.622088, 0.622088), origin = c(0,0,0))
## Not run:
## repeat but using a templatebrain object to specify the coordinate system
library(nat.flybrains)
coord2ind(cbind(1,2,3), JFRC2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.