Skip to main content

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

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)

Source distribution for thigh-us-segmentation 0.2.5
File Size Uploaded
thigh_us_segmentation-0.2.5.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thigh-us-segmentation 0.2.5
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

0.2.7

2 release files

0.2.6

2 release files

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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