How nicolik/segm_ident_vertebrae_cnn_kmeans_knn works
This repository implements a CT vertebra workflow: prepare scans and labels, train or run binary spine segmentation, then identify and label individual vertebrae with multiclass processing. It also provides prediction visualization and segmentation metrics. Source excerpts show the training and binary-inference calls; the README documents preprocessing and multiclass stages. The Qt implementation and several preprocessing scripts were not excerpted, so their internal behavior is not expanded.
Main entry points: train.py Training entry point · multiclass_segmentation.py Vertebra labeling · segm_bin.py Binary inference · config_semseg.py Segmentation config
Components 22
Data preparation
- Train/test split
run/task0/split.py - Mask cropping
run/task0/crop_mask.py - Scan preprocessing
run/task0/pre_processing.py
Binary segmentation
- 3D V-Net
models/vnet3d.py - Training loop
semseg/train.py - Dice loss
semseg/loss.py - Training entry point
run/task1/train.py - Binary inference
run/task1/segm_bin.py - Binary metrics
run/task1/metrics.py
Vertebra labeling
- Morphology and components
run/task2/multiclass_segmentation.py - Body/arch clustering
run/task2/multiclass_segmentation.py - Vertebra labeling
run/task2/multiclass_segmentation.py - Label mapping
config/map.py - Multiclass metrics
semseg/utils.py - Prediction masks
Shared components
- Dataset paths
config/paths.py - Training augmentation
config/augm.py - Segmentation config
config/config_semseg.py - Patch data loaders
semseg/data_loader.py
Visualization
- Prediction viewer
qt_cpp/QtGuiApplication1.cpp
Other components
- CT scans and labels
- Researcher
Connections 25
- CT scans and labels → Train/test split: supplies scans
README.md - Train/test split → Mask cropping: split data
README.md - Mask cropping → Scan preprocessing: cropped data
README.md - Training entry point → Segmentation config: loads config
run/task1/train.py - Training entry point → Patch data loaders: builds loaders
run/task1/train.py - Training entry point → 3D V-Net: creates network
run/task1/train.py - Training entry point → Training loop: starts training
run/task1/train.py - Training loop → Dice loss: computes loss
semseg/train.py - Patch data loaders → Training augmentation: transforms training data
semseg/data_loader.py - Binary inference → Segmentation config: loads config
run/task1/segm_bin.py - Binary inference → 3D V-Net: runs network
run/task1/segm_bin.py - Binary inference → Prediction masks: writes masks
README.md - Researcher → Training entry point: trains model
README.md - Researcher → Binary inference: runs inference
README.md - Researcher → Binary metrics: calculates metrics
README.md - Prediction masks → Morphology and components: binary mask input
README.md - Morphology and components → Body/arch clustering: extracts components
run/task2/multiclass_segmentation.py - Body/arch clustering → Vertebra labeling: assigns vertebra labels
run/task2/multiclass_segmentation.py - Vertebra labeling → Label mapping: gets label mapping
run/task2/multiclass_segmentation.py - Vertebra labeling → Multiclass metrics: calculates scores
run/task2/multiclass_segmentation.py - Vertebra labeling → Prediction masks: writes masks and centroids
README.md - Researcher → Vertebra labeling: runs multiclass stage
README.md - Prediction masks → Prediction viewer: visualizes predictions
- Researcher → Prediction viewer: views results
- Segmentation config → Dataset paths: uses dataset paths
config/config_semseg.py