LegSegNet is a deep learning system for lower extremity CT tissue segmentation and body composition analysis.
It uses a pretrained nnUNet model to segment four tissue compartments:
- SAT: subcutaneous adipose tissue
- SM: skeletal muscle
- IAT: inter/intramuscular adipose tissue
- Bone
LegSegNet is designed for a practical system: upload a CT slice or NIfTI volume, run segmentation, and export masks and quantitative tissue measurements.
Install the packages and run:
pip install -r requirements.txt
python app.pyThe app automatically detects whether CUDA is available. With a GPU, it uses the full inference settings with mirroring and 0.5 tile overlap (Can be customized for patient user).
On CPU, it disables mirroring and uses tile_step_size=1.0, which is faster but may slightly reduce accuracy.
Use the Single Slice (PNG) tab for one 2D CT slice.
The input PNG should be:
- Clip HU to
[-200, 200] - Scale to
[0, 255]as 8-bit grayscale
LegSegNet accepts different image sizes, and resizes the slice to 256 x 256 before inference.
Outputs:
- segmentation overlay
- downloadable mask
- tissue quantification
Use the 3D Volume (NIfTI) tab for .nii or .nii.gz CT volumes.
The system:
- Loads the volume and creates a coronal preview of the legs
- Lets user click two points to choose the axial range
- Runs slice-by-slice nnUNet inference on the selected range
- Returns an overlay grid, body composition measurements, and a downloadable 3D mask NIfTI
For volume inputs, LegSegNet reports tissue volume and mean CT attenuation for SAT, SM, IAT, and bone.
The LegSegNet model is available at: LegSegNet weights
Download following files and put them under model folder as follow:
model/
|-- plans.json
|-- dataset.json
|-- fold_0/
|-- checkpoint_best.pth
If your model files are stored somewhere else, update MODEL_FOLDER in inference.py.
If you find LegSegNet useful, please cite the manuscript:
@article{chen2026legsegnet,
title={LegSegNet: A Public Deep Learning System for Lower Extremity CT Tissue Segmentation and Quantification},
author={Chen, Yuwen and Chen, Yaqian and Colglazier, Roy and Dong, Haoyu and Gu, Hanxue and Mazurowski, Maciej A and Southerland, Kevin W},
journal={arXiv preprint arXiv:2605.30829},
year={2026}
}
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0). See the LICENSE file for details.

