Skip to main content

myoL3

Automated L3-level trunk-muscle analysis from CT. Give it a full-body CT; it localizes the L3 level and crops to it, segments the trunk muscles, strips interior fat, and quantifies per-muscle, per-side body composition.

Hugging Face | GitHub


Pipeline

full-body CT  ->  L3 localizer (presence-gated sliding window)  ->  z-crop
              ->  muscle segmentation (nnU-Net, in-Python)       ->  raw labels
              ->  strip interior fat (intramuscular adipose tissue) ->  TOTAL muscle seg
              ->  per-muscle / per-side composition metrics       ->  JSON

Muscles: psoas, quadratus lumborum, erector spinae / multifidus. The muscle/low-attenuation split is a per-scan, per-muscle Gaussian Mixture Model (GMM) crossover; interior fat (< −30 Hounsfield units, HU) is removed to form the total-muscle segmentation.

GMM crossover — a muscle's HU values form two overlapping populations, denser normal muscle and lower-HU fatty muscle. The GMM fits one bell curve to each and puts the split where they cross, so the threshold adapts to each patient rather than using a fixed cutoff.

Models. The L3 localizer is a Residual Network (ResNet-18) slice encoder with a bidirectional Gated Recurrent Unit (GRU) over the superior–inferior axis, a soft-argmax boundary head, and a presence head. The muscle segmenter is a 3D UNet (no-new-UNet / nnU-Net, full-resolution configuration) run with sliding-window inference in Python.


Installation

Install PyTorch first (pytorch.org), then:

pip install myoL3

Download the model weights (localizer + segmenter, once only):

myol3-install /path/to/models/dir

On shared HPC clusters, point at existing files instead:

export MYOL3_LOCALIZER_CKPT=/shared/models/myol3/l3_localizer.pt
export MYOL3_SEGMENTER_CKPT=/shared/models/myol3/muscle_seg.pth

Usage

# full pipeline -> total muscle seg + composition map + metrics JSON
myol3 -i fullbody_ct.nii.gz -o total_muscle_seg.nii.gz \
      --save-comp composition.nii.gz --save-metrics metrics.json

# localize + crop only (no segmentation model needed)
myol3 -i fullbody_ct.nii.gz --save-crop l3_crop.nii.gz
Flag Description
-i, --input full-body CT (.nii / .nii.gz) — required
-o, --output total muscle segmentation (interior fat stripped); omit to only localize/crop
--save-crop also write the L3-cropped CT
--save-comp also write the 4-compartment map (muscle*10 + compartment)
--save-metrics also write per-muscle / per-side metrics (.json)
--localizer-ckpt / --segmenter-ckpt checkpoint overrides
--pad extra slices each side of the L3 crop
--device cpu | cuda (auto if unset)

Python API:

import myol3
myol3.run("fullbody_ct.nii.gz", "total_muscle_seg.nii.gz",
          save_comp="composition.nii.gz", save_metrics="metrics.json")

Metrics

Per muscle × side (L/R), in mm² (mean, median, std, n_slices):

  • muscle_csa — total-muscle cross-sectional area (edge-outlier trimmed)
  • fat_pv_muscle_csa — low-attenuation ("fat partial-volume") muscle
  • intramuscular_fat_csa — solidly-fat interior (intramuscular adipose tissue, IMAT)
  • outer_edge_pv_fat_csa — partial-volume boundary rim

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myol3-0.1.5.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

myol3-0.1.5-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file myol3-0.1.5.tar.gz.

File metadata

  • Download URL: myol3-0.1.5.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for myol3-0.1.5.tar.gz
Algorithm Hash digest
SHA256 db25352a8d33295aa8541ed3f72370e2b2a89821cb865a1e5a2fe9f9e406bb78
MD5 1bad79ae295ab9e6cfc5b1685a2a0f3a
BLAKE2b-256 a252e5c3ebe0387195301495002df79b6b4eb9e32308f74979b55e7756ad9396

See more details on using hashes here.

File details

Details for the file myol3-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: myol3-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for myol3-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6256d17cc5a7204e6cd4fcfc0f454bf11964ddf8e18797cf82ca7db07c068432
MD5 3bf280b419e0788bce5e7f348826c876
BLAKE2b-256 6afb6ddb9dfaeee76ff1c032043f19162ec16b5f04b03648a7228b5cdf66cede

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page