Skip to content

Fix bug in spherically project wrapper#788

Merged
m-reuter merged 5 commits intoDeep-MI:devfrom
dkuegler:fix/forward-output
Feb 17, 2026
Merged

Fix bug in spherically project wrapper#788
m-reuter merged 5 commits intoDeep-MI:devfrom
dkuegler:fix/forward-output

Conversation

@dkuegler
Copy link
Member

@dkuegler dkuegler commented Feb 13, 2026

This PR fixes two bugs in the use of spherically_project_wrapper.py. Both of them only appear if the baseline python implementation fails.

  1. the call to spherically_project_wrapper.py uses a --sd argument, but the value was previously passed as empty (the used variable did not exist).
  2. There was a missing function in MessageBuffer: forward_output, which forwards stdout and stderr content through the wrapper to the python stdout. This function missing raised an error.

Additionally, the PR fixes a near-irrelevant signature-inconsistency between the run_tools extension of Popen.__init__ and the underlying subprocess.Popen.__init__, where subprocess.Popen only accepts one positional parameter, but run_tools.Popen accepted multiple ... only to then pass that to subprocess.Popen, where it would be invalid.

Todo:

  • test in bigger dataset to cover both spherically project implementations

This Commit adds the missing forward_output member function of MessageBuffer, which is used in the fallback case of spherically project and run_tools.Popen.forward_output.
Harmonize Popen.__init__ with subprocess.__init__
- the FastSurfer spherically_project.py uses full file names
- the FreeSurfer fallback binary uses the SUBJECTS_DIR environment variable, --sid and internally hard coded file names.
Copy link
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 fixes fallback-path failures when spherically_project_wrapper.py is invoked from recon-surf.sh, and aligns FastSurferCNN.utils.run_tools.Popen’s constructor with subprocess.Popen.

Changes:

  • Replace --sdir with --sd and correctly construct surface paths from $SUBJECTS_DIR/<subject>/surf.
  • Add MessageBuffer.forward_output() to support Popen.forward_output() without raising an attribute error.
  • Adjust run_tools.Popen.__init__ to accept only the single positional args parameter (like subprocess.Popen).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
recon_surf/spherically_project_wrapper.py Switch wrapper CLI to --sd and fix path/env usage for the fallback execution path.
recon_surf/recon-surf.sh Update wrapper invocation to pass --sd "$SUBJECTS_DIR" instead of --sdir "$sdir".
FastSurferCNN/utils/run_tools.py Add output-forwarding on MessageBuffer and tighten Popen.__init__ signature.

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

Fix default values and required settings of spherically_project_wrapper.py to ensure the parameters are always validated.
@dkuegler dkuegler marked this pull request as draft February 13, 2026 18:56
@dkuegler dkuegler marked this pull request as ready for review February 17, 2026 16:28
@m-reuter m-reuter merged commit 9544db6 into Deep-MI:dev Feb 17, 2026
2 checks passed
@dkuegler dkuegler deleted the fix/forward-output branch February 18, 2026 09:18
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.

3 participants