Skip to content

Repository files navigation

STRAIGHT 🩻

This repository contains the code for the STRAIGHT study. STRAIGHT is a landmark-based deep learning framework for automated assessment of sagittal (patient) rotation in upright posteroanterior (PA) chest radiographs. Rotation is conventionally assessed by eye from the asymmetry between the medial clavicular ends and the thoracic spinous process midline; STRAIGHT automates this by localizing the medial ends of the left and right clavicles and a point on the spinous process midline at that level, then computing a rotation index (Alpha) that classifies the radiograph as left-rotated, non-rotated, or right-rotated. The framework is designed to be interpretable: it exposes the intermediate anatomical measurements behind each classification.

Comparison of the ground-truth rotation label with the STRAIGHT and direct CNN outputs

How STRAIGHT works

STRAIGHT is a two-stage pipeline.

1. Landmark localization. An HRNet-W48 backbone (ImageNet-pretrained, regression head) predicts three landmark x-coordinates on a 512×512 radiograph:

  • X1 — medial end of the right clavicle
  • X2 — medial end of the left clavicle
  • X3 — point on the spinous process midline at the level of the medial clavicular ends

2. Alpha-based rotation classification. The right and left clavicle-to-spinous-process distances (RCSP, LCSP) are derived from the landmarks and combined into a dimensionless rotation index, Alpha:

RCSP  = |X1 - X3|            # right clavicle-to-spinous process distance
LCSP  = |X2 - X3|            # left  clavicle-to-spinous process distance
alpha = (RCSP - LCSP) / (RCSP + LCSP)

Positive Alpha indicates leftward rotation and negative Alpha indicates rightward rotation. Alpha is then thresholded at ±0.2 to assign a class: alpha >= 0.2Left rotate, -0.2 < alpha < 0.2Normal, and alpha <= -0.2Right rotate.

How the ±0.2 threshold was set

The absolute Alpha cutoff was derived empirically. Seven experienced radiographers visually labeled a 770-radiograph sample as rotated or non-rotated; against the majority-vote reference, ROC analysis with Youden's J identified 0.2 as the optimal absolute-Alpha threshold (AUC 0.911, J 0.68). This threshold is not a clinical standard, but rather a data-driven choice for this study. For clinical use, further validation would be recommended.

Dataset

A balanced dataset of 650 radiographs was drawn from a prospective collection of PA chest radiographs from adult volunteers at Golden Jubilee Medical Center, Thailand. All images were anonymized and converted from DICOM to PNG at 512×512 pixels. Radiographs with scoliosis, or with artifacts or pathology obscuring a medial clavicular head, were excluded. Each image was manually annotated with the X1, X2, and X3 landmarks (reviewed by an expert radiographer), and the set was split into train (500) / validation (50) / test (100).

Dataset composition

The dataset is available on Google Drive.

Comparisons

  • Direct CNN classifier — the same HRNet-W48 backbone trained end-to-end on the three rotation classes (no explicit landmarks), as a non-interpretable baseline.
  • Landmark-based human assessment — 9 radiographers annotated X1X3, and the same ±0.2 threshold was applied to their Alpha values.
  • Visual human assessment — 20 radiographers classified the test set by eye.

Results on the 100-radiograph test set

Test-set results

ROC-curve

Repository structure

STRAIGHT/
├── train_STRAIGHT.ipynb            # Train/evaluate the landmark-regression (STRAIGHT) model
├── train_Classification_model.ipynb# Train/evaluate the 3-class classification CNN baseline
├── analyze.ipynb                   # Compare STRAIGHT vs classification model (metrics, ROC, Grad-CAM)
├── human_analyze.ipynb             # Compare models against human rater agreement/performance
└── requirements.txt

Environment Setup

python3 -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt

Requires Python 3.8+ and a CUDA-capable GPU is recommended for training.

Training

Landmark regression (STRAIGHT): Run train_STRAIGHT.ipynb — trains an HRNet-W48 backbone with a regression head to predict X1, X2, X3, and reports MAE against ground-truth landmarks.

Classification baseline: Run train_Classification_model.ipynb — trains an HRNet-W48 classifier directly on the 3 rotation classes (Left rotate / Normal / Right rotate).

Both notebooks expect a CSV-indexed image dataset split into Train / Validation / Test folders — update the hard-coded dataset paths at the top of each notebook to match your local data layout.

Evaluation

  • analyze.ipynb — loads both trained models, computes MAE/accuracy/sensitivity/specificity/precision/F1, confusion matrices, bootstrap ROC-AUC with 95% CI, and Grad-CAM visualizations; saves qualitative comparison figures per outcome category (both right, both wrong, etc.).
  • human_analyze.ipynb — computes inter-rater ICC and weighted Cohen's kappa for human raters, per-rater performance vs. ground truth, model-vs-human comparison tables, statistical tests (Cochran's Q, McNemar's), and radar/ROC plots. Expects rater result CSVs under a Result/ directory (not included in this repo).

Requirements

See requirements.txt. Core dependencies: PyTorch, torchvision, timm (HRNet-W48), segmentation-models-pytorch, OpenCV, scikit-learn, pingouin, pytorch-grad-cam.

Citation

If you use this code or models in your research, please cite the DeepInspire study.

License

This repository is provided for research purposes. Please contact the authors for licensing information.

Mail: paritt.w@gmail.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages