Skip to content

Fix strict conform voxel center to agree with FreeSurfer and earlier FastSurfer versions#815

Merged
m-reuter merged 3 commits into
devfrom
fix-conform
May 13, 2026
Merged

Fix strict conform voxel center to agree with FreeSurfer and earlier FastSurfer versions#815
m-reuter merged 3 commits into
devfrom
fix-conform

Conversation

@m-reuter
Copy link
Copy Markdown
Member

The new voxel center convention (shape-1)/2 is problematic when performing strict conform. It leads to different image interpolation (not only shifts) compared to earlier FastSurfer versions and to FreeSurfer. As our ground truth for validation lies in the FreeSurfer space, DICE scores cannot be computed directly any longer.

We therefore switch back to FreeSurfer conventions for the center as shape/2 in the strict conform path.
Keepgeom/native_image still uses the (shape-1)/2 voxel center, to be compatible with nibabel and to allow round trip conversions without any shifts/cropping.

The third potential situation (soft-LIA but actual re-slicing due to e.g. voxel size changes) has not been tested, and could still be buggy. It is also not used in the FreeSurfer processing pipeline.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts FastSurfer conforming behavior so strict conforming uses the FreeSurfer-style shape / 2 center convention, while soft/native paths retain voxel-center semantics for round-trip geometry preservation.

Changes:

  • Adds a voxel_center switch to reorientation center-fixing logic.
  • Updates strict vs soft/native reorientation paths to use different center conventions.
  • Adds regression coverage and updates documentation around conform/native geometry behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
FastSurferCNN/data_loader/conform.py Implements center-convention selection in reorientation helpers.
test/image/test_orientation_transform.py Updates existing center tests and adds strict FreeSurfer-center regression coverage.
README.md Clarifies orig.mgz geometry expectations for CC/native processing.
FastSurferCNN/README.md Documents strict conform vs native/soft geometry semantics.
doc/scripts/RUN_FASTSURFER.md Updates CLI documentation for conform and keepgeom behavior.
Comments suppressed due to low confidence (1)

FastSurferCNN/data_loader/conform.py:499

  • This default changes the behavior of direct from_vox2vox calls with 3x3 transforms from the historical/nibabel voxel-center convention to FreeSurfer's shape / 2 convention. Since the strict conform path can opt into voxel_center=False explicitly, keeping this public helper's default as True would avoid introducing half-voxel shifts for existing generic reorientation callers.
            *,
            voxel_center: bool = False,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread FastSurferCNN/data_loader/conform.py
@m-reuter m-reuter merged commit 3c52a21 into dev May 13, 2026
3 checks passed
@m-reuter m-reuter deleted the fix-conform branch May 13, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants