Cc subsegment ordering#836
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression where the CC midline was not consistently oriented anterior→posterior (causing CC subsegments to be mismapped), and hardens the per-slice subsegmentation pipeline so a single bad slice no longer aborts the whole run.
Changes:
- In
thickness.py, after solving the Laplace level path, flip the equidistant midline if it does not start at the anterior endpoint. - In
postprocessing.py, switch fromexecutor.map+_zip_failedtoas_completed, store per-slice results/contours in fixed-position lists (withNonefor failures), and propagatenum_failed_slicescleanly. - In
fastsurfer_cc.py, deriveresult_slice_indices, pick the nearest valid slice when the middle slice fails (with a warning), gate volume/area-change checks onnum_failed_slices == 0, and recordselected_morphometry_slice*metrics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| CorpusCallosum/shape/thickness.py | Enforce anterior→posterior orientation of the midline level path. |
| CorpusCallosum/shape/postprocessing.py | Reorder slice processing via as_completed and tolerate per-slice failures via positional None placeholders. |
| CorpusCallosum/fastsurfer_cc.py | Fallback to nearest valid middle slice, expose new fallback metrics, guard volume/area checks when slices failed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes a fix for an unnoticed regression prior to the FastSurfer 2.5.0 release, where the midline was not always oriented anterior->posteior. This caused inconsistent mapping of CC subsegments, where only two large segments would be written to the aseg. This is commit 9a255f0
The second, larger, commit hardens the sub-segmentation logic by not interrupting the control flow when subsegmentation fails for one slice. This can happen for bad CC segmentations, e.g. images with head motion.
We can however recover from this if at least one slice is intact. In that case the subsegmentation can still be propagated to adjacent slices and painted into the aseg. The code also includes a WARNING for this special case.
Testing was done on 5 previously failing cases with --seg_only