scalesurfer-surface
Cortical surface reconstruction from T1-weighted MRI. Given a scan, the model writes each
hemisphere's white and pial surfaces in FreeSurfer format: 163,842 vertices per surface with
fsaverage7 (ico-7) topology, aligned with the conformed orig.mgz. It also writes vertex-wise
thickness and the Desikan-Killiany parcellation. On an RTX 5090 it takes about 2.5 s per scan
end to end.
This is run F, the single pre-registered training run of the MeshNet surface model in ScaleSurfer.
Use
pip install -e ".[surface]" # from a clone of github.com/voytekresearch/scalesurfer
python scripts/predict_surfaces.py sub-01_T1w.nii.gz --out results/
from scalesurfer import ScaleSurfer
surfer = ScaleSurfer(["sub-01_T1w.nii.gz"], ["sub-01"], "results/", fs_version=8)
surfer.prepare_images() # conform to 1 mm 256^3
surfer.predict_volumes() # aparc+aseg from rphammonds/scalesurfer-v8 (the surface model's input)
surfer.predict_surfaces() # downloads this model on first use
Outputs per subject: surf/{lh,rh}.{white,pial,thickness,area,curv},
label/{lh,rh}.aparc.annot, label/{lh,rh}.cortex.label, and a provenance file
scalesurfer_surfaces.json.
Model
Input: the conformed T1 plus the 7-channel segmentation from the FreeSurfer 8 volume model
rphammonds/scalesurfer-v8. The surface model was trained on that model's segmentations, so use it rather than another segmentation.Architecture: MeshNet, 4.59 M parameters.
- A smoothed fsaverage template is placed from the segmentation's label centroids.
- A 3-D CNN encoder and a graph network on the mesh deform it coarse to fine, from ico-1 to ico-7.
- Two column refiners search along each vertex normal (Β±2 mm, then Β±1 mm) for the white and pial boundaries.
Files:
meshnet.safetensorsholds the weights.config.jsonholds theMeshNetConfigand provenance. The fsaverage template ships with the code.Training: one pre-registered run of three stages (94,000 steps in total).
- Pretrain the base network.
- Train the column refiners with the base frozen.
- Fine-tune everything.
Every seed, setting and checkpoint was fixed before the run. The last checkpoint is the model; nothing was chosen on validation or test. Source checkpoint
meshnet_last.pt, sha256e077844fc1d64720β¦.Training data: 9,139 scans from 588 source datasets (763 FreeSurfer-version Γ site groups), referenced to their own FreeSurfer outputs (FreeSurfer 5.x: 1,354; 6: 2,528; 7.x: 4,869; 8.2: 388). Sampling is balanced across (version, site) groups. Sources are OpenNeuro, ABIDE I/II, HCP, CoRR, ADHD-200 and HBN.
Results (held-out test set)
There are 804 scans from 67 institutions, and none of these subjects was used in training. Each method is scored against the scan's own FreeSurfer surfaces. ASSD is the average symmetric surface distance, in mm; lower is better.
| method | ASSD median | ASSD mean | thickness MAE | HD95 | self-intersecting faces (%) |
|---|---|---|---|---|---|
| scalesurfer-surface (F) | 0.154 | 0.171 | 0.247 | 0.61 | 0.001 |
| DeepSurfer (reference brainmask) | 0.179 | 0.191 | 0.244 | 0.59 | 0.014 |
| DeepSurfer (raw T1) | 0.183 | 0.204 | 0.253 | 0.68 | 0.013 |
| BrainNet | 0.259 | 0.279 | 0.299 | 1.00 | 0.026 |
The pre-registered criterion was that F has lower ASSD than both DeepSurfer arms and BrainNet in every FreeSurfer version (5, 6, 7, 8) and pooled. Each comparison uses the median paired difference, with a 95 % CI bootstrapped over institutions that must lie below 0. F met all 15 comparisons.
| F minus baseline, median paired ASSD (mm) | DeepSurfer (brainmask) | DeepSurfer (raw T1) | BrainNet |
|---|---|---|---|
| FreeSurfer 5 (155 scans) | β0.023 | β0.032 | β0.091 |
| FreeSurfer 6 (372) | β0.022 | β0.026 | β0.106 |
| FreeSurfer 7 (229) | β0.026 | β0.031 | β0.099 |
| FreeSurfer 8 (48) | β0.013 | β0.023 | β0.078 |
| pooled (804) | β0.023 | β0.028 | β0.100 |
Speed: median 2.50 s per scan end to end on an RTX 5090. That is 0.60 s to conform, 0.47 s for segmentation and 1.38 s for the surfaces, over 48 test scans.
Limits
- Thickness: pooled thickness error ties DeepSurfer (brainmask). It is higher on FreeSurfer 8 (+0.016 mm) and per region (0.118 vs 0.100 mm). Check thickness-based findings against FreeSurfer.
- FreeSurfer 8: ASSD is 0.017 mm higher than the earlier ScaleSurfer M3 model, which F beats pooled.
- Scan types: trained on research-quality T1 of children and adults. It is untested on clinical scans, other contrasts, large lesions and infants.
- Determinism: GPU runs are not bit-for-bit deterministic. Repeated runs differ by about 0.003 mm per vertex on average.
Intended use and license
For non-commercial academic research. Several training datasets (for example HCP, ABIDE and HBN) have data-use terms that restrict commercial use. The fsaverage template is derived from FreeSurfer's and is distributed under the FreeSurfer license. This is not a medical device and is not for clinical decisions.
- Downloads last month
- 23