Anat vs func workflow treatment of sessions

Hi,

I’m using the latest 20.0.2, and a bids-filter-file to process sessions separately. The functional outputs seem to feed into sub-xxxx/ses-xx/func (desired behavior for me) while the anatomical outputs go directly to sub-xxx.

In fact it’s a little more complicated, the anatomical transforms are written to sub-xxx/ses-xxx/anat but everything else went to sub-xxx/anat. I tried to do a little digging and see if I could figure out why, but outputs.py seems not to differentiate between them. Output for a ses-02 is slightly different, missing the anat folder under ses-02. Guessing it has to do with differences between smriprep and fmriprep outputs?


Edit to add the bids filter file, which feed in sessions separately:

{
    "t1w": {
        "datatype": "anat",
        "session": "01",
        "acquisition": null,
        "suffix": "T1w"
    },
    "bold": {
        "datatype": "func",
        "session": "01",
        "suffix": "bold"
    }
}

Anatomical data are combined across sessions, so fMRIPrep removes session information from the filenames. Until recently, it hasn’t been possible to avoid this by manipulating the data aggregation, so we haven’t needed to preserve it at all.

Probably the correct behavior is to only remove session if anatomical data from two sessions is combined. And in those cases also use it in the figure and report file names, such as sub-01_ses-01.html.

In the meantime, I would probably just move the data to where you want it. The reports are going to be less easily moved, however.

Ah I see–this makes sense, it didn’t seem like a bug, but I couldn’t figure out why this would happen! I forgot that I’m skirting the default of combining anatomicals across sessions (which is specifically what I’m trying to avoid with this approach).

Moving data works fine for now, I’ll just check the reports prior to re-arranging, but I’m writing this into a pipeline for our lab’s future use so will also keep an eye on updates to the behavior.