Myelin Quantifier

Myelinated Axon Quantification with Label Tracking

  • Wulin Teo

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.

Version:

  • 1.1.1

Last updated:

  • 2026-03-26

First released:

  • 2026-02-06

License:

  • MIT

Supported data:

  • Information not submitted

Plugin type:

Open extension:

Save extension:

Python versions supported:

Operating system:

  • Information not submitted

Requirements:

  • numpy
  • magicgui
  • qtpy
  • scikit-image
  • napari[all]; extra == "all"
Website by the napari team, original design by CZI. Go to napari main website.