Dcm2bids produces bvec/bval with string of 0s for bold data

Hi @SamGuay,

I’m posting a question here that I received from our collaborator. @Lysianne is trying to convert multi-echo bold data to BIDS using dcm2bids (v2.x) and she found that the conversion produced files with run- rather than echo- entities, and these were also accompanied by bvec/bval files, which shouldn’t happen for bold data. On opening up the bvec/bval files, we found that it contained a string of 0s.

To figure out what might be going on @earl and I tried the following:

  1. Using the latest version of dcm2bids
  2. Using the “–auto-extract-entities” flag to extract echo numbers from the JSON sidecars.

Here’s the command we used:

dcm2bids -d rawdata/MR5001043375_20240122_145247/scans/ -o eric -p 01 -s 01 -c dcm2bids_v3_compatible.json --auto_extract_entities

Contents of our dcm2bids_config.json are as follows:

{
  "descriptions": [
        {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "anat_t1w_mp_rage_1mm"
      }
    },
    {
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": ["task-rest", "echo"],
      "criteria": {
        "SeriesDescription": "Rest_epi*"
      },
      "sidecar_changes": {
        "TaskName": "task-rest"
      }
    }
  ]
}

And finally, the stdout:

Sun Feb-11 11:28:03am CPU 37.6%:0:Netwk 3632 earlea@cn4314:~
> cd /data/NIMH_scratch/Beynel/test ; dcm2bids -d rawdata/MR5001043375_20240122_145247/scans/ -o eric -p 01 -s 01 -c dcm2bids_v3_compatible.json --auto_extract_entities
INFO    | --- dcm2bids start ---
INFO    | Running the following command: /usr/local/bin/dcm2bids -d rawdata/MR5001043375_20240122_145247/scans/ -o eric -p 01 -s 01 -c dcm2bids_v3_compatible.json --auto_extract_entities
INFO    | OS version: Linux-4.18.0-425.19.2.el8_7.x86_64-x86_64-with-glibc2.35
INFO    | Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
INFO    | dcm2bids version: 3.1.0
INFO    | dcm2niix version: v1.0.20230411
INFO    | Checking for software update
WARNING | A newer version exists for dcm2bids: 3.1.1
WARNING | You should update it -> https://github.com/UNFmontreal/Dcm2Bids.
INFO    | Currently using the latest version of dcm2niix.
INFO    | participant: sub-01
INFO    | session: ses-01
INFO    | config: /gpfs/gsfs12/users/NIMH_scratch/Beynel/test/dcm2bids_v3_compatible.json
INFO    | BIDS directory: /gpfs/gsfs12/users/NIMH_scratch/Beynel/test/eric
INFO    | Auto extract entities: True
INFO    | Validate BIDS: False

INFO    | Running: dcm2niix -b y -ba y -z y -f %3s_%f_%p_%t -o eric/tmp_dcm2bids/sub-01_ses-01 rawdata/MR5001043375_20240122_145247/scans
INFO    | Check log file for dcm2niix output

INFO    | SIDECAR PAIRING
INFO    | No Pairing  <-  001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00001
INFO    | No Pairing  <-  001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00010
INFO    | No Pairing  <-  001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00019
INFO    | No Pairing  <-  002_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_c32Ch_Head
INFO    | sub-01_ses-01_T1w  <-  003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247
WARNING | {'task'} have not been found for datatype 'func' and suffix 'bold'.
INFO    | sub-01_ses-01_task-rest_echo-1_bold  <-  005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e1
WARNING | {'task'} have not been found for datatype 'func' and suffix 'bold'.
INFO    | sub-01_ses-01_task-rest_echo-2_bold  <-  005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e2
WARNING | {'task'} have not been found for datatype 'func' and suffix 'bold'.
INFO    | sub-01_ses-01_task-rest_echo-3_bold  <-  005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e3
INFO    | No Pairing  <-  006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247
INFO    | No Pairing  <-  008_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247
INFO    | No Pairing  <-  40003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247
INFO    | No Pairing  <-  40006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247
INFO    | Moving acquisitions into BIDS folder "eric/sub-01/ses-01".

INFO    | Logs saved in eric/tmp_dcm2bids/log/sub-01_ses-01_20240211-112851.log
INFO    | --- dcm2bids end ---
Sun Feb-11 12:29:12pm CPU 38.0%:0:Netwk 3639 earlea@cn4314:/data/NIMH_scratch/Beynel/test
> ls eric/
old  tmp_dcm2bids
Sun Feb-11 4:45:14pm CPU 39.7%:0:Netwk 3622 earlea@cn4314:/data/NIMH_scratch/Beynel/test
> ls eric/tmp_dcm2bids/
log/           sub-01_ses-01/
Sun Feb-11 4:45:14pm CPU 39.7%:0:Netwk 3622 earlea@cn4314:/data/NIMH_scratch/Beynel/test
> ls eric/tmp_dcm2bids/sub-01_ses-01/
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00001.json'        '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e1.bval'    '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e3.json'
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00001.nii.gz'      '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e1.bvec'    '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e3.nii.gz'
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00010.json'        '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e1.json'    '006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.json'
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00010.nii.gz'      '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e1.nii.gz'  '006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.nii.gz'
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00019.json'        '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e2.bval'    '008_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.json'
'001_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_i00019.nii.gz'      '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e2.bvec'    '008_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.nii.gz'
'002_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_c32Ch_Head.json'    '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e2.json'    '40003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.json'
'002_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_c32Ch_Head.nii.gz'  '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e2.nii.gz'  '40003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.nii.gz'
'003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.json'               '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e3.bval'    '40006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.json'
'003_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.nii.gz'             '005_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247_e3.bvec'    '40006_scans_[XT-ID_20-M-0159]_NNU_-_20240122145247.nii.gz'

Running the latest version with the auto-extract-entities flag seems to encode the echo indices but it doesn’t output these files into the provided output directory, only the tmp_dcm2bids directory. But the bvec/bval files are still produced. Could you help us understand what might be causing the generation of bvec/bval files with a string of 0s?

Attached is also a zipped file of JSON sidecars, and bvec/bval files for a test subject and session. Thanks in advance for any assistance you can provide us!

Best,
Arsh

1 Like

Looks like I can’t upload files here so here’s a link to the metadata files neurostars_metadata – Google Drive

An update: The echo-<index> encoded files are correctly generated and stored in the given output directory. However, the bvec/bval files are still generated with a string of 0s in them.

Hi @Arsh,

From what I can see I think this is a dcm2niix issue. dcm2bids is build on top of dcm2niix.
I let @neurolabusc try to help you with your issue.

Thank you in advance
Arnaud

1 Like

Hi @Arsh,

This is a nuance of the NIH GE multi-band + multi-echo sequence that @Lysianne and others (including myself) use. The sequence includes DICOM tags for bvec/bval, so they get written out in dcm2nii. The values in DICOM (and written to NIFTI) are reasonably set to 0 for EPI acquisitions. They can be discarded from my perspective, although perhaps a BIDS-purist will insist they should exist.

-Peter

1 Like

@pmolfese Thanks! That makes a TON of sense. I agree that it might be best to remove them. However, if we decide to include it then it might be good to add this explanation in the README for end users.