SMLMClustering

Clustering and spatial-statistic backends for single-molecule localization microscopy (SMLM) point data, built on SMLMData.BasicSMLD.

The package exposes three parallel verbs, each dispatched on a concrete configuration type so that the algorithm is selected by which config you pass:

VerbPurposeReturns
clusterassign a cluster label to every emitter(smld_out, ::ClusterInfo)
cluster_statisticscompute read-only spatial statistics(smld, ::ClusterStatisticsInfo)
classify_emittersedge / membrane / interior classification(smld, ::EdgeClassifyInfo)

See the User Guide for the calling conventions and the Methods overview for the full backend catalog and the concepts behind each one.

The same localization field clustered by six backends

One synthetic localization field run through six labeling backends — see the Methods overview.

Quick start

using SMLMClustering

# Density clustering with DBSCAN: every emitter gets a label on a deep copy.
cfg = DBSCANConfig(eps_nm = 50.0, min_points = 5)
smld_out, info = cluster(smld, cfg)

info.n_clusters        # number of clusters found
info.n_noise           # emitters left unclustered (label 0)
info.cluster_sizes     # size of each cluster, indexed by id

# Read-only spatial statistic: is there clustering tendency at all?
_, stats = cluster_statistics(smld, HopkinsConfig())
stats.statistic        # Hopkins H (≈0.5 random, →1 clustered)

# Edge / membrane / interior classification (2D):
_, edge = classify_emitters(smld, KdeValleyConfig())
edge.class             # Vector{Symbol}: :outside / :membrane / :interior

cluster is non-mutating — input emitters are deep-copied and labels are written onto the copy's emitter.id (0 = noise, 1..K = clusters). cluster_statistics is pass-through — it returns the same SMLD reference unchanged alongside an info struct. classify_emitters returns a new SMLD (the input's metadata copied, with the published cell mask added under "edge_cells" / "edge_outer_polygon") alongside its info, which carries the per-emitter class.

Backend catalog

Labeling (cluster): DBSCAN, HDBSCAN, Hierarchical, Voronoi (SR-Tesseler), MRF density-regime, Point hysteresis.

Spatial statistics (cluster_statistics): Hopkins statistic, Voronoi density, Local contrast.

Edge classification (classify_emitters): Edge / Membrane Classification (OuterPolygonConfig, KdeValleyConfig).

Installation

using Pkg
Pkg.add("SMLMClustering")          # once registered in the General registry

Until then, install directly from GitHub:

Pkg.add(url = "https://github.com/JuliaSMLM/SMLMClustering.jl")

License

MIT. Developed in the Lidke Lab at the University of New Mexico.