xformpoints.h5reg | R Documentation |
Map points using h5 registrations
## S3 method for class 'h5reg'
xformpoints(reg, points, ..., method = c("auto", "java", "rjava"))
reg |
A |
points |
An Nx3 matrix of 3D points to transform |
... |
Additional arguments passed to java transform tool (currently ignored). |
method |
Whether to shell out to java executable ( |
See h5reg
for details of the ordering of
registrations.
An Nx3 matrix of transformed points
By default xformpoints.h5reg
starts a separate Java
Virtual Machine (JVM) for every call. This has an overhead that might be in
the 0.5s range, which quickly builds up. Alternatively, you can use
method='rjava'
, which depends on the 'rJava' package; since rJava
can be a little fiddly to install, this is only a suggested dependency.
Using rJava transparently starts a single JVM session from R and then
reuses that, substantially speeding up the situation when you have many
small objects to transform. It is also somewhat more efficient in terms of
disk/CPU since points are retained in memory rather than written out as
text files. However in my hands this has limited impact on the elapsed
time.
h5reg
for an example of point transformations using h5
registrations and xform
and xformpoints
for
details of how transformations are handled within the neuroanatomy toolbox
suite.
Other h5reg:
h5reg()
# basic usage
library(nat)
sampleh5path=system.file("samples/JRC2018F_FAFB_extrasmall.h5",
package = 'nat.h5reg')
sampleh5reg=h5reg(sampleh5path)
xform(cbind(50,50,30), sampleh5reg)
xform(cbind(50,50,30), sampleh5reg, swap=TRUE)
## Not run:
# specify a particular level for registration containing more than 1 level
# of detail
# NB not implemented in this sample
xform(cbind(50,50,30), sampleh5reg, level=0)
# choose faster, lower resolution registration
xform(cbind(50,50,30), sampleh5reg, level=2)
# print more detailed error messages when trying to debug
xform(cbind(50,50,30), sampleh5reg, level=0, stderr="")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.