as.im3d | R Documentation |
Convert a suitable object to an im3d object.
as.im3d(x, ...)
## S3 method for class 'im3d'
as.im3d(x, ...)
## S3 method for class 'matrix'
as.im3d(x, voxdims, origin = NULL, BoundingBox = NULL, ...)
x |
Object to turn into an im3d |
... |
Additional arguments to pass to methods. |
voxdims |
Numeric vector of length 3 or an |
origin |
the location (or centre) of the first voxel |
BoundingBox |
Physical extent of the image. See the details section of
|
At present the only interesting method in nat
is
as.im3d.matrix
which can be used to convert a matrix of 3D points
into a 3D volume representation. ind2coord
can be used to do
the reverse: convert a set of 3D coords to an im3d
volume.
Other than that, this is a largely a placeholder function with the expectation that other packages may wish to provide suitable methods.
as.im3d.matrix
can accept any object that can be converted to
an im3d object in the voxdims
argument This will completely specify
the dims, voxdims, origin etc. Any value passed to those parameters will be
ignored. This can be useful for producing a new im3d to match a target
image on disk or a nat.templatebrains::templatebrain
object. See
examples.
im3d
, ind2coord
im3d
, as.im3d
Other im3d:
boundingbox()
,
im3d-coords
,
im3d-io
,
im3d()
,
imexpand.grid()
,
imslice()
,
is.im3d()
,
mask()
,
origin()
,
projection()
,
threshold()
,
unmask()
,
voxdims()
## convert a list of neurons into an image volume
im=as.im3d(xyzmatrix(kcs20), voxdims=c(1, 1, 1),
BoundingBox=c(250, 410, 0, 130, 0, 120))
## Not run:
write.im3d(im, 'kc20volume.nrrd')
## use image dimensions of an image on disk
# nb note use of ReadData = FALSE so that we just fetch the dimensions of
# the target image
diskim=read.im3d("/path/to/my/image.nrrd", ReadData = FALSE)
im=as.im3d(xyzmatrix(kcs20), diskim)
## use image dimensions of JFRC2 template brain to define the image space
library(nat.flybrains)
im=as.im3d(xyzmatrix(kcs20), JFRC2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.