Dataset Viewer
The dataset could not be loaded because the splits use different data file formats, which is not supported. Read more about the splits configuration. Click for more details.
Couldn't infer the same data file format for all splits. Got {NamedSplit('train'): ('json', {}), NamedSplit('validation'): ('csv', {}), NamedSplit('test'): ('imagefolder', {})}
Error code:   FileFormatMismatchBetweenSplitsError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Spine Analysis Pipeline Dataset

This dataset contains a complete muscle segmentation pipeline for thoracic kyphosis analysis. It includes pre-trained models, analysis scripts, and processed datasets for spinal health assessment on CT imaging.

Overview

This dataset provides a pipeline for automated muscle segmentation and intramuscular fat quantification on CT scans. It includes pre-trained nnU-Net models for segmenting nine bilateral trunk muscle groups, analysis scripts for computing fat percentages, and correlation analysis tools for linking muscle composition to thoracic kyphosis severity.

Key Results

  • nnU-Net segmentation achieved Dice scores >0.85 across all nine muscle groups (macro ≈ 0.90)
  • Inter-observer reliability (5 raters, n=21): ICC(2,k) = 0.927 (95% CI 0.859–0.955) - Excellent reliability
  • Strong correlations between thoracic curvature and fat% in posterior extensors: trapezius (r=0.77), rhomboid (r=0.66), and latissimus dorsi (r=0.66)
  • Large-scale validation (n=250) confirmed associations in paraspinal (r=0.43), trapezius (r=0.38), and quadratus lumborum (r=0.36)
  • Quality-Control (QC) Validation: The same 21 development cases were processed through the trained nnU-Net model to enable paired comparison between manual and automated segmentation. Automated masks yielded systematically lower fat% than manual masks, consistent with reduced boundary leakage and improved specificity

Dataset Contents

Data Availability

Important: To conserve repository storage space:

  • All label files are uploaded across all datasets (manual segmentations, model predictions, and quality-control data)
  • Image files are NOT uploaded except for 100-120/images_100-120/ which contains the development dataset CT scans
  • Test cohort images (251-500) are excluded from the repository
  • nnUNet preprocessed data is also excluded due to large file sizes

To obtain the missing image data:

  • Training images (251-500): Available at the AtlasDataset repository (see model_training/251-500_in/README.md for details)
  • Preprocessed data: Can be generated by following nnUNet preprocessing steps (see model_training/nnUNet_preprocessed/README.md)

This approach allows the repository to contain all analysis results, models, and scripts while keeping the total size manageable.

Pre-trained Models

  • nnUNet_results/Dataset101_FinalSet/nnUNetTrainer__nnUNetPlans__3d_fullres/fold_all/ - Complete trained model
    • checkpoint_best.pth - Best performing model weights (macro Dice ≈ 0.90)
    • checkpoint_latest.pth - Latest training checkpoint
    • debug.json - Complete training configuration and hyperparameters
    • progress.png - Training progress visualization
    • training_log_*.txt - Detailed training logs with epoch-by-epoch metrics
  • Model Architecture: 3D U-Net with 6 stages, features [32, 64, 128, 256, 320, 320]
  • Training Configuration:
    • Patch size: [112, 128, 128] voxels
    • Batch size: 2 with gradient accumulation
    • Loss function: Deep supervision with Dice + Cross-entropy
    • Optimizer: SGD with momentum (0.99), weight decay (3e-05)
    • Learning rate: 0.01 with polynomial scheduler
  • Hardware: Trained on NVIDIA GH200 (480GB HBM3) with CUDA 12.8
  • env_snapshot.txt - Complete computational environment specifications

Training Data

  • 100-120/ - Development dataset (n=21 cases, cases 100-120)
    • images_100-120/ - Original CT volumes (21 cases × 0000.nii.gz files)
    • labels_9_muscles/ - Manual muscle segmentations (ground truth, 21 cases × .nii.gz files)
    • label_9_muscles_model_pred/ - Quality-Control (QC) Predictions: Automated nnU-Net segmentations on the same 21 development cases
      • Trained model applied to cases 100-120 for direct comparison with manual segmentations
      • Enables paired QC analysis: manual vs automated masks on identical CT scans
      • Validates that automated masks provide tighter boundaries than manual contours
    • labels_original/ - Original AtlasDataset labels (21 cases × AtlasDataset_000100-120_remapped_remapped.nii.gz)
  • model_training/251-500_in/ - Replication/Test cohort (250 cases, cases 251-500)
    • Input CT volumes (NOT included, see README in this folder)
    • Referenced from AtlasDataset for independent validation
  • model_training/251-500_out/ - nnU-Net segmentation outputs
    • Automated muscle segmentations for independent test cohort fat% quantification
    • Not included due to file size constraints

Preprocessed Data

  • nnUNet_preprocessed/Dataset101_FinalSet/ - Standardized preprocessing
    • Isotropic resampling, HU clipping, z-score normalization
  • nnUNet_raw/Dataset101_FinalSet/ - Raw nnU-Net dataset structure
    • 3D full-resolution training configuration

Processed Results

Analysis Data

  • cobb_angles/ - Thoracic kyphosis measurements (T1-T12/L1 sagittal Cobb angles)
    • dev_cobb.csv - Five-observer reliability data (21 cases × 5 raters)
      • Grand mean: 39.8 ± 4.4 degrees
      • ICC(2,k) = 0.927 (95% CI: 0.859–0.955)
      • Per-case across-rater SD: 6.9 ± 2.8 degrees
    • test_cobb.csv - Single-observer test cohort (250 cases)
      • Mean: 36.8 ± 12.1 degrees (median: 35.0, IQR: 28.0–43.0)
  • fatty_data/ - Intramuscular fat quantification (HU < -20 threshold)
    • dev_fat.csv - Development cohort fat% data (21 cases × 9 muscles, using manual masks)
    • test_fat.csv - Test/replication cohort fat% data (250 cases × 9 muscles)
    • model_pred_dev.csv - Quality-Control fat%: Development cohort using automated nnU-Net masks
      • Same 21 cases (100-120) as dev_fat.csv but using model-predicted segmentations
      • Enables paired QC comparison: manual vs automated fat% on identical scans
      • Validates that automated segmentation reduces boundary leakage
    • *_mean_std.csv - Summary statistics (mean ± SD fat%) for all cohorts

Quality-Control (QC) Data

  • fat_filtered_100-120/ - Fat-filtered segmentations for QC analysis
    • labels_9_muscles_fat_filtered/ - Manual labels with fat voxels labeled (HU < -20 → label 10)
    • label_9_muscles_model_pred_fat_filtered/ - QC automated labels with fat voxels labeled
    • Enables direct comparison of fat boundary detection between manual and automated methods

Analysis Results

  • ICC_results/ - Inter-observer reliability analysis
    • dev_cobb_summary.csv - ICC(2,k) = 0.927 (95% CI: 0.859–0.955)
      • Five-rater analysis with bootstrap confidence intervals
      • Per-case across-rater SD: 6.9 ± 2.8 degrees
    • sagittal_icc_results.csv - Detailed ICC metrics and inter-rater variability analysis
    • sagittal_inter_rater_variability.png - Inter-rater variability visualization
    • test_cobb_summary.csv - Single-observer statistics for replication cohort
  • pearson_correlation/ - Pearson correlation analysis results
    • dev_cobb_corr/ - Development cohort (n=21) correlations and visualizations
      • Includes aggregate 3×3 muscle grid plots
    • test_cobb_corr/ - Replication cohort (n=250) correlations and validation plots
      • Includes aggregate 3×3 muscle grid plots
    • dev_model_cobb_corr/ - QC correlation analysis using automated masks

Analysis Scripts

scripts/ICC_analysis.py - Inter-Observer Reliability Analysis

  • Computes ICC(2,k) with bootstrap confidence intervals
  • Two-way random-effects ICC, bootstrap CIs (n=5000), inter-rater variability analysis

scripts/fatty_analysis.py - Intramuscular Fat Quantification

  • Calculates fat% using HU threshold (HU < -20)
  • Voxel-level intensity filtering, nine muscle group analysis, cohort processing

scripts/pearson_analysis.py - Correlation Analysis

  • Computes Pearson correlations between Cobb angles and fat%
  • Development vs. replication cohort comparisons, statistical significance testing

scripts/correlation_plot.py - Visualization Generation

  • Creates publication-quality correlation plots
  • Trapezius scatter plots, 3×3 aggregate grids, high-resolution figures

scripts/fat_filter.py - Quality-Control Testing Script

  • Purpose: Implements paired quality-control analysis comparing manual vs automated muscle segmentations
  • Function: Applies fat filtering (HU < -20 → label 10) to both manual and model-predicted masks
  • Key Features:
    • Processes both manual labels (labels_9_muscles/) and model predictions (label_9_muscles_model_pred/)
    • Identifies voxels with HU < -20 within muscle boundaries and labels them as fat (label 10)
    • Preserves original muscle labels (1-9) while adding fat annotations
    • Generates fat-filtered versions for direct comparison studies
  • Output: Creates fat_filtered_100-120/ directory with processed segmentations
  • Clinical Significance: Enables validation that automated masks provide tighter muscle boundaries than manual contours, reducing boundary leakage and improving fat% specificity

scripts/model_dev_pred_fatty_analysis.py - Automated Mask Analysis

  • Purpose: Computes fat% using automated nnU-Net segmentations on development scans
  • Function: Applies trained model to same 21 cases used for manual segmentation
  • Key Features:
    • Uses model predictions on cases 100-120 for paired comparison with manual masks
    • Calculates fat% using identical HU threshold (HU < -20) methodology
    • Generates model_pred_dev.csv with automated fat% measurements
    • Enables direct comparison: manual vs automated fat% on identical CT scans
  • Clinical Significance: Validates that automated segmentation can enhance biomarker precision by reducing boundary overestimation errors

Muscle Groups Analyzed

The pipeline segments and analyzes nine bilateral trunk muscle groups:

  1. Psoas - Hip flexor muscle
  2. Quadratus lumborum - Posterior extensor (strong correlation: r=0.36)
  3. Paraspinal - Core posterior extensor (strong correlation: r=0.43)
  4. Latissimus dorsi - Upper back muscle (development: r=0.66)
  5. Iliacus - Hip flexor
  6. Rectus femoris - Thigh muscle
  7. Vastus - Thigh muscle
  8. Rhomboid - Upper back muscle (development: r=0.66)
  9. Trapezius - Key posterior extensor (strongest correlation: r=0.77 dev, r=0.38 test)

Key Results Summary

Development Cohort (n=21)

  • Five-observer Cobb angles: Mean 39.8 ± 4.4 degrees
  • ICC(2,k): 0.927 (95% CI: 0.859–0.955) - Excellent reliability
  • Per-case across-rater SD: 6.9 ± 2.8 degrees
  • Strongest correlations: Trapezius (r=0.77), Rhomboid (r=0.66), Latissimus dorsi (r=0.66)
  • Quality-Control validation: Same 21 cases processed with trained nnU-Net for paired comparison
  • Multi-observer averaging enhanced sensitivity to broad compositional changes

Replication/Test Cohort (n=250)

  • Single-observer Cobb angles: Mean 36.8 ± 12.1 degrees (median: 35.0, IQR: 28.0–43.0)
  • Range: 12.0–87.0 degrees
  • Anatomically focused on posterior extensors
  • Strongest correlations: Paraspinal (r=0.43), Trapezius (r=0.38), Quadratus lumborum (r=0.36)
  • Real-world heterogeneity validated core biomechanical relationships

nnU-Net Performance

  • Macro Dice: ~0.90 across all muscle groups
  • Individual muscles: All >0.85 Dice scores
  • 3D full-resolution configuration with compound loss function

Methodology Highlights

Manual Cobb Measurement

  • Standard: T1–T12/L1 sagittal Cobb angle following radiographic conventions
  • Multi-observer: 5 trained observers for reliability assessment
  • Single-observer: 250-case replication cohort for scalability

Automated Segmentation

  • nnU-Net 3D full-resolution configuration
  • Compound loss: Dice + cross-entropy
  • Data augmentation: Random rotations, elastic deformations, intensity jitter
  • Preprocessing: Isotropic 1.5mm resampling, HU clipping (-250 to 250), z-score normalization

Fat% Quantification

  • Threshold: HU < -20 (established CT attenuation for intramuscular adiposity)
  • Method: Voxel-level intensity filtering within muscle masks
  • Calculation: (fat voxels / total voxels) × 100%

Quality-Control Testing Methodology

  • Purpose: Validate that automated segmentation enhances biomarker precision by reducing boundary leakage
  • Paired Analysis: Apply trained nnU-Net model to same 21 development cases used for manual segmentation
  • Fat Filtering: Use fat_filter.py to identify voxels with HU < -20 within muscle boundaries
  • Comparison Metrics:
    • Direct fat% comparison: manual vs automated masks on identical CT scans
    • Boundary analysis: automated masks provide tighter muscle boundaries
    • Clinical validation: lower fat% with automated masks indicates reduced boundary spill-in
  • Key Finding: Automated masks systematically yield lower fat% than manual masks, consistent with improved boundary specificity and reduced inclusion of extramuscular fat

Clinical Implications

This pipeline enables:

  • Opportunistic screening of sagittal deformity on routine CT
  • Quantitative muscle quality assessment via fat% biomarkers
  • Population-scale analytics for spinal health research
  • Targeted rehabilitation focusing on posterior extensors
  • Quality-Control Validation: Automated segmentation enhances biomarker precision by reducing boundary leakage and improving fat% specificity
  • Scalable Surrogate Biomarkers: Automated fat% measurement can complement or replace manual Cobb angle measurements for large-scale screening

Dataset Information

This dataset provides a complete implementation of automated muscle segmentation and thoracic kyphosis analysis. It demonstrates the feasibility of using CT-derived muscle composition biomarkers as surrogates for manual spinal curvature measurements, enabling scalable spinal health assessment on routine CT scans.

Key Innovations:

  • Quality-Control Testing: Paired analysis comparing manual vs automated segmentations on identical CT scans
  • Boundary Enhancement: Automated masks provide tighter muscle boundaries, reducing boundary leakage and improving fat% specificity
  • Scalable Validation: Large-scale testing (n=250) confirms core biomechanical relationships between muscle composition and spinal curvature
  • Reproducible Pipeline: Complete end-to-end framework from raw CT scans to clinical biomarkers

Quick Start

Loading the Dataset

from datasets import load_dataset

# Load the complete spine analysis pipeline
dataset = load_dataset("onlineinfoh/Spine-Analysis-Pipeline")

# Access pre-trained models
models = dataset["models"]

# Access analysis scripts
scripts = dataset["scripts"]

# Access processed results
results = dataset["results"]

Local Setup and Usage Guide

Environment Setup

# Clone the dataset
git clone https://huggingface.co/datasets/onlineinfoh/Spine-Analysis-Pipeline
cd Spine-Analysis-Pipeline

# Install nnU-Net v2
pip install nnunetv2

# Install additional dependencies
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install monai nibabel scikit-image scipy pandas matplotlib seaborn pingouin

Training the Model (Skip Preprocessing)

Since preprocessed data is already available, you can directly train:

# Train 3D full-resolution model (single fold)
nnUNetv2_train Dataset101_FinalSet 3d_fullres all -tr nnUNetTrainer

# This will:
# - Use preprocessed data from nnUNet_preprocessed/Dataset101_FinalSet/
# - Train on 21 cases with 9 muscle classes
# - Save model to nnUNet_results/Dataset101_FinalSet/nnUNetTrainer__nnUNetPlans__3d_fullres/fold_all/
# - Training time: ~2-4 hours on NVIDIA GH200

Using Pre-trained Models

# Load nnU-Net model for muscle segmentation
import torch
from nnunet.inference.predict import predict_from_folder

# Use the pre-trained model for inference
predict_from_folder(
    input_folder="path/to/ct/scans",
    output_folder="path/to/segmentations", 
    model_folder="nnUNet_results/Dataset101_FinalSet/nnUNetTrainer__nnUNetPlans__3d_fullres",
    folds="all",  # Use the fold_all model
)

Running Analysis Scripts

1. Fat Percentage Analysis (scripts/fatty_analysis.py)

python scripts/fatty_analysis.py

What it does:

  • Calculates intramuscular fat percentage for 9 muscle groups
  • Uses HU threshold < -20 to identify fat voxels
  • Processes both development (100-120) and test (251-500) cohorts

Outputs:

  • fatty_data/dev_fat.csv: Fat% for 21 development cases
    • Columns: case_id, dataset, psoas_fat_pct, quadratus_lumborum_fat_pct, etc.
    • Each row = one case, each column = fat% for specific muscle
  • fatty_data/test_fat.csv: Fat% for 250 test cases
  • *_mean_std.csv: Summary statistics (mean ± SD) for each muscle

2. Inter-Observer Reliability Analysis (scripts/ICC_analysis.py)

python scripts/ICC_analysis.py

What it does:

  • Computes ICC(2,k) for 5-observer Cobb angle measurements
  • Performs bootstrap confidence intervals (n=5000)
  • Creates inter-rater variability plots for reliability assessment

Outputs:

  • ICC_results/dev_cobb_summary.csv: ICC statistics and rater means
    • ICC(2,k) = 0.927 (95% CI: 0.859-0.955) - indicates excellent reliability
  • ICC_results/sagittal_icc_results.csv: Detailed ICC metrics
  • ICC_results/sagittal_inter_rater_variability.png: Inter-rater variability plot
    • Shows limits of agreement: 0.90° to 9.73° (mean difference = 5.31°)

3. Correlation Analysis (scripts/pearson_analysis.py)

python scripts/pearson_analysis.py

What it does:

  • Computes Pearson correlations between Cobb angles and muscle fat%
  • Analyzes both development (n=21) and test (n=250) cohorts
  • Tests statistical significance with multiple comparison correction

Outputs:

  • pearson_correlation/dev_cobb_corr/fatty_atrophy_thoracic_correlations.csv:
    • Development cohort correlations (strongest: trapezius r=0.77, p<0.001)
  • pearson_correlation/test_cobb_corr/fatty_atrophy_thoracic_correlations.csv:
    • Test cohort correlations (strongest: paraspinal r=0.43, p<0.001)

4. Quality-Control Testing (scripts/fat_filter.py)

python scripts/fat_filter.py

What it does:

  • Applies fat filtering (HU < -20 → label 10) to both manual and automated segmentations
  • Processes cases 100-120 for paired quality-control analysis
  • Identifies intramuscular fat voxels within muscle boundaries
  • Generates fat-filtered versions for boundary comparison studies

Outputs:

  • fat_filtered_100-120/labels_9_muscles_fat_filtered/: Manual labels with fat annotations
  • fat_filtered_100-120/label_9_muscles_model_pred_fat_filtered/: Automated labels with fat annotations
  • Enables direct comparison of fat boundary detection between manual and automated methods

5. Automated Mask Analysis (scripts/model_dev_pred_fatty_analysis.py)

python scripts/model_dev_pred_fatty_analysis.py

What it does:

  • Computes fat% using automated nnU-Net segmentations on development cases
  • Applies trained model to same 21 cases used for manual segmentation
  • Enables paired comparison: manual vs automated fat% on identical CT scans
  • Validates automated segmentation enhancement of biomarker precision

Outputs:

  • fatty_data/model_pred_dev.csv: Fat% for 21 development cases using automated masks
  • fatty_data/model_pred_dev_mean_std.csv: Summary statistics for automated measurements
  • Enables validation that automated masks provide tighter boundaries than manual contours

6. Visualization Generation (scripts/correlation_plot.py)

python scripts/correlation_plot.py --dataset both --plot-type both

What it does:

  • Creates publication-quality correlation plots
  • Generates trapezius-specific scatter plots
  • Creates 3×3 aggregate muscle correlation grids

Outputs:

  • muscle_correlation_scatter.png: Trapezius fat% vs Cobb angle (n=21)
  • trapezius_fat_vs_thoracic_cobb_250_cases.png: Large-scale validation plot (n=250)
  • aggregate_muscle_correlations.png: 3×3 grid showing all 9 muscle correlations

Data File Explanations

Cobb Angle Data

  • cobb_angles/dev_cobb.csv: 21 cases × 5 raters (tab-separated)
    • Each row = one case, each column = one rater's measurement
    • Used for inter-observer reliability analysis
  • cobb_angles/test_cobb.csv: 250 cases × 1 rater
    • Single-observer measurements for large-scale validation

Fat Percentage Data

  • fatty_data/dev_fat.csv: 21 cases × 11 columns (manual masks)
    • case_id: Case identifier (100-120)
    • dataset: "100-120"
    • {muscle}_fat_pct: Fat percentage for each of 9 muscles using manual segmentations
  • fatty_data/model_pred_dev.csv: 21 cases × 11 columns (automated masks)
    • Same structure as dev_fat.csv but using nnU-Net segmentations
    • Enables paired comparison: manual vs automated fat% on identical CT scans
  • fatty_data/test_fat.csv: 250 cases × 11 columns
    • Same structure but cases 251-500 using automated segmentations
  • fatty_data/*_mean_std.csv: Summary statistics for all cohorts
    • Mean ± SD fat% for each muscle group across manual, automated, and test cohorts

Analysis Results

  • ICC Results: Reliability metrics and inter-rater variability analysis
  • Correlation Results: Pearson coefficients and significance tests
  • Visualizations: Scatter plots and aggregate correlation grids

Quality-Control Data

  • fat_filtered_100-120/labels_9_muscles_fat_filtered/: Manual segmentations with fat annotations
    • Original muscle labels (1-9) preserved
    • Fat voxels (HU < -20) labeled as 10
    • Enables boundary analysis and fat detection validation
  • fat_filtered_100-120/label_9_muscles_model_pred_fat_filtered/: Automated segmentations with fat annotations
    • Same fat filtering applied to nnU-Net predictions
    • Enables direct comparison of fat boundary detection between methods

Model Details

The pre-trained model includes:

  • Architecture: 3D U-Net with 6 encoder/decoder stages
  • Input: Single-channel CT volumes (normalized)
  • Output: 10-class segmentation (background + 9 muscle groups)
  • Performance: Macro Dice ≈ 0.90 across all muscle groups
  • Training: 1000 epochs with early stopping, trained on 21 cases
  • Configuration: 3D full-resolution with patch size [112, 128, 128]

Computational Environment

  • OS: Linux (aarch64)
  • GPU: NVIDIA GH200 (480 GB HBM3)
  • CUDA/cuDNN: 12.8 / 9.8
  • Python/PyTorch: 3.10.12 / 2.7.1+cu128
  • Core Libraries: nnU-Net v2.6.2, MONAI 1.5.1, NumPy 2.1.2, SciPy 1.15.3

Citation

If you use this dataset in your research, please cite:

@dataset{spine_analysis_pipeline_2025,
  title={Spine Analysis Pipeline Dataset},
  author={Liang, Tianxi and Atri, Rian and Joseph, Sarah and Shao, Yiyuan and Zou, Zhitong and Villanueva, Adrian J. and Prince, Aida and Deng, Renke and Teichman, Kurt and Atri, Saurabh and He, Xinzi and Prince, Martin R.},
  year={2025},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/onlineinfoh/Spine-Analysis-Pipeline}
}

Related Resources


This dataset provides complete reproducibility for an automated muscle segmentation pipeline that links thoracic kyphosis and trunk muscle intramuscular fat percentage on CT, enabling scalable spinal health analytics and opportunistic screening applications. The quality-control testing framework validates that automated segmentation enhances biomarker precision by reducing boundary leakage, positioning fat% as a scalable surrogate biomarker for spinal curvature assessment.

Downloads last month
120