Skip to content

Improved CC & AC/PC editing#846

Open
ClePol wants to merge 1 commit into
Deep-MI:devfrom
ClePol:feat/cc-editing-landmarks
Open

Improved CC & AC/PC editing#846
ClePol wants to merge 1 commit into
Deep-MI:devfrom
ClePol:feat/cc-editing-landmarks

Conversation

@ClePol

@ClePol ClePol commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

  • add a manual correction workflow for upright corpus callosum segmentations
  • recompute CC morphometry, subdivisions, surfaces, QC outputs, and original-space outputs from corrected segmentations
  • support manually supplied 3D AC/PC voxel coordinates
  • align the midsagittal plane to supplied AC/PC landmarks
  • document native, Docker, and Singularity/Apptainer expert workflows

Manual-edit behavior

Manual segmentations use label 192 for the corpus callosum and optionally label 250 for the fornix.
This can be done through run_fastsurfer.sh --edits, finding the cc.upright.manedit.mgz or through the fastsurfer_cc.py script.

Validation

  • CC editing and landmark tests pass
  • Ruff & doc builds
  • Automatic and manually corrected Docker workflows tested on a real FastSurfer subject

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Human review recommended

It changes core geometric alignment and segmentation mapping behavior (midplane transforms + edited-segmentation remapping), which warrants domain-specific validation beyond what can be safely inferred from diff review alone.

Pull request overview

This PR extends the FastSurfer Corpus Callosum (CC) module with an expert-facing workflow for (1) manual correction of upright CC segmentations and (2) optionally supplying AC/PC voxel landmarks to condition processing and refine midsagittal-plane alignment, along with documentation updates to describe the new workflows and outputs.

Changes:

  • Add support for manual upright CC edits (*.upright.manedit.mgz) and recompute CC-derived outputs, including generating callosum.CC.orig.manedit.mgz for downstream inpainting.
  • Add expert CLI support for manually supplied AC/PC voxel coordinates and adjust midplane alignment to contain those landmarks.
  • Update CLI help and documentation for native/Docker/Singularity expert workflows and new/updated output files/metadata.
File summaries
File Description
run_fastsurfer.sh Wires --qc_snap to emit an upright reference volume, enforces upright CC edit usage, and forwards upright manedit segmentation into fastsurfer_cc.py.
doc/scripts/fastsurfer_cc.rst Documents expert AC/PC landmark input and the upright CC manual-edit workflow (including container examples).
doc/overview/OUTPUT_FILES.md Adds callosum.CC.orig.manedit.mgz and clarifies when upright_volume.mgz is produced.
doc/overview/modules/CC.md Documents new JSON metadata fields describing landmark and segmentation sources.
doc/overview/EDITING.md Adds end-to-end CC upright edit instructions for the top-level run_fastsurfer.sh --edits workflow.
CorpusCallosum/utils/mapping_helpers.py Adds mapping of edited upright hard segmentations back to original space with regenerated subdivision labels and fornix handling.
CorpusCallosum/utils/editing.py New utilities for path suffixing, AC/PC validation, and robust loading/validation of manual upright segmentations.
CorpusCallosum/registration/midsagittal_plane_alignment.py Extends midplane transform resolution to optionally incorporate supplied AC/PC landmark constraints.
CorpusCallosum/registration/landmarks.py New landmark-based midplane adjustment logic plus diagnostics emission.
CorpusCallosum/README.md Expands expert quickstart with native/Docker/Singularity commands and mentions landmark/manual-edit support.
CorpusCallosum/fastsurfer_cc.py Adds expert CLI args (--segmentation_manedit, --ac_coords, --pc_coords), conditional model loading, and manual-edit reprocessing/mapping behavior.

Review details

  • Files reviewed: 11/11 changed files
  • Comments generated: 0
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


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

@ClePol

ClePol commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

For human reviewers:
The default path outside of --edits is unchanged. Only two minor changes:

  • The statistics JSON gains landmark_source: "model" and segmentation_source: "model"
  • --qc_snap now additionally creates mri/upright_volume.mgz

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