Skip to content

FIX: Improve FreeSurfer ID predictability - #3607

Open
mgxd wants to merge 16 commits into
nipreps:masterfrom
mgxd:enh/source-file
Open

mgxd wants to merge 16 commits into
nipreps:masterfrom
mgxd:enh/source-file

Conversation

@mgxd

@mgxd mgxd commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

The intent after #3495 was encode as much information on how the anatomical template was formed into the FreeSurfer subject ID, but this introduced problems where the resulting FS ID could not be reused across a few cases:

  • A new session was added after a previous run.
  • Func-only processing leveraging precomputed derivatives from another session.

Starting this draft to think on how to cleanly address this in the future series.

Example 1

Assume we have sub-01 with a single session, pre:

--subject-anat-reference FS ID (<25.2.x) FS ID (25.2.x) FS ID (26.0.x)
sessionwise n/a sub-01_ses-pre sub-01_ses-pre
first-lex sub-01 sub-01_ses-pre sub-01
unbiased sub-01 sub-01_ses-pre sub-01

Now if a post session was added, the post's anatomical will be used in first-lex.

--subject-anat-reference FS ID (<25.2.x) FS ID (25.2.x) FS ID (26.0.x)
sessionwise n/a sub-01_ses-pre, sub-01_ses-post sub-01_ses-pre, sub-01_ses-post
first-lex sub-01 sub-01_ses-post+pre ?
unbiased sub-01 sub-01_ses-post+pre ?

IMO, sub-01 is misleading for both first-lex and unbiased, and only becomes hazier as additional sessions are added. Perhaps instead of changing the ID, some metadata (Sources) can be tied directly to the FreeSurfer subjects dir.

Example 2

sub-Z has one anat and many funcX sessions. anat was processed with --anat-only and will be reused via --derivatives

--subject-anat-reference FS ID (<25.2.x) FS ID (25.2.x) FS ID (26.0.x)
sessionwise n/a func session, no anat found n/a
first-lex sub-Z sub-Z_anat+func1+.. sub-Z
unbiased sub-Z sub-Z_anat+func1+.. sub-Z

Suggestions and additional examples are welcome and appreciated.

@codecov

codecov Bot commented Feb 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.05263% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.63%. Comparing base (e56dc99) to head (5653c29).

Files with missing lines Patch % Lines
fmriprep/cli/parser.py 66.66% 1 Missing ⚠️
fmriprep/workflows/base.py 80.00% 0 Missing and 1 partial ⚠️
fmriprep/workflows/tests/test_base.py 98.03% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3607      +/-   ##
==========================================
+ Coverage   74.90%   75.63%   +0.73%     
==========================================
  Files          65       65              
  Lines        5255     5299      +44     
  Branches      568      571       +3     
==========================================
+ Hits         3936     4008      +72     
+ Misses       1175     1148      -27     
+ Partials      144      143       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mgxd and others added 4 commits September 25, 2026 14:06
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "bash -c '! pixi lock --check || git checkout .'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [
  "pixi.lock",
  "pyproject.toml"
 ],
 "outputs": [
  "pixi.lock"
 ],
 "pwd": "."
}
^^^ Do not change lines above ^^^
@mgxd
mgxd marked this pull request as ready for review September 25, 2026 20:26

This branch has not been deployed

No deployments
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