mirror_fafb: Mirror an object in FAFB space using FAFB-JRC2018F...

View source: R/mirror.R

mirror_fafbR Documentation

Mirror an object in FAFB space using FAFB-JRC2018F registration

Description

Mirror an object in FAFB space using FAFB-JRC2018F registration

Usage

mirror_fafb(x, sample = NULL, subset = NULL, via = NULL, ...)

Arguments

x

An object containing 3D vertices (e.g. a neuron, surface, points)

sample

The starting brain space in which x lives - FAFB14 by default if it is not otherwise other specified.

subset

Character, numeric or logical vector specifying on which subset of X the function FUN should be applied. Elements outside the subset are passed through unmodified.

via

(optional, for expert use only) Intermediate template brain that the registration sequence must pass through. See details and xform_brain for more information.

...

Additional arguments passed to xform_brain and mirror_brain

Details

This function works by mapping the input data to JRC2018F, a high quality symmetric female brain template. The data are then flipped (since JRC2018F is symmetric no other action is required) and then returned to the starting space. In order to ensure that the Bogovic et al bridging registrations are preferred the via argument will be filled with the value "FAFB14um" i.e. FAFB14 calibrated in microns. This works because the Bogovic registrations were based on a mock synaptic staining using synapse locations that had been rescaled to microns before calculating a registration with ANTs to JRC2018F.

Value

A mirrored version of the neuron/surface or other 3D object.

Examples


# transform arbitrary location (in nm)
mirror_fafb(cbind(388112, 162988, 132840))
# same but in units of microns
mirror_fafb(cbind(388.112, 162.988, 132.84), sample='FAFB14um')
# no messages
mirror_fafb(cbind(388112, 162988, 132840), Verbose=FALSE)

# transform arbitrary location (from and to raw pixel coordinates)
voxel.size=c(4,4,40)
mirror_fafb(cbind(97028, 40747, 3321)* voxel.size)/c(voxel.size)

library(nat.flybrains)
if(require('elmr', quietly = TRUE)) {
FAFB.surf.m <- mirror_fafb(FAFB14.surf)
wire3d(as.mesh3d(FAFB.surf), col='blue')
wire3d(as.mesh3d(FAFB.surf.m), col='red')
}

## Not run: 
# you can also use with points in https://flywire.ai space
# converts from raw (voxel) coords used by Neuroglancer to nm and back again
voxel.size=c(4,4,40)
mirror_fafb(cbind(120508, 46292, 1667)*voxel.size, sample='FlyWire')/voxel.size
# compare with just using FAFB14
mirror_fafb(cbind(120508, 46292, 1667)*voxel.size)/voxel.size

## End(Not run)


jefferis/nat.jrcbrains documentation built on June 28, 2023, 4:06 a.m.