Skip to main content

napari-isolate-cell

License BSD-3 Python Version tests codecov npe2

A napari plugin to isolate single cell morphologies (e.g., neurons) from label volumes based on a user click, automatically read image scale, and export the isolated structure as TIFF and correctly scaled SWC files.

Demo of napari-cell-isolate plugin


Overview

This plugin helps streamline the process of extracting individual cell structures from dense segmentations, such as those produced by deep learning models like nnUNet.

Key Features:

  • Click-Based Isolation: Simply click on the soma (or any part) of the cell you want to isolate in a Napari Labels layer.
  • Automatic Scale Detection: Reads ZYX scale information directly from TIFF metadata (standard tags or ImageJ metadata) and applies it to the loaded Napari layer.
  • Anisotropy Awareness: Automatically populates the widget's Anisotropy fields based on the detected image scale.
  • Outputs:
    • Adds the isolated cell as a new Labels layer in Napari, preserving the original scale.
    • Saves the isolated label volume as a TIFF file.
    • Saves the skeletonized structure as an SWC file with coordinates reflecting the original image's physical scale (micrometers).
  • Configurable Parameters: Adjust morphological closing radius (defaults to 0 for dense segmentations) and skeleton dust threshold.

Workflow

Workflow diagram

Installation

pip install napari-isolate-cell

Or using uv (faster):

uv pip install napari-isolate-cell

For Developers

git clone https://github.com/serg-bg/napari-isolate-cell.git
cd napari-isolate-cell
pip install -e .[testing]

Usage

  1. Launch napari and open your 3D segmentation (.tif file)
  2. Open plugin: Plugins → napari-isolate-cell → Isolate Cell Arbor
  3. Select your labels layer from the dropdown
  4. Click "Activate Click Isolation"
  5. Click any cell in the viewer to isolate it

Outputs:

  • New labels layer with isolated cell
  • isolated_outputs/ folder containing:
    • .tif - Isolated cell volume
    • .swc - Skeleton with physical coordinates (µm)

Parameters:

  • Morphological Closing: Default 0 (increase to bridge small gaps)
  • Dust Threshold: Default 100 (minimum skeleton branch size in voxels)
  • Anisotropy: Auto-detected from TIFF metadata

Requirements

  • Python >= 3.10
  • napari
  • NumPy
  • scikit-image
  • SciPy
  • tifffile
  • magicgui
  • qtpy

(See pyproject.toml for specific version constraints)

Contributing

Contributions are very welcome. Please file an issue to discuss potential changes or features first. Tests can be run with pytest (pip install -e .[testing] then pytest). Please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the BSD-3 license, "napari-isolate-cell" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for napari-isolate-cell 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for napari-isolate-cell 0.1.2
File Size Uploaded
napari_isolate_cell-0.1.2.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for napari-isolate-cell 0.1.2
File Interpreter ABI Platform
napari_isolate_cell-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.6 kB

Release files / napari_isolate_cell-0.1.2.tar.gz

Download URL napari_isolate_cell-0.1.2.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7cdcdc7b48f7e932e7a05bcae77430d000aed41e40f5613621849bd565eb6579
BLAKE2b-256 checksum
How to use checksums
dc075b628e191a27f3fb3da4f8e94e0489b57e7d65b0f87f671b95f3bde079e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / napari_isolate_cell-0.1.2-py3-none-any.whl

Download URL napari_isolate_cell-0.1.2-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb464813bff2dfdde1338fa5ad506fe2e84d08a334f0c2e3a839a588fe849fbb
BLAKE2b-256 checksum
How to use checksums
14001fdab6ee1f7c48b3fefa6b4f124b62918a115de73ce184935463d53374c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page