SynapseDensity

class singlecell_input_mapper.udvary2022.synapse_mapper.SynapseDensity(cell, postCellType, connectionSpreadsheet, exTypes, inhTypes, exPST, inhPST)

Bases: object

Compute synapse density mesh from a PST density mesh.

Given a PST density mesh, create a 3D mesh of synapse densities for a single postsynaptic neuron using compute_synapse_density(). It is assumed that exPST and inhPST have the same bounding box and voxel size. This density mesh is used in SynapseMapper to assign synapses to the postsynaptic neuron.

This class is used in NetworkMapper to compute synapse densities per presynaptic cell type for a given postsynaptic cell type and morphology.

exPST and inhPST are density meshes for normalizing post-synaptic targets. Shown below is an example for such density field: the (25000, 50000, 75000, 100000) isosurfaces of the excitatory PST density field for a rat somatosensory cortex (pia and white matter shown in grey at the top and bottom).

../../../../_images/exPST_solid_bg.png

Note

The only cell type specificity that is considered here is whether or not the postsynaptic cell is excitatory or inhibitory. Cell type wiring specificity is only considered in the network realization phase, when the synapse density field is Poisson sampled and normalized. Then the normalization values depend on the exact presynaptic cell type.

See also

See: NetworkMapper

Parameters:
cell : Cell

the postsynaptic neuron

postCellType : str

cell type of the postsynaptic neuron

connectionSpreadsheet : dict | DataFrame

spreadsheet containing length/surface area PST densities.

exTypes : list

list of strings defining excitatory cell types.

inhTypes : list

list of strings defining inhibitory cell types.

exPST : ScalarField

normalization PST for connections with presynaptic excitatory cell types.

inhPST : ScalarField

normalization PST for connections with presynaptic inhibitory cell types.

Attributes:
cellPST

Nested dictionary containing the 3D length/surface area density of the postsynaptic neuron. See compute_cell_PST() for details.

Type:

dict

densityGrid

Dictionary mapping the cell’s “mesh”, “origin”, “extent”, “spacing” and “bBox” to their correpsonding tuple or ScalarFieldScalarField.

Type:

dict

Methods:

compute_synapse_density_vectorized(boutonDensity, preCellType)

Vectorized version of synapse density computation.

compute_synapse_density(boutonDensity, preCellType)

Compute the density of synapses of a given presynaptic celltype onto the postsynaptic neuron.

compute_cell_PST()

Compute density of postsynaptic targets (PSTs) for each anatomical structure as a full bounding-box spanning mesh.

_compute_length_surface_area_density(likeAmira)

Fills the scalar fields lengthDensity and surfaceDensity to contain length and area per structure per voxel.

_clip_u(pq, u1u2)

Liang-Barsky clipping algorithm [14] for line segments in 3D.

_get_truncated_cone_area(height, radius1, radius2)

Calculate the are of a truncated cone.

_interpolate_radius(p0, p1, radius0, radius1, targetPt)

Interpolate the radius of a segment between two points.

_compute_cell_density_grid()

Create an empty mesh for the postsynaptic neuron to match the mesh of the synapse distribution.

_intersect_bboxes(bbox1, bbox2)

Check if two bounding boxes overlap