Skip to content
PointillViz
PointillViz

© 2026 PointillViz

Local Cell Density

by PointillViz reference tools

How crowded the tissue is around every cell.

Verifiedv1.1.0
  • qc
  • density
  • cells
  • series
  • summary
k-th neighbour density map: a crowded epithelial band over loose stroma, cooling at the section edge
k-th neighbour density map: a crowded epithelial band over loose stroma, cooling at the section edgeArtwork from the tool’s bundle

Readme

Answers the question: How densely are cells packed around each individual cell?

For each cell i, the tool measures the distance ri to its k-th nearest neighbour within the same section. This distance defines a circle in 2D or a sphere in 3D around the cell that contains its k nearest neighbours. A smaller circle or sphere indicates more closely packed cells and therefore a higher local density. Local density is calculated as:

in 2D, and:

in 3D.

Map. Each cell is colored by its local density: brighter colors indicate higher density, darker colors lower density, and unpainted cells have no result.

Plot. Cells are sorted by local density. The x-axis shows the percentage of cells, and the y-axis shows the corresponding density. A point at (80%, y) means that 80% of cells have a local density of y or lower, while 20% have a higher density. At 50%, the curve therefore shows the median density.

Parameters

ParameterTypeDefaultWhat it does
Neighbours (k)k int, 3–50 10 Sets how many nearest neighbours are used to estimate local density. Larger values measure density over a broader area and produce a smoother result.
Scalescale select, 2 options log10 density Sets whether density is shown directly or on a log10 scale.

Outputs

  • cellspaints the spatial view
  • seriesreturns a line chart
  • summarywrites a summary

Tool check

The nine gates this version passed when it was published.

Verified

Passed 9 of 9 gates

  1. bundle pass
  2. manifest pass
  3. entry pass
  4. imports pass, advisory
  5. fixture pass
  6. result pass
  7. determinism pass
  8. edge pass
  9. no_mutation pass
  1. bundle pass

    4 files, 8.0 kB packed and 34.7 kB unpacked, plugin.json at the root.

  2. manifest pass

    local-density 1.1.0 by PointillViz reference tools; entry tool.py, outputs cells, series, summary, 120 s and 2048 MB budget.

  3. entry pass

    tool.py imported in 0.20 s and defines run(ds, params).

  4. imports advisory pass

    1 Python file, importing numpy; no network, subprocess, filesystem-write, dynamic-exec or environment use found.

  5. fixture pass

    ran on the 600-cell fixture in 0.28 s of its 120 s budget, returning summary, cells, series.

  6. result pass

    returned the declared outputs: summary, cells, series.

  7. determinism pass

    two runs with identical parameters produced byte-identical results (17.7 kB of JSON).

  8. edge pass

    ran at the minimum corner (k=3) in 0.28 s; ran at the maximum corner (k=50, scale='linear') in 0.29 s.

  9. no_mutation pass

    the fixture dataset's 4 files are byte-identical after every run (plugin_cache/, where ds.knn caches, is excluded by design).

Passed every required gate when this version was published. That is a statement about the gates, not about whether the code is safe to run.

Versions

  1. v1.1.0 latest
  2. v1.0.0

More tools