Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 2.86 KB

README.md

File metadata and controls

96 lines (69 loc) · 2.86 KB

natverse Lifecycle: maturing Docs R-CMD-check

nat.h5reg

nat.h5reg enables the Neuroanatomy Toolbox (nat) suite to carry out 3D coordinate transforms of arbitrary objects based on deformation fields encoded in the HDF5 registration format of Stephan Saalfeld and John Bogovic.

Installation

You can install the development version of nat.h5reg from GitHub with:

devtools::install_github('natverse/nat.h5reg')

See below for information about Java installation.

Example

A round trip test using a bridging registration between two template brains.

library(nat.h5reg)

# We will use sample Kenyon Cells in FCWB (FlyCircuit) space
library(nat)
head(kcs20)

# swap=FALSE, so this will map points onto JRC2018F 
kcs20.jrc2018 = xform(kcs20, 
  reg = h5reg('JRC2018F_FCWB_transform_quant16.h5', swap=FALSE)
)

# map back again (round trip test)
kcs20.rt = xform(
  kcs20.jrc2018,
  reg = h5reg('JRC2018F_FCWB_transform_quant16.h5')
)

plot3d(kcs20.jrc2018, col='green')

clear3d()
plot3d(kcs20, col='red')
plot3d(kcs20.rt, col='blue')

diffs=xyzmatrix(kcs20)-xyzmatrix(kcs20.rt)
str(diffs)
plot(as.data.frame(diffs))

Java

You will need to have Java installed on your system to use h5 format registrations. This will usually mean installing a Java Development Kit (JDK). These now come in a confusing number of flavours, but for personal use, the easiest is probably to install the latest stable Oracle JDK. At the time of writing this functionality was tested versus Oracle JDK 11.0.2.

You can find out about your java installation by doing:

nat.h5reg::dr_java()

You may run into errors installing the rJava package. This typically happens because of mismatch between the version of your JDK and what R is expecting. If this happens try (in the Terminal)

# make sure java is in your path
java --version
# tell R about your current version java
R CMD javareconf

Now in R, try installing rJava again

install.packages("rJava")

Acknowledgements

Based critically on https://github.com/saalfeldlab/transform-helpers/ kindly first written during a trip to Cambridge by Stephan Saalfeld.