Our bridging and mirroring registrations are available for easy offline use through our R packages nat, nat.templatebrains and nat.flybrains.

Installation

Prerequisites

As well as development versions available from GitHub through the previous links, stable versions are periodically released to CRAN (nat and nat.templatebrains). These can be installed in an interactive R session via the following commands:

install.packages('nat')

# install devtools package if you don't already have it
if (!require("devtools")) install.packages("devtools")
# nb this will install the generic templatebrains package from CRAN
devtools::install_github("jefferislab/nat.flybrains")

# to install additional/updated registrations 
# (beyond those distributed as part of the R package)
# Strongly recommended!
nat.flybrains::download_jefferislab_registrations()

Bridging and mirroring example

Below, we briefly show how our R packages can be used to bridge a FlyCircuit neuron in FCWB space into JFRC2 space, followed by a mirroring. To follow along, simply copy and paste the code below into an interactive R session.

library(nat)
library(nat.flybrains)

# Load a neuron
neuron_to_bridge <- kcs20[[1]]

# Display the neuron in 3D
nopen3d()
plot3d(neuron_to_bridge)

# Add the original brain to the 3D display, for context
plot3d(FCWB)

FCWB

# Bridge the FCWB neuron into JFRC2 space
neuron_in_jfrc2 <- xform_brain(neuron_to_bridge, FCWB, JFRC2)

# Plot the bridged neuron in 3D, along with the JFRC2 brain
nopen3d()
plot3d(neuron_in_jfrc2)
plot3d(JFRC2)

FCWB

# Note that the relative position of the neuron in each brain is the same

# Mirror the neuron in JFRC2
neuron_in_jfrc2_mirrored <- mirror_brain(neuron_in_jfrc2, JFRC2)

# Plot mirrored neuron in 3D
plot3d(neuron_in_jfrc2_mirrored)

FCWB