Skip to content

Conversation

mgxd
Copy link
Collaborator

@mgxd mgxd commented Aug 6, 2025

Builds off nipreps/smriprep#480

Adds new arguments:

  • --session-label for a more streamlined way to filter sessions
  • --subject-anatomical-reference to determine how the reference anatomical should be constructed.

Comment on lines +443 to +444
processing_groups = None
"""List of tuples (participant, session(s)) that will be preprocessed."""
Copy link
Member

Choose a reason for hiding this comment

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

This is derived from participant_label, session_label and subject_anatomical_reference. Might be handy for reporting, but it does mean that the config object state can be inconsistent.

IMO it would be better just to calculate the groups when needed with a well-isolated function rather than deal with (de)serialization and consistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i also considered omitting, but decided to include it since having that provenance is nice. session_label is only populated if --session-label is used, otherwise all sessions pertaining to that subject are queried from the layout (and that information is not currently being stored). the config object should never be changed, just the dict representation of it (and when dumping to toml).

Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 70.00000% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.64%. Comparing base (7fbfb0a) to head (cc9706b).
⚠️ Report is 37 commits behind head on master.

Files with missing lines Patch % Lines
fmriprep/interfaces/bids.py 67.21% 15 Missing and 5 partials ⚠️
fmriprep/cli/parser.py 65.71% 8 Missing and 4 partials ⚠️
fmriprep/cli/workflow.py 0.00% 7 Missing ⚠️
fmriprep/reports/core.py 45.45% 3 Missing and 3 partials ⚠️
fmriprep/workflows/base.py 68.42% 4 Missing and 2 partials ⚠️
fmriprep/config.py 91.42% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3495    +/-   ##
========================================
  Coverage   73.64%   73.64%            
========================================
  Files          60       60            
  Lines        4618     4759   +141     
  Branches      586      616    +30     
========================================
+ Hits         3401     3505   +104     
- Misses       1088     1111    +23     
- Partials      129      143    +14     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Collaborator

@tsalo tsalo left a comment

Choose a reason for hiding this comment

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

I just have a couple of minor documentation-related suggestions for now.

@mgxd mgxd force-pushed the enh/session-processing branch from 1096fce to 1ea9211 Compare August 8, 2025 19:40
@mgxd mgxd marked this pull request as ready for review August 13, 2025 17:26
Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long. I think this is mostly good to go.

Comment on lines 1012 to 1016
if not sessions:
raise RuntimeError(
'`--subject-anatomical-reference sessionwise` was requested, but no sessions '
f'found for subject {subject}.'
)
Copy link
Member

Choose a reason for hiding this comment

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

This seems like it shouldn't be an error. No sessions is the same as a single session, so I would expect it to work the same. I think changing this to:

if subject_anatomical_reference == 'sessionwise' and sessions:
    subject_session_list.extend((subject, session) for session in sessions)
else:
    subject_session_list.append((subject, sessions))

should cover your use cases... That said, this isn't tested, so it's hard to figure out what's happening.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

was maintaining the logic first implemented in smriprep, but i agree that raising an error is a bit too strict - imo, a warning would suffice.

@effigies effigies merged commit 2120f86 into master Sep 8, 2025
20 of 21 checks passed
@effigies effigies deleted the enh/session-processing branch September 8, 2025 17:52
effigies added a commit that referenced this pull request Oct 1, 2025
25.2.0 (October 01, 2025)

New feature release in the 25.2.x series.

This release is an *fMRIPrep Long-Term Support (LTS)* release.
The planned support window is 4 years, until October 2029.

This release is an incremental improvement over 25.1.x, but includes some fixes
and improvements that do not fit within our
`bug-fix policy <https://www.nipreps.org/devs/releases/#bug-fix-releases>`__.

Importantly, the change in interpolation in 25.1.0 introduced artifacts for some datasets.
This release changes the default interpolation mode to ``grid-constant``, which
resolves those problems while not reintroducing the issue the previous release sought to fix.

This release also (finally) introduces per-session processing.
The ``--session-label`` flag selects the sessions to process,
and the ``--subject-anatomical-reference`` flag indicates whether and how
to combine across sessions.
Existing filters passed via ``--bids-filter-file`` may need to be updated or
removed in favor of using these flags to achieve the desired behavior.

We would like to thank the AMP-SCZ and ENIGMA consortia for testing out and providing
feedback on this release.

  * FIX: Clean up output report language (#3529)
  * FIX: Default to grid-constant interpolation mode (#3516)
  * FIX: Adapt to transposed ndcoords in nitransforms (#3517)
  * FIX: Write out Freesurfer-derived outputs (#3512)
  * FIX: Add kwargs to _warnings.py (#3483)
  * ENH: Resample BOLD data to any surface template space using the Connectome Workbench (#3461)
  * ENH: Add boldref / sbref to source metadata (#3532)
  * ENH: Add dedicated session filtering, alternative anatomical template options (#3495)
  * ENH: Write out goodvoxels mask (#3513)
  * ENH: Add registration metadata to boldref-to-anat transforms (#3500)
  * ENH: Write out cortex mask GIFTIs (#3491)
  * ENH: Update transforms.py according to new transform chain of nitransforms (#3494)
  * RF/DOC: Improve and document command-line parser defaults (#3487)
  * DOC: Explain better SDC and B0FieldSource requirement (#2768)
  * DOC: Document `freesurfer` parameter in BOLD confound workflow init (#3504)
  * DOC: Add myself to contributor list (#3506)
  * DOC: Fix non-standard Input/Output docstring section management (#3505)
  * MNT: Split Dockerfile into base and pixi layers (#3521)
  * MNT: Replace conda with pixi and lock (#3503)
  * MNT: Update license metadata using SPDX expression (#3486)
  * MNT: no need to re-run `ruff check` after `ruff format` (#3480)
  * MNT: Update pre-commit ruff legacy alias (#3479)
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