Cluster detection

Function to cluster spots in point cloud and detect relevant aggregated structures. A DBSCAN algorithm is performed.

See an example of application here.

bigfish.detection.detect_clusters(spots, voxel_size, radius=350, nb_min_spots=4)

Cluster spots and detect relevant aggregated structures.

  1. If two spots are distant within a specific radius, we consider they are related to each other.

  2. A minimum number spots related to each others defines a cluster.

Parameters:
spotsnp.ndarray

Coordinates of the detected spots with shape (nb_spots, 3) or (nb_spots, 2).

voxel_sizeint, float, Tuple(int, float) or List(int, float)

Size of a voxel, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same value is applied to every dimensions.

radiusint

The maximum distance between two samples for one to be considered as in the neighborhood of the other. Radius expressed in nanometer.

nb_min_spotsint

The number of spots in a neighborhood for a point to be considered as a core point (from which a cluster is expanded). This includes the point itself.

Returns:
clustered_spotsnp.ndarray

Coordinates of the detected spots with shape (nb_spots, 4) or (nb_spots, 3). One coordinate per dimension (zyx or yx coordinates) plus the index of the cluster assigned to the spot. If no cluster was assigned, value is -1.

clustersnp.ndarray

Array with shape (nb_clusters, 5) or (nb_clusters, 4). One coordinate per dimension for the clusters centroid (zyx or yx coordinates), the number of spots detected in the clusters and its index.