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 accepts either:

  • A 2D binary mask layer

Expected mask semantics:

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

If your mask is stored as RGB/RGBA or grayscale, use the optional Quick Mask Prep section in the quantify panel to convert it into a binary mask first.

Quick Mask Prep (Optional)

This helper is intended for users who already have a segmented mask, but the file is stored as RGB/RGBA or grayscale instead of a clean binary mask.

Available quick actions:

  • 1-Channel → create a single-channel image layer
  • Invert → create an inverted single-channel image layer
  • Binary (Otsu) → convert the selected layer into a binary Labels layer

The prepared binary layer is automatically selected in the quantifier mask layer field so you can run quantification immediately.

Example Binary Mask

Binary Mask

Image courtesy of Bo Hu Lab, Houston Methodist Research Institute.

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 your mask into napari.

  2. If needed, use Quick Mask Prep to convert RGB/RGBA or grayscale mask images into a binary mask.

  3. Open:

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

  • Minimum lumen area

  • Exclude border objects (recommended)

  1. Run quantification.

  2. Optional: open Plugins → Myelin Rings: Locate by ID to jump to a specific ring_id.

  3. Export CSV.

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

Interface

Interface

Acknowledgements

Example microscopy data used in documentation were generated by the Bo Hu Lab, Houston Methodist Research Institute.

Imaging hardware and infrastructure support were provided by the Electron Microscopy Core, directed by István Katona, Houston Methodist Research Institute.

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.1.1.tar.gz (967.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_myelin_quantifier-1.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: napari_myelin_quantifier-1.1.1.tar.gz
  • Upload date:
  • Size: 967.6 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.1.1.tar.gz
Algorithm Hash digest
SHA256 c6bad6e80f69c12d0f8eac7bcb9d37ddbb5f3a359872fc8aee190e0e24ac10b6
MD5 9c3f5bfaf86550a7e79125b7f82499a0
BLAKE2b-256 35ec6d93dda4e07a0fb49ec35da26b85b93acb970098e8dd35a55ba1edc59458

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_myelin_quantifier-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9da862c930fbca1a77168fabd3297984f1ea7ce4215d025a60f9a18c3e00d63f
MD5 b18fc5df0f5ba2b0491d64d7e4025a8b
BLAKE2b-256 57a1096558ada6db9908a40d668b83896622554b9393004aae92b72239197c72

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