fMRIprep: rec-<label> multiple usage? --bids-filter-file with proc-<label> (problem)?

Dear NeuroStars community,
I just joinned Neurostars - I always browse the forum and find all the responses amazing, and now I have a first (long! sorry) question of my own. :slight_smile:

I 'd like to ask about a problem I’m having with fmriprep and which labels to use.

My first question would be:

1) Can the rec-label be used for multiple reconstructions? and how best to do that?

For example, I will have a future dataset which has T1w images with both Siemens prescan normalize applied, and Siemens Nonlinear gradient correction. (Image Type in the json having: NORM and DIS3D).
I got that the nonlinear gradient correction should have the rec-DIS3D label, and the prescan normalize label could be either rec-norm or proc-norm, however, the proc-label is not yet accepted in BIDS for MRI data ([ENH] add _proc-<label> to all modalities having _rec (anat, fmap, func, perf, and pet) by yarikoptic Β· Pull Request #105 Β· bids-standard/bids-specification Β· GitHub)?
For now our team is using two separate labels (rec-DIS3D and proc-norm, instead of e.g., rec-DIS3Dnorm. rec-norm, rec-DIS3D), because merging the rec-label seems harder to read (and code). I then use a bids-filter-file to select the T1w image I want to use.

2) Can/will the proc-label be used with fmriprep and a bids-filter-file?

(This is where the problem crops up with fmriprep… notably in the fieldmaps SDC pipeline).

For my func/fmap data, I currently have two outputs for my _bold and _epi files, which are either prescan normalized (here I use the proc-norm label) or not (no proc-label).
When I use a -bids-filter-file to select proc-norm for one run of fmriprep, and the non-normalized files for the other, the non-normalized stream works perfectly, however the proc-norm stream does not find the IntendedFor argument correctly in the .json file and SDC is not applied. (Output files also lose the proc-label).
When I tested another way by creating a new database with only the proc-norm files, and not using the -bids-filter-file for the func/fmap files (just the anat still filtered), fmriprep works OK and SDC is applied (the IntendedFor arguments in the json were the same).
So it seems that using the proc-norm label could be OKish - except when used with a bids-filter-file with proc: β€œnorm” in the func/fmap modalities? (and that the proc-label disappears)

So, I’d like to ask what the best option would be.

  • If the proc-norm label will be integrated to the MRI BIDS/fmriprep soon? (For now this problem occurs with fmriprep BIDS validator: proc not in rule rules.files.raw.fmap.pepolar)
  • Using the rec-label in a merged way with multiple reconstruction labels? (rec-DIS3Dnorm/rec-DIS3D/rec-norm) (not tested yet - would require some recoding).
  • Probably less optimal but it works: Having the data filtered out into separate databases? (e.g., data_procnorm / data)

… And/Or upgrading fmriprep version - I was using v 23.0.0 with singularity on a HPC (I could try again with 24.)

Thanks in advance!
Penelope



Below are the errors for the proc-norm and -bids-filter-file fmriprep stream (which don’t occur if I put the proc-norm files in a separate database and I only filter for T1w, not func/fmap)

Command used:

singularity run \
--cleanenv \
 -B /home/user \
/data/container/fmriprep/fmriprep-23.0.0.sif \
/home/user/path/data_cava \
/home/user/path/data_cava/derivatives/fmriprep_procnorm \
participant \
--participant-label sub-hl6cma \
-w /home/user/path/tmp/procnorm \
--fs-license-file /home/user/path/code/cava/07_fmriprep/license.txt \
--output-spaces T1w fsnative fsaverage MNI152NLin6Asym MNI152NLin2009cAsym \
--bold2t1w-dof 12 \
--ignore sbref \
--bids-filter-file /home/user/path/code/cava/07_fmriprep/config_procnorm.json \
--skip-bids-validation

The bids-filter-file: (config_procnorm.json)

 {
    "t1w": {
        "datatype": "anat",
        "session": "01",
        "acquisition": null,
        "reconstruction": null,
        "suffix": "T1w"
    },
    "bold": {
        "datatype": "func",
        "session": "01",
        "proc": "norm",
        "suffix": "bold"
    },
    "fmap": {
        "datatype": "fmap",
        "session": "01",
        "proc": "norm",
        "suffix": "epi"
    }
} 

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

Not quite…

Directory structure:

/home/user/path/data_cava/sub-hl6cma/ses-01/fmap
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4gre_dir-PA_epi.json
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4gre_dir-PA_epi.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.json
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-AP_epi.json
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-AP_epi.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-AP_proc-norm_epi.json
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-AP_proc-norm_epi.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-PA_epi.json
β”œβ”€β”€ sub-hl6cma_ses-01_acq-MB4se_dir-PA_epi.nii.gz

/home/user/path/data_cava/sub-hl6cma/ses-01/func
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_bold.json
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_bold.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_events.tsv
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.json
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz
β”œβ”€β”€ sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_events.tsv
etc... (there are more tasks) 

Among the relevant non-valid outputs, the following occurs for all proc-norm labelled fieldmaps:

Entity not listed as required or optional for files with this suffix /sub-hl6cma/ses-01/fmap/sub-hl6cma_ses-01_acq-MB4se_dir-AP_proc-norm_epi.nii.gz (proc not in rule rules.files.raw.fmap.pepolar)

Relevant log outputs:

240910-09:46:46,728 nipype.workflow INFO:
	 B0 field inhomogeneity map will be estimated with  the following 6 estimators: [<EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>].
240910-09:46:47,480 nipype.workflow INFO:
	 No single-band-reference found for sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz.
240910-09:46:47,481 nipype.workflow CRITICAL:
	 None of the available B0 fieldmaps are associated to </home/user/path/data_cava/sub-hl6cma/ses-01/func/sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz>


240910-09:46:52,709 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00000" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4se_dir-AP_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_acq-MB4se_dir-PA_proc-norm_epi.nii.gz>
240910-09:46:52,812 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00001" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-faces_acq-MB4_dir-AP_run-02_bold.nii.gz>
240910-09:46:52,906 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00002" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-video_acq-MB4_dir-AP_bold.nii.gz>
240910-09:46:52,998 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00003" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-rest_acq-MB4_dir-AP_bold.nii.gz>
240910-09:46:53,91 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00004" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-faces_acq-MB4_dir-AP_run-01_bold.nii.gz>
240910-09:46:53,189 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00005" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_bold.nii.gz>

As an aside, the log outputs when the database only contains proc-norm files and -bids-filter-file isn’t used for func/fmap is this (so all but the bids-filter-file is the same):

240911-10:57:07,426 nipype.workflow INFO:
	 B0 field inhomogeneity map will be estimated with  the following 6 estimators: [<EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>].
240911-10:57:07,730 nipype.workflow INFO:
	 No single-band-reference found for sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz.
240911-10:57:07,731 nipype.workflow INFO:
	 Found usable B0-map (fieldmap) estimator(s) <auto_00000, auto_00003> to correct </home/user/path/test_cava/sub-hl6cma/ses-01/func/sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz> for susceptibility-derived distortions.
	 
	 
240911-10:57:08,405 nipype.workflow WARNING:
	 Several fieldmaps <auto_00000, auto_00003> are 'IntendedFor' </home/user/path/test_cava/sub-hl6cma/ses-01/func/sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz>, using auto_00000
	 
	 
240911-10:57:11,284 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00000" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4se_dir-AP_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_acq-MB4se_dir-PA_proc-norm_epi.nii.gz>
240911-10:57:11,361 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00001" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-faces_acq-MB4_dir-AP_proc-norm_run-01_bold.nii.gz>
240911-10:57:11,436 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00002" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-rest_acq-MB4_dir-AP_proc-norm_bold.nii.gz>
240911-10:57:11,512 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00003" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-ANC_acq-MB4_dir-AP_proc-norm_bold.nii.gz>
240911-10:57:11,588 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00004" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-video_acq-MB4_dir-AP_proc-norm_bold.nii.gz>
240911-10:57:11,663 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00005" (EstimatorType.PEPOLAR) with <sub-hl6cma_ses-01_acq-MB4gre_dir-PA_proc-norm_epi.nii.gz, sub-hl6cma_ses-01_task-faces_acq-MB4_dir-AP_proc-norm_run-02_bold.nii.gz>