Software for Spectral-Lifetime Indexing of Cells (SLIC), a single-cell barcoding strategy that combines fluorescence lifetime, spectral imprint and subcellular localization to identify many cell populations within one mixed sample, and to read a biosensor from each of them.
A barcode is a fluorophore whose lifetime and emission spectrum, together with the subcellular compartment it is targeted to, identify the cell carrying it. A single FLIM acquisition records a photon-arrival histogram per pixel in four spectral windows; averaged over a segmented cell, this yields five values β the phasor coordinates G and S, and three spectral intensity ratios. Cells sharing a barcode occupy the same region of that five-dimensional space, so clustering assigns each cell its barcode.
Decoding follows that principle: organelle-localized fluorescence images are segmented with a fine-tuned Cellpose model, cells are classified by five-dimensional clustering, and the biosensor module then segments and tracks cells in the time-lapse channels, aligns each with its barcode identity, and extracts its signal kinetics.
https://baoyi-a.github.io/nacha-demo/ runs the plugin on the demo dataset
in a browser, with no local setup. It starts a cloud machine on demand and
re-installs from this repository's main on every cold start, so it runs the
published code.
Two independent tools, each with its own README, its own environment, and no code shared between them.
π§© Napari_plugin/ |
SLIC, the napari plugin β also known as NaCha, which is its final widget and the name the hosted demo goes by. Seven widgets carry an acquisition from a raw .ptu to one biosensor readout per barcode. Installs as bc-flim-spectra. |
π§ LUMINA_classification/ |
LUMINA (Lifetime-based Unmixing for Multiplexed ImagiNg and bArcoding) β the deep-learning classifier for dual-anchor barcodes, where one cell carries two fluorophores in two compartments. |
π€ .claude/skills/ |
One agent skill per tool, allowing a coding assistant to install and operate either of them. See below. |
Releases are tagged and archived on Zenodo; the DOI above always resolves to
the most recent archived version. The classification pipeline the manuscript
describes is that of release 1.1 and later (see VERSIONING.md);
the 1.0.x archive predates it.
The SLIC napari plugin runs the full workflow, from .ptu ingestion through
segmentation, classification and tracking to alignment and visualization.
The last step, NaCha, on a sixteen-barcode dish: cells coloured by barcode class, one cell's biosensor channels and G/B ratio below, and the widget on the right. Screenshots of every step are in the plugin README.
Seven widgets, listed under Plugins β bc-flim-spectra. Each has a blue
Next βΆ button that opens the following one, so the workflow chains without
returning to the menu.
- π₯ PTU Reader β import and decode FLIM
.ptufiles. - π¬ Barcode Seg (Cellpose) β N / P segmentation on the barcode intensity image, with online single- or multi-folder fine-tuning.
- π Calculate FLIM-S β lifetime / phasor computation.
- π§© Seeded K-Means β semi-supervised barcode classifier (Basu et al. 2002), with per-class outlier flagging. Four alternative clusterers ship alongside it.
method_kmeans.mp4
How the classifier places a cell: seeds carried from another batch, whitening by the pooled within-cluster spread of the batch being classified, seeded K-means refining the centres on that batch, then an isolation forest that sets aside the most anomalous tenth of each cluster rather than assign a cell it cannot place. Click to play.
- π‘ Biosensor Seg (Cellpose) β dual-input segmentation on the confocal biosensor stack, using the barcode classification mask as an auxiliary channel. A biosensor experiment without barcodes also runs: the widget and NaCha detect that the sample has no barcode, skip the barcode steps, and read out every cell as one group (details).
- π¬ B&P Tracker β multi-cell tracking in dense cultures, based on XMem with a short-horizon, periodically reset memory.
- π NaCha β final alignment and per-class signal readout / visualization.
demo.mp4
Sixteen barcoded populations in one dish, read out one at a time: each column is a barcode, its biosensor, the three confocal channels, and that population's own response to the stimulus. A full step-by-step instruction video is on Zenodo.
Every widget has a β¨ Shortcuts button listing the keys of that step, including Alt+1β¦9 to show or hide layers (full table), and an β How to use button with the step-by-step notes.
β‘οΈ Installation and full usage: Napari_plugin/README
LUMINA (Lifetime-based Unmixing for Multiplexed ImagiNg and bArcoding) is a deep-learning framework that integrates fluorescence lifetime, spectral features and subcellular localization to decode dual-anchor barcodes at single-cell resolution β one fluorophore on a nuclear anchor, a second on a mitochondrial anchor.
Reducing a cell to five averaged values cannot separate two fluorophores in two compartments, so LUMINA operates on the pixels. Each segmented cell becomes a six-plane stack: the per-pixel phasor G and S, three spectral intensity ratios, and the intensity. Each plane has its own convolutional stem; the planes are fused in a shared trunk and read out by two independent classifier heads under a class-balanced loss, so one forward pass decodes both anchors. Training is two-stage: pre-training on single-anchor data, then fine-tuning on dual-anchor data.
- π§Ή
Data_prep.pyβ build the per-cell six-plane crops from decoded FLIM data. - ποΈ
Train_LUMINA.pyβ pre-training and fine-tuning. - π
Test_LUMINA.pyβ inference, with per-cell confidence scoring. - π₯
Visualize_heatmap.pyβ the nuclear-by-mitochondrial co-occurrence figure. - π―
Finetune_LUMINA.pyβ adapt a trained checkpoint to a new cell line.
β‘οΈ Installation and full usage: LUMINA_classification/README
- Python >= 3.9 (tested on Python 3.10)
- Operating system:
- Tested on: Windows 11
- Expected to work on: Windows 10/11, Linux (Ubuntu 20.04)
- GPU: optional (CUDA-enabled GPU recommended for acceleration)
Typical installation time: ~20β60 minutes depending on whether PyTorch/CUDA wheels need to be downloaded and the network speed.
- Typical processing time per dataset: ~10β15 minutes on a CUDA GPU, most of it spent looking at masks rather than waiting.
- Tracking step: ~5 minutes (included above).
- Check the "Compute:" line in the segmentation panel first. The default PyTorch package has no GPU support, and on CPU segmentation of one 2048 Γ 2048 field takes tens of minutes instead of seconds. Nothing fails β it is just slow, and the header is the only place that says so.
- Runtime otherwise depends on dataset size, number of cells, and hardware.
- Inference on a single sample/image: ~1 second
- Including preprocessing (e.g., segmentation / data extraction): typically 3 minutes
- Model training (if performed) can take longer and depends on dataset size and GPU.
The repository carries its documentation in a form coding assistants read, to the agents.md and Agent Skills conventions used by Claude Code, Codex, Cursor and Copilot. Pointed at this repository, an assistant can install either tool, explain a parameter, and read a sample folder to report which steps have run and whether they look right.
Given only this repository, Claude Code builds an environment, installs the
plugin and runs all seven steps on a 1.5 GB acquisition, from .ptu decoding to
one signal curve per barcode.
Against the hand-curated version of the same field:
| π§© Barcode identity | 271 of 271 cells got the same barcode. None wrong. Shuffling the labels drops it to 21β28 %, so the agreement is real. |
| π¬ Segmentation | F1 0.83 (nuclei) and 0.87 (cytoplasm) at IoU β₯ 0.5; 0 splits, 1 merge |
| π End to end | 77 % of curated cells got the correct barcode, 5 % were declined as outliers, 18 % were never segmented, 0 % got a wrong one |
Wherever it finds a cell, the barcode call matches ours. What a fully automatic run costs is coverage, not correctness β the stock nucleus model finds about three quarters of the nuclei our fine-tuned-and-curated reference has. The plugin provides fine-tuning on the user's own cells, which closes that gap.
The run took an afternoon on Claude Opus, most of it GPU time, and a few million tokens β tens of dollars of model usage. One field of one acquisition: a reproduction check, not a benchmark.
Napari_plugin/scripts/workflow_status.py reads a sample folder and reports
which steps have run, quality checks on what they produced, and what is left.
Read-only; no napari, no GPU.
python Napari_plugin/scripts/workflow_status.py <sample folder> [ done] 3 Calculate FLIM-S rows=834, fovs=1, localisations={'N': 418, 'P': 416}
[ done] 4 Seeded K-Means clustered=418, classified=373, declined=45, classes=10
[ done] 5 Biosensor Seg seg_images=1, masks=1, confocal_stacks=3
[ check] registration best=90 CW, 90CW coverage=0.966, purity=0.998
Quality checks
PASS S stays under the semicircle apex (0.5) -- max S = 0.4997
PASS lifetimes are physical (0.1-10 ns) -- 1.24-3.80 ns
PASS barcode classes land on biosensor cells -- 96.6% of cells, purity 99.8%
Next
- Seeded K-Means: 416 row(s) were never clustered β it runs one localisation
at a time and only ['N'] has been done.
- Steps 5-7 (biosensor) have not run. They need the confocal B/G/Y stacks.
It checks the decay stacks, the masks, the phasor coordinates against the
universal semicircle, the lifetimes, the declined fraction, the class sizes, and
the registration β all four rotations, reporting coverage and purity, since
coverage alone cannot separate a correct alignment from a wrong one. --json
for scripting; exit status 1 on a failed check, so it gates too.
| File | Contents |
|---|---|
AGENTS.md |
Repository layout, installation, the three-environment design, the headless testing pattern, and the conventions the code follows. Claude Code picks it up through the one-line CLAUDE.md. |
.claude/skills/slic-napari/ |
The plugin: seven steps control by control, how to read each output, the failure modes with the check that identifies each, and installation notes. |
.claude/skills/lumina-network/ |
LUMINA: the scripts, the data layout they expect, the training recipe, how to read the confidence outputs, and how to adapt a trained checkpoint to a new cell line. |
Parameter descriptions in the skills were written against the widget tooltips and the argument parsers in the source. Nothing keeps them in step automatically, so where the two disagree the source is what runs.
BSD 3-Clause License. See Napari_plugin/LICENSE for the full text.
The tracking code vendored under Napari_plugin/src/flim_s_gen/ β tracker/,
inpainter/, tools/ and track_anything_simple.py β comes from
Track-Anything and stays under its own
MIT licence, Copyright (c) 2023 Mingqi Gao. That is the licence file sitting beside it
at Napari_plugin/src/flim_s_gen/LICENSE; it covers those files, not this package.
- These tools are under active development.
- The manuscript describing the methods has been submitted but not yet published. The DOI will be provided once it becomes available. The schematics above are figure panels from that manuscript.
- The instruction video walks through the plugin step by step.
- The Dual-Anchor dataset, used for training the LUMINA network, is also provided.
- The segmentation models the plugin loads by default, together with the eight models whose performance the manuscript reports, are archived separately.
- A demo dataset is included for testing the Napari plugin functionalities.
- The original version of all software code has been archived as well.


