Set the bounding box of an im3d object
boundingbox(x, ...) # S3 method for im3d boundingbox(x, dims = dim(x), ...) # S3 method for character boundingbox(x, ...) # S3 method for default boundingbox(x, na.rm = FALSE, ...) boundingbox(x) <- value
Additional arguments passed to methods, and eventually to
The number of voxels in each dimension when x is a BoundingBox matrix.
Whether to ignore NA points (default
The object which will provide the new boundingbox information.
This can be be either an im3d object with a boundingbox or a vector or
matrix defined according to
matrix with 2 rows and 3 columns with
class='boundingbox' or NULL when missing.
The bounding box is defined as the position of the voxels at the two
opposite corners of the cuboid encompassing an image, when each voxel
is assumed to have a single position (sometimes thought of as its centre)
and no physical extent. When written as a vector it should look
c(x0,x1,y0,y1,z0,z1). When written as a matrix it should look
rbind(c(x0,y0,z0),c(x1,y1,z1)) where x0,y0,z0 is the position
of the origin.
Note that there are two competing definitions for the physical extent of an
image that are discussed e.g.
http://teem.sourceforge.net/nrrd/format.html. The definition that
makes most sense depends largely on whether you think of a pixel as a
little square with some defined area (and therefore a voxel as a cube with
some defined volume) or you take the view that you can only define
with certainty the grid points at which image data was acquired. The first
view implies a physical extent which we call the
c(dx,dy,dz); the second is defined as
c(dx,dy,dz) and assumes that the extent of the image is defined by a
cuboid including the sample points at the extreme corner of the grid. Amira
takes this second view and this is the one we favour given our background
in microscopy. If you wish to convert a
bounds type definition into
an im3d BoundingBox, you should pass the argument
boundingbox.default is designed to be used on objects that
contain 3D point information. This includes any object for which an
xyzmatrix method is defined including
data.frame objects describing 3D points as well as specialised
classes such as
# bounding box for a neuron boundingbox(Cell07PNs[])#> [,1] [,2] [,3] #> [1,] 186.8660 90.36325 88.20393 #> [2,] 289.5364 132.70932 157.29700 #> attr(,"class") #>  "boundingbox"