Fix: Correct FastSurfer-CC error code handling and documentation formatting#794
Open
dkuegler wants to merge 3 commits intoDeep-MI:devfrom
Open
Fix: Correct FastSurfer-CC error code handling and documentation formatting#794dkuegler wants to merge 3 commits intoDeep-MI:devfrom
dkuegler wants to merge 3 commits intoDeep-MI:devfrom
Conversation
FastSurfer-CC's fastsurfer_cc.py returned with erroror code 0 despite failing some cc surface processing steps. This Commit fixes the error processing of FsatSurfer-CC so that the error code and error message are consistent and robust. CorpusCallosum.fastsurfer_cc.main now does not only return None irrespective of success, but returns 0 if successful and an error string. Also two minor fixes: 1. use BASH_SOURCE[0] instead of $0 in recon_sirf/functions.sh 2. add a missing wrap in run_fastsurfer.sh
- Add a heading to the Parser self-documentation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve error code handling in the FastSurfer-CC (CorpusCallosum) module and includes several code quality improvements across multiple files. The primary goal is to align the error handling with the established pattern in the codebase where main functions return exit codes or error messages rather than calling sys.exit() directly.
Changes:
- Modified
fastsurfer_cc.pymain() function to returnLiteral[0] | strand wrapped the call withsys.exit()at the call site - Renamed variable
io_futurestofuturesthroughout the file for improved clarity - Added timing wrapper
${wrap[@]}to a command inrun_fastsurfer.shfor consistent execution time logging - Updated
recon_surf/functions.shto use${BASH_SOURCE[0]}instead of$0for proper path resolution in sourced scripts - Enhanced documentation formatting in
doc/scripts/fastsurfer_cc.rstwith proper backticks and section headings
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| CorpusCallosum/fastsurfer_cc.py | Updated return type from None to Literal[0] | str, renamed io_futures to futures, added error handling for failed futures, and wrapped main() call with sys.exit() |
| run_fastsurfer.sh | Added timing wrapper to reduce_to_aseg.py command (line 1012) and improved array append syntax (line 1278) |
| recon_surf/functions.sh | Changed from |
| doc/scripts/fastsurfer_cc.rst | Added command-line interface heading, changed start-line to skip title, and improved flag formatting with backticks |
💡 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.
Summary
This PR fixes the error code handling in the FastSurfer-CC (CorpusCallosum) module and corrects documentation formatting issues.
Changes Made
1. Error Code Handling (
fastsurfer_cc.py)main()function0on success or an error message string on failuresys.exit()to ensure correct process exit codes are communicated to the shell2. Documentation Fixes
Motivation
Proper error code handling is critical for:
The documentation fixes improve clarity and prevent build/documentation generation issues.
Files Modified
CorpusCallosum/fastsurfer_cc.py- Error code handling in main functionCorpusCallosum/README.md- Documentation formattingBreaking Changes
None - this is a bug fix that corrects existing behavior.
Testing Recommendations
Related Issues
Related to error handling improvements and documentation quality
Type