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
  • nnU-Net v2 >= 2.6
  • OpenCV (opencv-python-headless >= 4.8, < 5.0)

nnU-Net compatibility

ThighUSSegmentation has been successfully tested with the following nnU-Net versions:

  • 2.6.0
  • 2.6.4
  • 2.7.0
  • 2.8.1

The pretrained models were originally developed using nnU-Net 2.6.4.

Compatibility with future nnU-Net versions is not guaranteed.

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

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.9
File Size Uploaded Provenance Actions
thigh_us_segmentation-0.2.9.tar.gz 16.9 kB Without provenance Details for thigh_us_segmentation-0.2.9.tar.gz

Built distribution (wheel)

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

Total release size: 36.0 kB

Release files / thigh_us_segmentation-0.2.9.tar.gz

Download URL thigh_us_segmentation-0.2.9.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9bc685d4dab949f95d7f3cdaee76aa2f730963cdd27969da510af992f08c317b
BLAKE2b-256 checksum
How to use checksums
a4fc70a95dd1c5c89ed1ae53235d9d78c24da48facb5013bb45b844acdc4bcdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

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

Download URL thigh_us_segmentation-0.2.9-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4e993f9596f9bf15ba8e180762ab419807b011c76c1cc61deafd1490f7b8eaa
BLAKE2b-256 checksum
How to use checksums
c6076cfe1ebd4a22fb1569c1de25dfe1dca7760d973015487b8c05c56ea6ccab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for thigh-us-segmentation 0.2.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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