Skip to contents

Returns the ids of the synapses whose location (the midpoint of their pre and postsynaptic points) lies inside any of the given meshes, e.g. to label synapses by brain region.

Usage

aedes_synapses_in_mesh(
  surf,
  syn = aedes_synapse_data(details = TRUE),
  vd = aedes_voxdims()
)

Arguments

surf

A mesh (anything rgl::as.tmesh3d() accepts, e.g. a mesh3d or hxsurf) or a list of them, in nm.

syn

A lazy table of synapses with positions: columns id and pre_x...post_z in raw voxels, such as aedes_synapse_data(details = TRUE). A data frame with these columns also works.

vd

Voxel dimensions in nm, to convert syn's positions to nm.

Value

An integer vector of synapse ids.

Details

A single pass over syn keeps the synapses inside the bounding box of any of the meshes; only those are read into R and tested against each mesh with nat::pointsinside(), which is much faster when the natcpp package is installed (you are reminded once per session if not).

Examples

if (FALSE) { # \dontrun{
neuropil_ids <- aedes_synapses_in_mesh(aedes_neuropil_mesh)
} # }