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

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.6
File Size Uploaded
thigh_us_segmentation-0.2.6.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thigh-us-segmentation 0.2.6
File Interpreter ABI Platform
thigh_us_segmentation-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / thigh_us_segmentation-0.2.6.tar.gz

Download URL thigh_us_segmentation-0.2.6.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dfcf1c06a719f882c82917af3b4193f388c462040b91f72863dbe0265e529878
BLAKE2b-256 checksum
How to use checksums
e6f1cb57961d2ad10ae47bf017d4d1d77a2698b856bb86b593f6525fb1fbcbff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / thigh_us_segmentation-0.2.6-py3-none-any.whl

Download URL thigh_us_segmentation-0.2.6-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53f6726147f64f10ada7c23f5946142a212c8dd711c11b1d1b22b47f71724025
BLAKE2b-256 checksum
How to use checksums
b343d4e351c8bfa86b869eb2c18eb06e64ab769ecd1b49bbaa046cf274daa2ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release history Release notifications | RSS feed

0.2.7

2 release files

This release

0.2.6 This release

2 release files

0.2.5

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