Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LegSegNet

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.

System overview PDF

3D segmentation view PDF

Run

Install the packages and run:

pip install -r requirements.txt
python app.py

The 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.

2D Slice Inference

Use the Single Slice (PNG) tab for one 2D CT slice.

The input PNG should be:

  1. Clip HU to [-200, 200]
  2. 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

3D Volume Inference

Use the 3D Volume (NIfTI) tab for .nii or .nii.gz CT volumes.

The system:

  1. Loads the volume and creates a coronal preview of the legs
  2. Lets user click two points to choose the axial range
  3. Runs slice-by-slice nnUNet inference on the selected range
  4. 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.

Model Weights

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.

Citation

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}
}

License

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages