Iβm struggling to get SDC working with case 1 from BIDS spec v1.7.
When fmriPrep runs, I get:
220512-10:54:01,254 nipype.workflow INFO:
B0 field inhomogeneity map will be estimated with the following 1 estimators: [<EstimatorType.PHASEDIFF: 3>].
220512-10:54:01,444 nipype.workflow INFO:
Using single-band reference file(s) sub-DPOP006_ses-1_task-rest_run-7_sbref.nii.gz.
220512-10:54:01,444 nipype.workflow CRITICAL:
None of the available B0 fieldmaps are associated to </bidsdir/sub-DPOP006/ses-1/func/sub-DPOP006_ses-1_task-rest_run-7_bold.nii.gz>
My bidsdir passes validation and I have setup IntendedFor for all three fmap images.
I have the echo times included and added the B0FieldIdentifier.
It looks to me like the preprocessing of fieldmaps is working. Itβs just not getting associated with my bold image.
Both mag (1 and 2) images and phasediff image, side cars have IntendedFor:
Not sure if this will do the trick, but can you try to put the IntendedFor argment in brackets? That is, [βses-1β¦nii.gzβ]. Otherwise, could you post your full command you are using to call fMRIPrep?
I recently encountered this ! If you drop B0FieldIdentifier, it will use the IntendedFor field appropriately. Otherwise, It prioritizes B0FieldIdentifier which requires B0FieldSource:
Oh that makes sense sort of. I donβt understand the B0FieldIndentifier and B0FieldSource and found it odd that I needed to include IntendedFor. Iβll read the doc you linked.
B0FieldIdentifier and B0FieldSource duplicate the capabilities of the original IntendedFor approach (see below), while permitting more complex use cases. It is RECOMMENDED to use both approaches to maintain compatibility with tools that support older datasets.
Removing the B0FieldIdentifer key from my fmaps and keeping only IntendedFor did the trick.
However, Iβd like to not use that system if possible. It makes my code more complex to have to know the associated bolds in advance of making the BIDS structure.
I donβt understand how the B0FieldIdentifer and B0FieldSource are supposed to work.
My guess, is that I add to the 3 field maps files (mag1, mag2, phase_diff) "B-FieldIdentifer": "phasediff_fmap0"
Then to the BOLD imageβs json, I add "B0FieldSource": "phasediff_fmap0".
That idea did not work as I received the same message to stdout, that no fieldmap was associated with the bold image.
To confirm: the first link is to common MR metadata fields for inclusion in the sidecar JSON files, rather than DICOM fields. It references relevant DICOM fields in the field description, to help in populating the field.
EDIT: The link corresponds to page 311 in the provided PDF.
To your question of using B0FieldIdentifier and B0FieldSource: Yes, youβd want to place the B0FieldSource field in the BOLD imagesβ JSON sidecar ! The _phasediff.json sidecar should look like this example
Iβd expect that to work appropriately. There have been previous reports of the reverse situation (i.e., not working with IntendedFor only), but since these reports occur sporadically, Iβm wondering if the working directory wasnβt accidentally re-used. Can you confirm that you re-ran both cases in a clean environment ?
Awesomeβ¦ I was putting not only the βkeyβ but also the value phasediff_fmap0 in the BOLDβs json.
The run with IntendedFor properly associated but then I got the dreaded error: KeyError: "Metadata term 'RepetitionTime' unavailable for file /bidsdir/sub-DPOP007/ses-2/func/sub-DPOP007_ses-2_task-rest_run-7_bold.nii.gz."
Of course that TR time is there perfectly from dcm2niix. Perhaps this is a bug that will go away.
In your case, it should correspond to what you had suggested previously:
{
"B0FieldSource": "phasediff_fmap0"
}
I agree, though, that there could be more relevant examples here! I imagine the challenge is that these B0Field fields can handle more complexity; i.e., an image being its own B0FieldSource, as alluded to in the current definitions.
Yeah thatβs what I triedβ¦no love. Same critical error of no association and a new one about missing TR time.
Iβm about to jump out the windowβ¦
Proof Iβm not crazy
The error I get from stdout.
220512-17:23:33,390 nipype.workflow INFO:
B0 field inhomogeneity map will be estimated with the following 1 estimators: [<EstimatorType.PHASEDIFF: 3>].
220512-17:23:33,600 nipype.workflow INFO:
Using single-band reference file(s) sub-DPOP007_ses-2_task-rest_run-7_sbref.nii.gz.
220512-17:23:33,600 nipype.workflow CRITICAL:
None of the available B0 fieldmaps are associated to </bidsdir/sub-DPOP007/ses-2/func/sub-DPOP007_ses-2_task-rest_run-7_bold.nii.gz>
Can you confirm that youβre not re-using an existing working directory?
Also, based on previous questions, Iβd guess this might be a file permissions issue. But to confirm: if you include the IntendedFor field, you see neither of the described issues ?