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.4.tar.gz (17.0 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.4-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myol3-0.1.4.tar.gz
  • Upload date:
  • Size: 17.0 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.4.tar.gz
Algorithm Hash digest
SHA256 9064dd8cbaf585c07cc50ca6b9d90bae550b0cfd2a5694f1e44d43546b440dc5
MD5 92bfc5c7c84dd0ce82e596e3e1ee06b0
BLAKE2b-256 92b792b2098a92ac47d19aa21189f274003e8c3f15200777e89658001d811403

See more details on using hashes here.

File details

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

File metadata

  • Download URL: myol3-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 554c0dbda98dbc8f2c6e302136f3c5a4de891fd120ab0b5c8cb9ea00861a6c31
MD5 30f5a4941e012a8a274ccd95673c886e
BLAKE2b-256 fb53b86a9af985778503a4985dfd80f06985dc3cf04204180bca339bbbbf61b9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5

2 files

This release

0.1.4 This release

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