Skip to main content

Pediatric hip geometry engine for developmental dysplasia of the hip (DDH) analysis from pelvic X-rays

Project description

Pelvitect

Pediatric Hip Geometry Engine for Developmental Dysplasia of the Hip (DDH)

PyPI Python License: MIT [PelviSet DOI]

Pelvitect is an open-source Python library that measures and classifies developmental dysplasia of the hip (DDH) from anteroposterior pelvic radiographs. Given anatomical landmarks — provided manually or predicted by bundled SegFormer-B3 and ViTPose-Plus-Base models — it deterministically computes:

Output Description
Acetabular index (AI) Hilgenreiner line ∠ acetabular roof
Center-edge angle (CE) Perkins line ∠ ASM → FHC
Tönnis grade (I–IV) FHC quadrant position
IHDI grade (I–IV) MOFM position relative to H, P, D-lines
Hilgenreiner / Yamamuro / Smith distances Displacement metrics
Shenton line continuity Arc gap in pixels
Image quality control MTDDH symmetry standard (ORI, OAR, IRI, IAR)

Pelvitect is the geometry engine behind PelviSet — a unified dataset of 14,622 pediatric pelvic radiographs.


Installation

pip install pelvitect

Python ≥ 3.9 required.


Quick start

Full auto-inference from an image URL

import numpy as np, requests
from PIL import Image
from io import BytesIO
from pelvitect import Pelvitect

url = "https://prod-images-static.radiopaedia.org/images/155111/24d626dbf763635f29e9f4efeacbb1_big_gallery.jpg"
img = np.array(Image.open(BytesIO(requests.get(url).content)).convert("RGB"))

# Downloads both models on first call (~380 MB total)
result = Pelvitect(image=img).analyze()
print(result.summary())

Input modes

Constructor call What runs
Pelvitect(landmarks=lm) Pure geometry — no models
Pelvitect(mask=mask) Mask-derived landmarks + Shenton + QC
Pelvitect(mask=mask, landmarks=lm) Combined — KPs take priority over mask, mask adds Shenton + QC
Pelvitect(image=img) Full auto: SegFormer-B3 → ViTPose → geometry

Output schema

result.to_dict() / result.to_json() return a structured dict:

{
  "landmarks": {
    "tcc_r": {"x": 200.0, "y": 300.0, "source": "provided"},
    ...
  },
  "metrics": {
    "ai_l":     {"value": 28.4, "status": "computed", "unit": "°"},
    "h_dist_l": {"value": 45.0, "status": "computed", "unit": "px"},
    ...
  },
  "classifications": {
    "tonnis_l": {"grade": "I",  "status": "computed", "note": ""},
    "ihdi_l":   {"grade": "II", "status": "computed", "note": "MOFM below H-line …"},
    ...
  },
  "quality_control": {
    "status": "pass",
    "caution_msg": "",
    "criteria": [
      {"name": "ORI", "value": 1.02, "range": [0.78, 1.42], "status": "pass"},
      ...
    ]
  }
}

Models

Model Architecture Input HuggingFace
pelvitect-seg SegFormer-B3 512×512 RGB amirmmahdavikia/pelvitect-seg
pelvitect-kp ViTPose-Plus-Base (4-ch) 256×192 ROI crop amirmmahdavikia/pelvitect-kp

Both models are trained on PelviSet and download automatically from HuggingFace Hub on first use. Model weights are cached at ~/.cache/huggingface/hub/.


Coordinate conventions

  • Origin: top-left of image; y increases downward (standard image convention).
  • Patient right hip = image left (smaller x).
  • Landmark keys: {name}_{side} where l = patient left, r = patient right.
  • Default coordinate space: pixel. Pass coord_space="normalized" for [0, 1] inputs with image_size=(w, h).

Image quality control

Pelvitect automatically assesses radiograph quality when a segmentation mask is available, using the MTDDH symmetry standard (Qi et al., Scientific Data 2025):

Metric Definition Accepted range
ORI Obturator rotation index [0.78, 1.42]
OAR Obturator area ratio [0.77, 1.46]
IRI Ilium rotation index [0.71, 1.22]
IAR Iliac area ratio [0.71, 1.22]

A violation produces a WARNING status and caution_msg:

"Image quality criterion failed (ORI). Measurements should be interpreted with caution."

The QC result is a non-blocking warning — all geometry measurements are still returned.


Dataset

PelviSet is available at Zenodo and HuggingFace:

14,622 cases · 4 sources · 3 institutions · 2 countries · 12-class segmentation · 8-point keypoints · geometry-derived clinical labels


Citation

If you use Pelvitect in research, please cite:

@software{mahdavikia2026pelvitect,
  author    = {Mahdavikia, Amir M.},
  title     = {Pelvitect: Pediatric Hip Geometry Engine},
  year      = {2026},
  version = {0.1.0},
  doi     = {10.xxxx/zenodo.xxxxxxx},
  url     = {https://doi.org/10.xxxx/zenodo.xxxxxxx}
}

License

MIT — see LICENSE.

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

pelvitect-0.1.0.tar.gz (75.4 kB view details)

Uploaded Source

Built Distribution

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

pelvitect-0.1.0-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file pelvitect-0.1.0.tar.gz.

File metadata

  • Download URL: pelvitect-0.1.0.tar.gz
  • Upload date:
  • Size: 75.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pelvitect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a51b731fdc04b89acd75708e0bac0cee5e5fbf1498f24f360c46be07a773c7ab
MD5 0b746a8875285da5ce87cbddd501bfdb
BLAKE2b-256 9315173abdaa11b33cba80142c698a5d5ed4a2643fe586b92a23be36c2478406

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelvitect-0.1.0.tar.gz:

Publisher: publish.yml on ammomahdavikia/pelvitect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pelvitect-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pelvitect-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pelvitect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22947140ca7473fb771cd039389ff696143bd2827f9b7942c30205ae63ba570f
MD5 657d3a53ca5f70ee715e722f6cf2f9cc
BLAKE2b-256 2b260a2bb3aa62215fce1c6eddb45f3568c37bd0d49d0f99725079ab0ca52249

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelvitect-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ammomahdavikia/pelvitect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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