How to filter for only certain sessions and tasks in fmriprep while keeping default behavior

My BIDS-dataset includes the nback, mid,faces, and rest task where for each subject I have two sessions. I want to only preprocess the first session and also exclude rsfMRI from the preprocessing while otherwise keeping the default behavior of fmriprep. Older versions of fmriprep allowed to select only certain sessions and tasks for preprocessing. But with newer versions (i.e. 23.1.0 for my case) the only option that I can find is to define a .json file with the --bids-filter-file option.

I am not sure how to make sure that the default behavior of fmriprep is ensured while defining the exclusion criteria above. This is how my file looks right now:

{
  "fmap": {"datatype": "fmap","session":"01"},
  "t1w": {"datatype": "anat", "suffix": "T1w","session":"01"},
  "bold": {"datatype": "func", "suffix": "bold","session":"01","task":"nback"},
  "bold": {"datatype": "func", "suffix": "bold","session":"01","task":"mid"},
  "bold": {"datatype": "func", "suffix": "bold","session":"01","task":"faces"},
}

Is this right? This is the folder structure of one subject:

.
├── ses-01
│   ├── anat
│   │   ├── sub-INDI1W934_ses-01_T1w.json
│   │   └── sub-INDI1W934_ses-01_T1w.nii
│   ├── dwi
│   │   ├── sub-INDI1W934_ses-01_acq-multishell_dir-pa_dwi.bval
│   │   ├── sub-INDI1W934_ses-01_acq-multishell_dir-pa_dwi.bvec
│   │   ├── sub-INDI1W934_ses-01_acq-multishell_dir-pa_dwi.json
│   │   └── sub-INDI1W934_ses-01_acq-multishell_dir-pa_dwi.nii
│   ├── fmap
│   │   ├── sub-INDI1W934_ses-01_APdistortionmap.json
│   │   ├── sub-INDI1W934_ses-01_APdistortionmap.nii
│   │   ├── sub-INDI1W934_ses-01_PAdistortionmap.json
│   │   ├── sub-INDI1W934_ses-01_PAdistortionmap.nii
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-ap_epi.bval
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-ap_epi.bvec
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-ap_epi.json
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-ap_epi.nii
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-pa_epi.bval
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-pa_epi.bvec
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-01_acq-B0fmapDWI_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-01_acq-B0sbreffmapDWI_dir-ap_epi.json
│   │   ├── sub-INDI1W934_ses-01_acq-B0sbreffmapDWI_dir-ap_epi.nii
│   │   ├── sub-INDI1W934_ses-01_acq-B0sbreffmapDWI_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-01_acq-B0sbreffmapDWI_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude1.json
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude1.nii
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude2.json
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude2.nii
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_phasediff.json
│   │   ├── sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_phasediff.nii
│   │   ├── sub-INDI1W934_ses-01_acq-sbreffmapDWI_dir-pa_epi.json
│   │   └── sub-INDI1W934_ses-01_acq-sbreffmapDWI_dir-pa_epi.nii
│   └── func
│       ├── sub-INDI1W934_ses-01_task-faces_bold.json
│       ├── sub-INDI1W934_ses-01_task-faces_bold.nii
│       ├── sub-INDI1W934_ses-01_task-faces_events.tsv
│       ├── sub-INDI1W934_ses-01_task-faces_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-faces_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-faces_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-faces_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-mid_bold.json
│       ├── sub-INDI1W934_ses-01_task-mid_bold.nii
│       ├── sub-INDI1W934_ses-01_task-mid_events.tsv
│       ├── sub-INDI1W934_ses-01_task-mid_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-mid_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-mid_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-mid_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-midreadout_events.tsv
│       ├── sub-INDI1W934_ses-01_task-nback_bold.json
│       ├── sub-INDI1W934_ses-01_task-nback_bold.nii
│       ├── sub-INDI1W934_ses-01_task-nback_events.tsv
│       ├── sub-INDI1W934_ses-01_task-nback_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-nback_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-nback_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-nback_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-nbackperf_events.tsv
│       ├── sub-INDI1W934_ses-01_task-rest_bold.json
│       ├── sub-INDI1W934_ses-01_task-rest_bold.nii
│       ├── sub-INDI1W934_ses-01_task-rest_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-rest_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-01_task-rest_recording-PULS_physio.tsv.gz
│       └── sub-INDI1W934_ses-01_task-rest_recording-RESP_physio.tsv.gz
├── ses-02
│   ├── anat
│   │   ├── sub-INDI1W934_ses-02_T1w.json
│   │   └── sub-INDI1W934_ses-02_T1w.nii
│   ├── dwi
│   │   ├── sub-INDI1W934_ses-02_acq-multishell_dir-pa_dwi.bval
│   │   ├── sub-INDI1W934_ses-02_acq-multishell_dir-pa_dwi.bvec
│   │   ├── sub-INDI1W934_ses-02_acq-multishell_dir-pa_dwi.json
│   │   └── sub-INDI1W934_ses-02_acq-multishell_dir-pa_dwi.nii
│   ├── fmap
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-ap_epi.bval
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-ap_epi.bvec
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-ap_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-ap_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-pa_epi.bval
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-pa_epi.bvec
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-B0fmapDWI_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-B0sbreffmapDWI_dir-ap_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-B0sbreffmapDWI_dir-ap_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-B0sbreffmapDWI_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-B0sbreffmapDWI_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-PA_phasediff.json
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-PA_phasediff.nii
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-ap_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-ap_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_magnitude1.json
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_magnitude1.nii
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_magnitude2.json
│   │   ├── sub-INDI1W934_ses-02_acq-fmapBOLD_dir-pa_magnitude2.nii
│   │   ├── sub-INDI1W934_ses-02_acq-sbreffmapDWI_dir-pa_epi.json
│   │   ├── sub-INDI1W934_ses-02_acq-sbreffmapDWI_dir-pa_epi.nii
│   │   ├── sub-INDI1W934_ses-02_acq-tracewfmapDWI_dir-pa_epi.json
│   │   └── sub-INDI1W934_ses-02_acq-tracewfmapDWI_dir-pa_epi.nii
│   └── func
│       ├── sub-INDI1W934_ses-02_task-faces_bold.json
│       ├── sub-INDI1W934_ses-02_task-faces_bold.nii
│       ├── sub-INDI1W934_ses-02_task-faces_events.tsv
│       ├── sub-INDI1W934_ses-02_task-faces_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-faces_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-faces_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-faces_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-mid_bold.json
│       ├── sub-INDI1W934_ses-02_task-mid_bold.nii
│       ├── sub-INDI1W934_ses-02_task-mid_events.tsv
│       ├── sub-INDI1W934_ses-02_task-mid_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-mid_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-mid_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-mid_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-midreadout_events.tsv
│       ├── sub-INDI1W934_ses-02_task-nback_bold.json
│       ├── sub-INDI1W934_ses-02_task-nback_bold.nii
│       ├── sub-INDI1W934_ses-02_task-nback_events.tsv
│       ├── sub-INDI1W934_ses-02_task-nback_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-nback_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-nback_recording-PULS_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-nback_recording-RESP_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-nbackperf_events.tsv
│       ├── sub-INDI1W934_ses-02_task-rest_bold.json
│       ├── sub-INDI1W934_ses-02_task-rest_bold.nii
│       ├── sub-INDI1W934_ses-02_task-rest_recording-EXT_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-rest_recording-Info_physio.tsv.gz
│       ├── sub-INDI1W934_ses-02_task-rest_recording-PULS_physio.tsv.gz
│       └── sub-INDI1W934_ses-02_task-rest_recording-RESP_physio.tsv.gz
└── sub-INDI1W934_sessions.tsv

P.S.: Maybe It would be nice if there was some sort of --ignore option to exclude sessions or tasks you don’t want, instead of having to first include everything you want and then leave out the stuff that you don’t want (kind of thinking from an “exclusion”, not from an “inclusion” perspective)?

Hi @JohannesWiesner

You might be interested in the previous thread about OR operators. You can try:

{
  "bold": {"datatype": "func", "task": ["nback","mid","faces"], "suffix": "bold"},
}

Other BIDS stuff:

*distortionmap is not a valid fmap suffix

BVAL and BVEC files should not be in fmap either

I believe PA/AP need to be capitalized for certain softwares.

Best,
Steven

@Steven: Nice, didn’t know that you can specify lists. But would this also mean that

{
  "bold": {"datatype": "func", "task": ["nback","mid","faces"], "suffix": "bold", "session":"01"},
}

is enough to achieve what I want and I can skip this part:

“fmap”: {“datatype”: “fmap”,“session”:“01”},
“t1w”: {“datatype”: “anat”, “suffix”: “T1w”,“session”:“01”},

?

Other BIDS stuff: […]

Yes, I know. Unfortunately, I can’t change that (since I didn’t do the BIDS conversion and also don’t have access to the DICOMS). Oddly enough, the fieldmap correction seems to have worked with fmriprep 20.2.1, despite the file names not conforming to BIDS. Or are these valid suffixes for older fmriprep versions?

Hi @JohannesWiesner,

Should be fine for fmaps, since only the ones associated with the relevant BOLD files should be selected. For T1w, it depends: Do you want your T1w reference to be a template derived from all sessions’ T1w (default) or just from that session’s T1w specifically?

Best,
Steven

1 Like

@Steven: It seems like with the current solution, fmriprep does not take the fieldmaps into account (filtering out the second session and resting state fmri worked fine though, and fmriprep, in general, ran successfully). I tried to add fieldmap to the .json file but it still didn’t work:

{
  "bold": {"datatype": "func", "task": ["nback","mid","faces"], "suffix": "bold", "session":"01"},
  "fmap": {"datatype": "fmap","session":"01"}
}

Did you set your fmap associations with IntendedFor or B0FieldSource/B0FieldIdentifier?

Edit: Apologies, I read one post and posted on another.

For these files, the IntendedFor field points to the respective task images:

sub-*_ses-*_acq-fmapBOLD_dir-pa_phasediff.json
sub-I*_ses-*_acq-fmapBOLD_dir-pa_magnitude1.json

The B0FieldSource /B0FieldIdentifier fields have not been set.

@Steven: I re-ran fmriprep but this time with version 20.2.7. Here, everything worked and the fieldmap distortion correction is included. Do you know what I can do to achieve the same with 23.1.0?

Can you show me an example fmap json?

This is how the .json for sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude1.json looks like (sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude2.json looks exactly the same with only a slightly different "EchoTime")

{
	"ConversionSoftware": "dicm2nii.m 20210529",
	"SeriesNumber": 6,
	"SeriesDescription": "gre_field_PA_mapping_cmrr",
	"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND"],
	"Modality": "MR",
	"AcquisitionDateTime": "20211021145404.910000",
	"TotalReadoutTime": 0.1084608,
	"RepetitionTime": 0.4,
	"PhaseEncodingDirection": "j",
	"EffectiveEchoSpacing": 0.0017216,
	"EchoTime": 0.00492,
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
	"deltaTE": 2.46,
	"SliceThickness": 3,
	"FlipAngle": 60,
	"Manufacturer": "SIEMENS",
	"SoftwareVersion": "syngo MR E11",
	"MRAcquisitionType": "2D",
	"InstitutionName": "NPSY",
	"InstitutionAddress": "J 5,Mannheim,District,DE,68159",
	"DeviceSerialNumber": "167069",
	"ScanningSequence": "GR",
	"SequenceVariant": "SP",
	"SequenceName": "*fm2d2r"
}

The file sub-INDI1W934_ses-01_PAdistortionmap.json looks like this:

{
	"ConversionSoftware": "dicm2nii.m 20210529",
	"SeriesNumber": 4,
	"SeriesDescription": "gre_field_PA_mapping_cmrr_distortionMap",
	"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "MOSAIC"],
	"Modality": "MR",
	"AcquisitionDateTime": "20211021145345.567500",
	"TotalReadoutTime": 0.04149917,
	"PhaseEncodingDirection": "j",
	"EffectiveEchoSpacing": 0.00049999,
	"EchoTime": 0.0512,
	"SliceThickness": 2.4000001,
	"FlipAngle": 90,
	"Manufacturer": "SIEMENS",
	"SoftwareVersion": "syngo MR E11",
	"MRAcquisitionType": "2D",
	"InstitutionName": "NPSY",
	"InstitutionAddress": "J 5,Mannheim,District,DE,68159",
	"DeviceSerialNumber": "167069",
	"ScanningSequence": "EP",
	"SequenceVariant": "SK",
	"ScanOptions": "FS",
	"SequenceName": "epse2d1_84"
}

and sub-INDI1W934_ses-01_PAdistortionmap.json looks like this:


	"ConversionSoftware": "dicm2nii.m 20210529",
	"SeriesNumber": 5,
	"SeriesDescription": "gre_field_PAropepolarity_mapping_cmrr_distortionMap",
	"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "MOSAIC"],
	"Modality": "MR",
	"AcquisitionDateTime": "20211021145353.170000",
	"TotalReadoutTime": 0.04149917,
	"PhaseEncodingDirection": "j-",
	"EffectiveEchoSpacing": 0.00049999,
	"EchoTime": 0.0512,
	"SliceThickness": 2.4000001,
	"FlipAngle": 90,
	"Manufacturer": "SIEMENS",
	"SoftwareVersion": "syngo MR E11",
	"MRAcquisitionType": "2D",
	"InstitutionName": "NPSY",
	"InstitutionAddress": "J 5,Mannheim,District,DE,68159",
	"DeviceSerialNumber": "167069",
	"ScanningSequence": "EP",
	"SequenceVariant": "SK",
	"ScanOptions": "FS",
	"SequenceName": "epse2d1_84"
}

Hi @JohannesWiesner,

  1. Does the phasediff image also have the IntendedFor filled out?
  2. You have a lot of repeated IntendedFor fields, you should delete the duplicates.

This will not be picked up by fMRIPrep since it is not a BIDS valid fmap name.

Best,
Steven

@Steven:

  1. Does the phasediff image also have the IntendedFor filled out?

This is what sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_phasediff.json looks like:

{
	"ConversionSoftware": "dicm2nii.m 20210529",
	"SeriesNumber": 7,
	"SeriesDescription": "gre_field_PA_mapping_cmrr",
	"ImageType": ["ORIGINAL", "PRIMARY", "P", "ND"],
	"Modality": "MR",
	"AcquisitionDateTime": "20211021145405.312500",
	"TotalReadoutTime": 0.1084608,
	"RepetitionTime": 0.4,
	"PhaseEncodingDirection": "j",
	"EffectiveEchoSpacing": 0.0017216,
	"EchoTime": 0.00738,
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
"EchoTime2": 0.00738, 
"EchoTime1": 0.00492, 
"IntendedFor": ["func/sub-INDI1W934_ses-01_task-faces_bold.nii", "func/sub-INDI1W934_ses-01_task-mid_bold.nii", "func/sub-INDI1W934_ses-01_task-nback_bold.nii", "func/sub-INDI1W934_ses-01_task-rest_bold.nii"], 
	"deltaTE": 2.46,
	"SliceThickness": 3,
	"FlipAngle": 60,
	"Manufacturer": "SIEMENS",
	"SoftwareVersion": "syngo MR E11",
	"MRAcquisitionType": "2D",
	"InstitutionName": "NPSY",
	"InstitutionAddress": "J 5,Mannheim,District,DE,68159",
	"DeviceSerialNumber": "167069",
	"ScanningSequence": "GR",
	"SequenceVariant": "SP",
	"SequenceName": "*fm2d2r"
}
  1. You have a lot of repeated IntendedFor fields, you should delete the duplicates

I know. Someone else wrote the script to fill out the IntendedFor fields. Apparently, this script did not include an if-else section to control that this field should only be added if it hasn’t been added before. Do you think that this causes trouble? Or is this more of an aesthetic question?

  1. This will not be picked up by fMRIPrep since it is not a BIDS valid fmap name.

Yes, I thought so. I will forward it to the maintainer of the dataset. Not even sure, what this file ist?

Could you try making a minimally BIDS valid dataset with one subject? That is, use only the files you need to run fmriprep, make everything completely BIDS valid, clean up duplicate fields, and run fmriprep on that dataset?

Will try and come back to you! Could you help me with the fmap folder? What files would you include and which should I drop?

Just include the magnitude/phasediff files you are using to correct your BOLD.

1 Like

Okay works now (although distortion correction makes the distortion even worse with 23.1.0, but that’s already issued here and not part of this topic). I am not sure though which of the changes exactly helped version 23.1.0 to recognize the fieldmaps (in contrast to 20.2.7).

1.) I first got a lot of [Code 1] NOT_INCLUDED errors because of wrong filename descriptions. I then first deleted the sub-INDI1W934_ses-01_PA/PAdistortionmap.nii/.json files.
2.) The BIDS-validator (v1.12.0) apparently still didn’t like the dir and acq entities in the other fieldmap files (wonder why, because arent’ these valid optional entities, also for fieldmaps?). I tried to one by one delete either the acq or the dir entities, but the validator only was happy after removing both entities. Therefore files like sub-INDI1W934_ses-01_acq-fmapBOLD_dir-pa_magnitude1.json had to renamed to sub-INDI1W934_ses-01_magnitude1.json.
3. After renaming all files [Code 37] INTENDED_FOR popped up (wasn’t the case before renaming the files). The solution to this was to also include the session directory in the “IntendedFor” field. So I had to be "IntendedFor": ["ses-01/func/sub-INDI1W934_ses-01_task-faces_bold.nii"] and not "IntendedFor": [func/sub-INDI1W934_ses-01_task-faces_bold.nii"]

Hi @JohannesWiesner,

All of those validation errors make sense. The first one is pretty self explanatory. The second one might be because pa is not capitalized in the dir-<> label. The third is one I should have caught earlier, my bad! IntendedFor indeed points to files as relative to the top-level of each subject folder, which would be the session folder, if one exists.

Best,
Steven

1 Like

I also tried to use dir-PA/dir-AP but the BIDS-validator didn’t like them as well (also couldn’t find any documentation if the label must be in capital letters?). Anyways, I guess I have to ask the maintainer to redo the BIDS-transformation. Still interesting though that version 20.2.7 didn’t have any problems with these issues, wonder what has changed between those versions that it doesn’t work with 23.1.0 (especially since both are running with --skip-bids-validation)

Hi @JohannesWiesner ,

Depending on which case of fieldmap you are dealing with, it seems that the dir-label is sometimes accepted, sometimes not. (It is accepted for instance for the case 4: pepolar method but not for the other methods).

1 Like