# miracle-center/ctspine1k architecture

> Architecture diagram of the GitHub repository miracle-center/ctspine1k, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miracle-center/ctspine1k
- Repository: https://github.com/miracle-center/ctspine1k

## Overview

CTSpine1K is primarily a curated, annotated CT dataset for spinal vertebra segmentation, accompanied by a small VerSe-to-nnUNet preparation and evaluation utility. The documented workflow is to obtain CTs and annotations, prepare data for nnUNet, train or infer with that external framework, and evaluate predictions. The sampled source shows orientation correction, dataset staging, and Dice evaluation; example notebooks and casewise pipeline code are listed but were not sampled, so their internal relationships are omitted.

Main entry points: [`Task056_VerSe2019.py`](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py) (VerSe preparation), [`data_split.txt`](https://github.com/miracle-center/ctspine1k/blob/main/data_split.txt) (Dataset splits), [`examples/colab/verse_casewise`](https://github.com/miracle-center/ctspine1k/tree/main/examples/colab/verse_casewise) (VerSe casewise examples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dataset["Dataset and access"]
  node_sources[("Source CT data")]
  node_annotations[("Segmentation annotations")]
  node_splits["Dataset splits<br/>[data_split.txt]"]
  node_ctspine[("CTSpine1K dataset")]
end

subgraph group_prep["VerSe preparation"]
  node_verseprep["VerSe preparation"]
  node_orientation["Orientation normalization"]
  node_nnunetdata["nnUNet task data"]
end

subgraph group_model["Segmentation workflow"]
  node_nnunet["nnUNet framework"]
  node_casewise["VerSe casewise examples"]
end

subgraph group_eval["Evaluation"]
  node_predictions["Segmentation predictions"]
  node_dice["Vertebra Dice evaluation"]
  node_summary["Evaluation summary"]
end

node_researcher(("Researcher"))

node_researcher -->|"downloads CTs"| node_sources
node_researcher -->|"downloads labels"| node_annotations
node_sources -->|"curated into"| node_ctspine
node_annotations -->|"labels"| node_ctspine
node_researcher -->|"uses split"| node_splits
node_researcher -->|"runs preparation"| node_verseprep
node_verseprep -->|"normalizes"| node_orientation
node_verseprep -->|"stages task data"| node_nnunetdata
node_orientation -->|"writes images"| node_nnunetdata
node_nnunetdata -.->|"configures training"| node_nnunet
node_nnunet -.->|"produces"| node_predictions
node_researcher -->|"evaluates predictions"| node_dice
node_dice -->|"reads"| node_predictions
node_dice -->|"writes scores"| node_summary
node_researcher -.->|"runs examples"| node_casewise

click node_splits "https://github.com/miracle-center/ctspine1k/blob/main/data_split.txt"
click node_verseprep "https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py"
click node_orientation "https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py"
click node_nnunetdata "https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py"
click node_dice "https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py"
click node_summary "https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py"
click node_casewise "https://github.com/miracle-center/ctspine1k/tree/main/examples/colab/verse_casewise"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sources,node_annotations,node_splits,node_ctspine toneBlue
class node_verseprep,node_orientation,node_nnunetdata toneAmber
class node_nnunet,node_casewise toneMint
class node_predictions,node_dice,node_summary toneRose
class node_researcher toneIndigo
```

## Components

### Dataset and access

- **Source CT data**
- **Segmentation annotations**
- [Dataset splits](https://github.com/miracle-center/ctspine1k/blob/main/data_split.txt): `data_split.txt`
- **CTSpine1K dataset**

### VerSe preparation

- [VerSe preparation](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py): `Task056_VerSe2019.py`
- [Orientation normalization](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py): `Task056_VerSe2019.py`
- [nnUNet task data](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py): `Task056_VerSe2019.py`

### Segmentation workflow

- **nnUNet framework**
- [VerSe casewise examples](https://github.com/miracle-center/ctspine1k/tree/main/examples/colab/verse_casewise): `examples/colab/verse_casewise`

### Evaluation

- **Segmentation predictions**
- [Vertebra Dice evaluation](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py): `Task056_VerSe2019.py`
- [Evaluation summary](https://github.com/miracle-center/ctspine1k/blob/main/Task056_VerSe2019.py): `Task056_VerSe2019.py`

### Other components

- **Researcher**

## Connections

- Researcher → Source CT data: downloads CTs (evidence: `README.md`)
- Researcher → Segmentation annotations: downloads labels (evidence: `README.md`)
- Source CT data → CTSpine1K dataset: curated into (evidence: `README.md`)
- Segmentation annotations → CTSpine1K dataset: labels (evidence: `README.md`)
- Researcher → Dataset splits: uses split (evidence: `README.md`)
- Researcher → VerSe preparation: runs preparation (evidence: `Task056_VerSe2019.py`)
- VerSe preparation → Orientation normalization: normalizes (evidence: `Task056_VerSe2019.py`)
- VerSe preparation → nnUNet task data: stages task data (evidence: `Task056_VerSe2019.py`)
- Orientation normalization → nnUNet task data: writes images (evidence: `Task056_VerSe2019.py`)
- nnUNet task data → nnUNet framework: configures training
- nnUNet framework → Segmentation predictions: produces
- Researcher → Vertebra Dice evaluation: evaluates predictions (evidence: `Task056_VerSe2019.py`)
- Vertebra Dice evaluation → Segmentation predictions: reads (evidence: `Task056_VerSe2019.py`)
- Vertebra Dice evaluation → Evaluation summary: writes scores (evidence: `Task056_VerSe2019.py`)
- Researcher → VerSe casewise examples: runs examples
