ThighUSSegmentation
Python library for automatic thigh ultrasound segmentation and analysis using nnU-Net.
Features
- Automatic image conversion to
.mha - Preprocessing (active region detection)
- nnU-Net inference
- Muscle thickness computation
- Export of anatomical landmarks (
.mrk.json) - Automatic model download from Zenodo
Installation
pip install thigh-us-segmentation
Usage
from ThighUSSegmentation import run_full_pipeline
result = run_full_pipeline(
input_image_path="image.dcm",
output_root="outputs",
case_id = "case001"
)
print(result["df_results"])
# OR
result = run_full_pipeline(
input_image_path="image.mha",
output_root="outputs",
models_root="D:/my_models", #You can also specify your own model path.
)
Output
outputs/
└── case001/
├── case001_image_converted.mha
├── case001_image_preprocessed.mha
├── case001_labelmap.mha
├── case001_segmentation.seg.nrrd
├── inference_log.txt
└── markups/
├── case001_epidermis.mrk.json
├── case001_fascia_lata.mrk.json
├── case001_aponeurosis.mrk.json
├── case001_femur.mrk.json
└── case001_central_line.mrk.json
Returned Results
The pipeline returns a dictionary:
{ "case_id": str, "segmentation_path": str, "mrk_paths": dict, "df_distances": pd.DataFrame, "df_results": pd.DataFrame }
Model
The pretrained nnU-Net model is automatically downloaded from Zenodo on first use.
Expected strucutre:
Dataset001_ThighUS/
└── nnUNetTrainer__nnUNetPlans__2d/
├── dataset.json
├── plans.json
├── fold_0/
├── fold_1/
├── fold_2/
├── fold_3/
└── fold_4/
Requirements
· Python >= 3.10 · OpenCV · nnU-Net v2 = 2.6.4
Citation
If you use this work, please cite:
Isensee et al., nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation. Nature Methods (2021)
Mara Concepción Alavarez. (2026). Thigh Ultrasound Segmentation Model (nnU-Net). Zenodo. https://doi.org/10.5281/zenodo.19914473
License
This project uses the following licenses: · Code: MIT License (or the one you choose) · Model weights (Zenodo): CC-BY 4.0
Metadata
Release files for thigh-us-segmentation 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| thigh_us_segmentation-0.2.5.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| thigh_us_segmentation-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.1 kB
Release files / thigh_us_segmentation-0.2.5.tar.gz
| Download URL | thigh_us_segmentation-0.2.5.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39b9e7255b792c1c21e6d9dc09d1450a66de1a3962a2a3db4b45356a8a50dfd2
|
|
BLAKE2b-256 checksum How to use checksums |
48b86d38899258eb5816e5f59349a8b94f4458e98159c435cd7dfee468f14823
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / thigh_us_segmentation-0.2.5-py3-none-any.whl
| Download URL | thigh_us_segmentation-0.2.5-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d6987be35ecc9492b8ed805658fab6dd06b3b615fcd21cdcb4ba907e90b1ff6
|
|
BLAKE2b-256 checksum How to use checksums |
4d5ca5507d42399a7f84aa562a06c5f170b8cdfb93b9b7aea8b5ceef4103e0e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|