Skip to main content

Pipeline for thigh ultrasound segmentation using nnU-Net and anatomical distance analysis.

Project description

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, < 3.11 · SimpleITK · OpenCV · NumPy / SciPy / Pandas · Matplotlib · nnU-Net v2

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thigh_us_segmentation-0.2.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thigh_us_segmentation-0.2.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file thigh_us_segmentation-0.2.1.tar.gz.

File metadata

  • Download URL: thigh_us_segmentation-0.2.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for thigh_us_segmentation-0.2.1.tar.gz
Algorithm Hash digest
SHA256 db65c2a12e736b4cef695ee4141562fb312e9773f7d090fce44240cb0dac13c9
MD5 c28a81de5a5558bb483f4702435ad6b9
BLAKE2b-256 e63db2833d722e709713f4ea441050eacbf12a88b011d41aad3fd113041a4a98

See more details on using hashes here.

File details

Details for the file thigh_us_segmentation-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thigh_us_segmentation-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e15881e3bdd55508e9330c8e6216f9971fa4156dccb14e741243b00cf9f485d9
MD5 3566a9f7fb0692aa511076db042bb9c5
BLAKE2b-256 cac203c2b1c9cc06f2bd59dc3f0a3d3813143d776770183fd64a8ba200c28c4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page