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

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

Built distribution (wheel)

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

Total release size: 35.5 kB

Release files / thigh_us_segmentation-0.2.7.tar.gz

Download URL thigh_us_segmentation-0.2.7.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a3efb46a99b28f2e353fee39f3062bc7088b3a006f7872dbd50fa454e63058e2
BLAKE2b-256 checksum
How to use checksums
3c2afb18c88f93f4a65e7440cae3fde993f9ed25a31269c2220c3975c9bd41a0
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.7-py3-none-any.whl

Download URL thigh_us_segmentation-0.2.7-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15d69c27697645a4c8fe4157746d582af5ddec66b20a3c41206abd43a55e9360
BLAKE2b-256 checksum
How to use checksums
18fe99c1d78017a7e81f566dc53acd04366f211baab13df29f75550e27ad1a46
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

This release

0.2.7 This release

2 release files

0.2.6

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