Automatic freesurfer subject name includes session tag

Summary of what happened:

Hello all, I’m having an issue with running fmriprep and how it outputs the freesurfer folder
Instead of creating a file “sub-hp01” inside SUBJECTS_DIR, it creates a file “sub-hp01_ses-01”
How can I prevent this?

Folder organization

sub-hp01
	/ses-01
		/anat
			/sub-hp01_ses-01_acq-MPRAGE_T1w.nii
			/sub-hp01_ses-01_acq-MPRAGE_T1w.json
derivatives
	/freesurfer
		/sub-hp01_ses-01 <-- this! 
	/fmriprep
		/sub-hp01
			/ses-01

Kind regards,
Marcus

Command used (and if a helper script was used, a link to the helper script or the command generated):

fmriprep command

fmriprep-docker \
	/Users/marcusdaghlian/projects/dp-clean-link/240522NG/hypot/ \
	/Users/marcusdaghlian/projects/dp-clean-link/240522NG/hypot/derivatives/fmriprep \
	participant \
	--participant-label sub-hp01 \
	--fs-subjects-dir /Users/marcusdaghlian/projects/dp-clean-link/240522NG/hypot/derivatives/freesurfer \
	--fs-license-file /Users/marcusdaghlian/projects/dp-clean-link/240522NG/hypot/code/license.txt \
	--skip-bids-validation \
	--omp-nthreads 8 \
	-w /Users/marcusdaghlian/projects/dp-clean-link/240522NG/BIDSWF \
	--anat-only

Version:

25.2.4

Environment (Docker, Singularity / Apptainer, custom installation):

Docker

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Screenshots / relevant information:


Hi,

This is a result of the --subject-anatomical-reference flag and session processing support introduced in the 25.2.x series. One goal was to include additional provenance for the specific combinations.

If a subject does not have any sessions, then they will default to a sub-X/ FreeSurfer folder. However, if one or more sessions are found, the session(s) string is tacked on to the FS ID, regardless of anatomical reference option.

There’s some discussion on different use cases / improving this in fix collect freesurfer by bpinsard · Pull Request #3588 · nipreps/fmriprep · GitHub. For the moment, your best bet is to either manually rename or symlink.

Amazing thanks for clearing that up! I think the symlink method sounds like the best way to sort this.