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-0.3.1.tar.gz (965.1 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-0.3.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: napari_myelin_quantifier-0.3.1.tar.gz
  • Upload date:
  • Size: 965.1 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-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b8f22f988416998f4789bb47c7164e1d70b70233ce730611101b2942c142e36b
MD5 58dad7bf905c7a36ad36cb5b39b85e96
BLAKE2b-256 e7036d380c64c7f15cbafdcd9a61a475c56c41f7bf73a0f5b35e6146f95fcd5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_myelin_quantifier-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c782570ec14c162efaad0e92aaff808c924acd3a62de5158634c46a144e0626a
MD5 dbfde50063fb98704fd6fa5bb7d6ba4c
BLAKE2b-256 119eac70eba249d79ca643093901521fb18aa2815392cdde705233cb40a04389

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