Skip to main content

A napari plugin for manual cell tracking curation

Project description

napari-cell-curator

A napari plugin for manual curation of cell tracking data from time-lapse microscopy experiments.


Overview

napari-cell-curator provides a full-featured dock widget that lets you inspect, correct, and annotate cell tracks directly inside napari. It works with a standard triplet of files:

File Description
cell_tracks.csv Tracking table with columns trackId, frame, Center_of_the_object_0, Center_of_the_object_1, continuous_label, Outcome, Parent_ID
cell_mask.tif 4-D label image (T × H × W, uint32)
cell_image.tif 4-D raw microscopy image (T × H × W)

Installation

pip install napari-cell-curator

For video export support, also install:

pip install "imageio[ffmpeg]"

Usage

  1. Open napari.
  2. Go to Plugins → Cell Curator Pro.
  3. Browse to your CSV, mask TIFF, and image TIFF files.
  4. Click Load and Open Curator.

The curator dock panel will appear on the right side of the viewer.

Mouse shortcuts

Action Result
Shift + Click on a cell Loads that cell's ID into box [A]
Ctrl + Click on a cell Loads that cell's ID into box [B]
X or x Delete cell [A] from the current frame
Ctrl + Z Undo the last operation (up to 3 steps)

Toolbar Buttons

Basic Tools

Button Description
Undo Reverts the last operation (up to 3 steps).
Shuffle Colors Randomizes the napari label color seed. Useful to distinguish adjacent cells.
Merge Replaces every occurrence of ID [A] with ID [B] across the entire video and CSV.
Swap/Cut (From this frame forward) Swaps IDs [A] and [B] from the current frame to the end. If [B] is 0, a new ID is generated automatically.
Local Swap (THIS frame only) Swaps [A] and [B] only in the current frame.
Baptize Mask (New ID) Assigns a fresh unique ID to the mask currently painted as [A].
Sync Paintings (This Frame) Reads the label image for the current frame and updates the CSV centroids accordingly.
Sync Everything (Entire Video) Recalculates centroids from the label image for all frames and reconciles the CSV.
Harmonize Colors Detects disconnected regions sharing the same ID and splits them. Then aligns continuous_label with trackId.
Delete Cell [A] (This frame) Erases the mask of cell [A] from the current frame and removes its CSV row.
Exterminate Track [A] (Entire video) Removes cell [A] from every frame of both the mask and the CSV.
Rescue Orphans Finds masks in the label image that have no corresponding CSV row and assigns them new IDs.
Auto-Tracking (ID [A] only) Runs conflict resolution (automatic local swap), predator-mode absorption, and centroid gap filling for track [A].

Outcome Flags

Applied to track ID [A]. Flags are automatically propagated to all frames of the track by the visual engine.

Button Flag value
Flag: MITOSIS Mitosis
Flag: END (Left the frame) End
Flag: DEATH/SENESCENCE Death/Senescence
Clear Flags from ID [A] Removes all manual flags; the auto-organizer keeps Start on the first frame.

Lineage Tree

Button Description
Link Mother [A] -> Daughter [B] Sets [A] as the parent of [B] in the Parent_ID column. Automatically flags [A] as Mitosis.
Re-sequence Tree Renumbers all lineage IDs hierarchically (family 1 → daughters 11, 12 → grandchildren 111, 112, 121…). Also handles individually flagged cells without children.
Cut Post-Mitosis Ghosts Detects mother cells that continue to exist in the mask after their division frame and splits them off with new IDs.
View Lineage Tree Graph Opens a matplotlib window showing the full lineage tree.

Navigation

Button Description
Focus Mode Isolates a single cell in the viewer. All other masks are hidden. Click again to disable.
Jump to Next Unlinked Cell Advances the viewer to the next frame containing a cell with no lineage assignment and no outcome flag.

Diagnostics & Export

Button Description
Run Diagnostics Prints a quality report to the terminal: short tracks, time gaps, spatial jumps, anomalous mitosis durations, and cells without a final outcome flag.
Export Cell Video [A] Saves a 100×100 px MP4 cropped around cell [A] with its mask highlighted in cyan.
Export Presentation (Screen) Saves a full-resolution screen capture of the napari canvas as an MP4.
SAVE ALL AND ANALYZE ERRORS Runs quality control (short tracks, gaps, jumps), shows an interactive dialog to remove or keep anomalies, checks for duplicate IDs, and writes the CSV and mask TIFF to disk.

CSV Format

The plugin reads and writes a CSV with at minimum these columns:

trackId, frame, Center_of_the_object_0, Center_of_the_object_1, continuous_label, Outcome, Parent_ID
  • Center_of_the_object_0 → X coordinate (column)
  • Center_of_the_object_1 → Y coordinate (row)
  • Outcome → One of Start, Mitosis, End, Death/Senescence, or empty
  • Parent_ID → ID of the mother cell, or -1 if none

Older CSV files using the column name Desfecho instead of Outcome are automatically migrated on load and save.


Requirements

  • Python ≥ 3.9
  • napari ≥ 0.4.17
  • numpy, pandas, tifffile, magicgui, qtpy, matplotlib, scikit-image
  • imageio[ffmpeg] (optional, for video export)

License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_cell_curator-0.1.1.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_cell_curator-0.1.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file napari_cell_curator-0.1.1.tar.gz.

File metadata

  • Download URL: napari_cell_curator-0.1.1.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for napari_cell_curator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c6d313385eb84511ccd897570e60cb98a5892398bc593c12cd42baa32a017a67
MD5 e4459e9d09384952fc02e30e07d85aa8
BLAKE2b-256 a8819b5f02c943a197399bee36bc17deceaddb7ffcf10ae15000d9288868d54c

See more details on using hashes here.

File details

Details for the file napari_cell_curator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_cell_curator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3431f5448aa5ba50268c512ce22f0c192b12ea751b4cd28b504ba69079d5c5a
MD5 334868e94121d642d655998e04ffb395
BLAKE2b-256 f2f941f9cbb63c87cf344aa365f26a81bbe4db3ffd0779baedf2b82404d51898

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page