mirror {nat} | R Documentation |
Mirror 3D object about a given axis, optionally using a warping registration
Description
mirroring with a warping registration can be used to account e.g. for the asymmetry between brain hemispheres.
mirror.character
handles images on disk
Usage
mirror(x, ...)
## S3 method for class 'character'
mirror(x, output, mirrorAxisSize = NULL, target = x, ...)
## Default S3 method:
mirror(
x,
mirrorAxisSize,
mirrorAxis = c("X", "Y", "Z"),
warpfile = NULL,
transform = c("warp", "affine", "flip"),
...
)
## S3 method for class 'neuronlist'
mirror(x, subset = NULL, OmitFailures = NA, ...)
Arguments
x |
Object with 3D points (with named cols X,Y,Z) or path to image on disk. |
... |
additional arguments passed to methods or eventually to
|
output |
Path to the output image |
mirrorAxisSize |
A single number specifying the size of the axis to
mirror or a 2 vector (recommended) or 2x3 matrix specifying the
|
target |
Path to the image defining the target grid (defaults to the input image - hard to see when this would not be wanted). |
mirrorAxis |
Axis to mirror (default |
warpfile |
Optional registration or |
transform |
whether to use warp (default) or affine component of registration, or simply flip about midplane of axis. |
subset |
For |
OmitFailures |
Whether to omit neurons for which |
Details
The mirrorAxisSize
argument can be specified in 3 ways for
the x axis with extreme values, x0+x1:
a single number equal to x0+x1
a 2-vector c(x0, x1) (recommended)
the
boundingbox
for the 3D data to be mirrored: the relevant axis specified bymirrorAxis
will be extracted.
This function is agnostic re node vs cell data, but for node data
BoundingBox should be supplied while for cell, it should be bounds. See
boundingbox
for details of BoundingBox vs bounds.
See nlapply
for details of the subset
and
OmitFailures
arguments.
Value
Object with transformed points
See Also
Examples
nopen3d()
x=Cell07PNs[[1]]
mx=mirror(x,168)
plot3d(x,col='red')
plot3d(mx,col='green')
# also works with dotprops objects
clear3d()
y=kcs20[[1]]
my=mirror(y,mirrorAxisSize=564.2532,transform='flip')
plot3d(y, col='red')
plot3d(my, col='green')
## Not run:
## Example with an image
# note that we must specify an output image (obviously) but that as a
# convenience mirror calculates the mirrorAxisSize for us
mirror('myimage.nrrd', output='myimage-mirrored.nrrd',
warpfile='myimage_mirror.list')
# Simple flip along a different axis
mirror('myimage.nrrd', output='myimage-flipped.nrrd', mirrorAxis="Y",
transform='flip')
## End(Not run)