Skip to content

ENH: Upstream BIDSSourceFile and CreateFreeSurferID interfaces from fMRIPrep #544

Description

@oesteban

Summary

fMRIPrep contains anatomical pipeline interfaces in `fmriprep/interfaces/bids.py` that are fundamentally sMRIPrep concerns:

`BIDSSourceFile` (lines 80-96) + `_create_multi_source_file` (lines 120-161)

Determines the BIDS source file for anatomical derivatives, handling multi-image and sessionwise cases. This is an anatomical pipeline concern — determining which T1w/T2w is the source file for multi-image pipelines. sMRIPrep's `init_anat_fit_wf` needs equivalent logic.

`CreateFreeSurferID` (lines 108-117) + `_create_fs_id` (lines 164-190)

Creates FreeSurfer subject IDs from BIDS subject/session identifiers (e.g., `"01"` -> `"sub-01"`, with optional session suffix). This interface already imports `stringify_sessions` from sMRIPrep, confirming it belongs here.

Code to upstream

  • `BIDSSourceFile` interface + `_create_multi_source_file` helper
  • `CreateFreeSurferID` interface + `_create_fs_id` helper

Rationale

  • Both interfaces handle anatomical/FreeSurfer pipeline concerns, not fMRI-specific logic
  • `CreateFreeSurferID` already imports from sMRIPrep (`stringify_sessions`)
  • These belong alongside sMRIPrep's anatomical fit workflow
  • dMRIPrep and NiBabies need the same source file resolution and FreeSurfer ID management

Priority

MEDIUM.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions