Skip to main content

Isolate soma‑specific arbors & export SWC.

Project description

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

For Users (Recommended)

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: Pluginsnapari-isolate-cellIsolate 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.

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_isolate_cell-0.1.2.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_isolate_cell-0.1.2-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file napari_isolate_cell-0.1.2.tar.gz.

File metadata

  • Download URL: napari_isolate_cell-0.1.2.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for napari_isolate_cell-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7cdcdc7b48f7e932e7a05bcae77430d000aed41e40f5613621849bd565eb6579
MD5 e3ae855b581694c9dae3fbc2643def9d
BLAKE2b-256 dc075b628e191a27f3fb3da4f8e94e0489b57e7d65b0f87f671b95f3bde079e4

See more details on using hashes here.

File details

Details for the file napari_isolate_cell-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_isolate_cell-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb464813bff2dfdde1338fa5ad506fe2e84d08a334f0c2e3a839a588fe849fbb
MD5 18bfdebaee87f3f50257d9bff07e6adb
BLAKE2b-256 14001fdab6ee1f7c48b3fefa6b4f124b62918a115de73ce184935463d53374c0

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