Skip to main content

Myelinated Axon Quantification with Label Tracking

Project description

napari-myelin-quantifier

License MIT PyPI Python Version napari hub


Overview

napari-myelin-quantifier is a napari plugin for quantitative analysis of 2D cross-sectional myelinated axons from binary segmentation masks.

The plugin identifies individual myelin rings, assigns a unique ring_id to each structure, and exports morphometric measurements for downstream analysis.

It enables reproducible extraction of:

  • Axon diameter
  • Fiber diameter
  • Myelin thickness
  • g-ratio

Installation

Install via pip:

pip install napari-myelin-quantifier

If napari is not installed:

pip install "napari-myelin-quantifier[all]"

Development version:

pip install git+https://github.com/wulinteousa2-hash/napari-myelin-quantifier.git

Input Requirements

The plugin requires a binary mask layer:

  • Myelin = foreground (1 / True)
  • Background = 0 / False
  • Recommended: clean segmentation without holes or broken rings

Example Binary Mask

Binary Mask

Ring Detection and Labeling

Each connected myelin ring is:

  • Assigned a unique ring_id

  • Spatially localized using centroid coordinates

  • Evaluated for ring topology using Euler characteristic

Example Labeled Output

MultiROI

MultiROI_ring_ID

Topological Validation (Euler Characteristic)

The Euler number ensures valid ring topology:

  • Euler = 0 → valid ring (one hole)

  • Euler ≠ 0 → solid object or fragmented structure

This prevents non-myelinated artifacts from being included in analysis.

Topology Illustration

Euler = 0 and  ≠ 0

Quantitative Output (CSV)

For each ring, the plugin exports:

ring_id

centroid_x, centroid_y

bbox_x0, bbox_y0, bbox_x1, bbox_y1

ring_area_px

lumen_area_px

filled_area_px

euler

touches_border

Example:

ring_id,centroid_x,centroid_y,bbox_x0,bbox_y0,bbox_x1,bbox_y1,ring_area_px,lumen_area_px,filled_area_px,euler,touches_border
1,873.8658,34.4421,857,18,890,52,380,556,936,0,False

Derived Morphometric Parameters

Assuming approximately circular cross-sections:

Axon diameter:

d_axon = 2 × sqrt(lumen_area / π)

Fiber diameter:

d_fiber = 2 × sqrt(filled_area / π)

Myelin thickness:

t = (d_fiber − d_axon) / 2

g-ratio:

g = d_axon / d_fiber

Note: These are geometric approximations. For highly irregular axons, area-based statistics may be preferable.

Typical Workflow

  1. Load binary mask into napari.

  2. Open:

  • Plugins → Myelin Quantifier
  1. Adjust filtering parameters:
  • Minimum ring area

  • Minimum lumen area

  • Exclude border objects (recommended)

  1. Run quantification.

  2. Export CSV.

  3. Perform statistical analysis in Python, R, or Excel.

Interface

Interface

Contributing

Contributions are welcome. Please ensure tests pass before submitting pull requests.

License

MIT 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_myelin_quantifier-1.0.0.tar.gz (964.3 kB view details)

Uploaded Source

Built Distribution

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

napari_myelin_quantifier-1.0.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file napari_myelin_quantifier-1.0.0.tar.gz.

File metadata

  • Download URL: napari_myelin_quantifier-1.0.0.tar.gz
  • Upload date:
  • Size: 964.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for napari_myelin_quantifier-1.0.0.tar.gz
Algorithm Hash digest
SHA256 62099308b59fa8f06b8616fb54d537549580d4e7f1d8f44fbaa2159483622cd5
MD5 f4fc0f2b4d8306df0bd5e84be6a278f7
BLAKE2b-256 d63d340e9d0f71502626c96bb793c4b491385fa1adbc2a2301c0dc282edb920d

See more details on using hashes here.

File details

Details for the file napari_myelin_quantifier-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_myelin_quantifier-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2df89d681b4f28fc01ff2c0b828a3ca886895050f9b229facf566163a57c5a39
MD5 67cfe27cc154e520a5047bc363c98c07
BLAKE2b-256 1641df27f3d3b19f73b09033a5dec10a26dbf1d4c8daaaec65a36dcb5697372e

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