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.2.tar.gz (16.8 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.2-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myol3-0.1.2.tar.gz
  • Upload date:
  • Size: 16.8 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.2.tar.gz
Algorithm Hash digest
SHA256 3e7ecc9d6525a82a6ad9da9ad3216e20199e53dcb0d90b22476d268a2c901de4
MD5 4069f2ec07bb6319981301cbdb20d224
BLAKE2b-256 de782e53e7a486feac6c55b0cc6797fd874aae60db23f751c02e1db946edb871

See more details on using hashes here.

File details

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

File metadata

  • Download URL: myol3-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 557f3afdea4688ccef42625b26f5768e177f99be8f60f921f0cb091118558376
MD5 c08b47451522af6ae0a36aa80cdc0c08
BLAKE2b-256 153a75c72d53e507204b8b5dcb35e72197e5c6b2122de51b6993e8d349a6f6e2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

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