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. amesh3dorhxsurf) or a list of them, in nm.- syn
A lazy table of synapses with positions: columns
idandpre_x...post_zin raw voxels, such asaedes_synapse_data(details = TRUE). A data frame with these columns also works.- vd
Voxel dimensions in nm, to convert
syn's positions to nm.
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).