Dealing with different BIDS versions

Hi There,
I am attempting to use the diffusion data from the OASIS-3 dataset. It seems that the fieldmaps that they provide no longer conform with any of the 4 possible structures outlined here:

and thus the dataset is rejected by the BIDS validator as were using dcm2niix v.2017-Oct-17 and BIDS 1.0.0.

The fieldmap structure they provide looks as follows:

  • sub-X_ses-d0000_acq-echo1_run-01_fieldmap.json
  • sub-X_ses-d0000_acq-echo1_run-01_fieldmap.nii.gz
  • sub-X_ses-d0000_acq-echo2_run-01_fieldmap.json
  • sub-X_ses-d0000_acq-echo2_run-01_fieldmap.nii.gz
  • sub-X_ses-d0000_acq-echo_run-02_fieldmap.json
  • sub-X_ses-d0000_acq-echo_run-02_fieldmap.nii.gz

It seems that 1.0.0-rc2 brought the introduction of the _magnitude.nii.gz files.

Is there anyway that I can alter this data such that it will still conform with the BIDS validator?

Many Thanks,
Christopher Fleetwood

Among the three files, are there two magnitude images and one phase-difference image?

I think you’ll need to load the jsons, and check the data types (phase vs. magnitude) and echo times, in order to determine how to relabel the files to match the current version of BIDS.

My initial guess is the conversion will look something like the following:

sub-X_ses-d0000_acq-echo1_run-01_fieldmap.nii.gz --> sub-X_ses-d0000_run-01_magnitude1.nii.gz
sub-X_ses-d0000_acq-echo2_run-01_fieldmap.nii.gz --> sub-X_ses-d0000_run-01_magnitude2.nii.gz
sub-X_ses-d0000_acq-echo_run-02_fieldmap.nii.gz --> sub-X_ses-d0000_run-01_phasediff.nii.gz

But you’ll really need to check the metadata to know for sure.

Hi @tsalo,
Thanks for your response.

I’ve looked over the jsons and there doesn’t seem to be any difference between them such that would indicate that one is a phase and one is a magnitude file.

I’ve attached the JSON files (as .txt files) if you could let me know if I am missing something that would be great.

Many Thanks,
Christopher Fleetwood
sub-OAS30002_ses-d2345_acq-echo_run-02_fieldmap.txt (1.6 KB) sub-OAS30002_ses-d2345_acq-echo1_run-01_fieldmap.txt (1.5 KB) sub-OAS30002_ses-d2345_acq-echo2_run-01_fieldmap.txt (1.6 KB)

Whether the image is phase or magnitude is reflected in the ImageType entry, in the third position of the associated list. ‘M’ means magnitude and ‘P’ means phase. (It may also be reflected elsewhere, but that’s where I check).

  • sub-OAS30002_ses-d2345_acq-echo_run-02_fieldmap.txt is phase (or possibly phase-difference). The echo time listed is 0.00605 seconds, and the echo number listed is 2.
  • sub-OAS30002_ses-d2345_acq-echo1_run-01_fieldmap.txt is magnitude, with an echo time of 0.00359 seconds.
  • sub-OAS30002_ses-d2345_acq-echo2_run-01_fieldmap.txt is also magnitude, with an echo time of 0.00605 seconds.

It’s unclear to me if acq-echo_run-02_fieldmap is a phase image or a phase-difference image. Three valid field map setups are 1 mag + 1 phasediff, 2 mag + 1 phasediff, and 2 mag + 2 phase. We know there are 2 magnitudes, so there could either be 1 phasediff or 2 phase images. Based on the fact that you only have one image, I’m going to assume that there is no missing data and that the image is a phase-difference image.

You’ll need to (1) rename the files (luckily my first guess in my first post was right) and (2) add metadata fields to the phase-difference file for “EchoTime1” and “EchoTime2”, with the shorter echo time as EchoTime1.

I’d probably write a short script to double-check these metadata fields (ImageType and EchoTime) before renaming all of the files in the dataset, just to be safe.


Hi @tsalo,
Thanks so much for checking those. I’ve changed the fields you suggested and the file names and now they pass the BIDS validator no problem.

The fact that this is Case 1 (2 magnitude + 1 phasediff) from the BIDS specification which they state is common with Siemens scanners leads me to think you’ve got it spot on.

I’ll write the scripts to edit the whole dataset and inform the authors.

Many thanks for your help and time, I really appreciate it.
Christopher Fleetwood