Dcm2bids not adding custom_entities to filenames

Hello!

I am using dcm2bids version 3.0.1. When specifying custom_entities it does not use this when naming the file, instead it seems to think that I have multiple runs of the same task and appends run-x instead. I have pasted some of the config file below and the resulting filenames. The strange thing is that sometimes it appears to work, or will copy part of the name but not all of it. I assume I’m doing something wrong, any help would be much appreciated - thanks!

T1w image, sagital

{
  "datatype": "anat",
  "suffix": "T1w",
    "custom_entities": "mprage-Sag-1mm",
  "criteria": {
    "SeriesDescription": "t1_mprage_1mmiso_sag_PAT2_nonse*",
"ImageOrientationText": "Sag"
  }
}, 

Output filename: sub-pilot1_run-01_Sag-1mm_T1w.nii.gz

{
  "datatype": "anat",
  "suffix": "RB1map",
 "custom_entities": "echo1",
  "criteria": {
    "SeriesDescription": "3DREAM_B1_250V",
"EchoNumber": "1"
  }
}, 

Output filename: sub-pilot1_run-01_RB1map.nii.gz

fMRI task

{
“id”: “id_task-oddity-1mm_bold”,
“datatype”: “func”,
“suffix”: “bold”,
“custom_entities”: “task-oddity-1mm”,
“criteria”: {
“SeriesDescription”: “Oddity_EPI1p0mm_MB4_TR2_80sl”
},
“sidecarChanges”: {
“TaskName”: “Oddity”
}
},

Output filename: sub-pilot1_run-01_bold.nii.gz

fMRI task different resolution

{
  "id": "id_task-oddity-0p8mm_bold",
  "datatype": "func",
  "suffix": "bold",
    "custom_entities": "task-oddity-0p8mm",
  "criteria": {
    "SeriesDescription": "Oddity_EPI0p8mm_MB3_FLEET"
  },
  "sidecarChanges": {
    "TaskName": "Oddity"
  }
},

Output filename: sub-pilot1_run-02_bold.nii.gz

Hi @El-Suri,

Your custom entities inputs are not BIDS valid. Dcm2bids looks for BIDS-valid entity labels for proper renaming. Please review the naming criteria for files at Magnetic Resonance Imaging - Brain Imaging Data Structure v1.8.0

In particular:

None of these are BIDS valid labels (but you could do something like acq-MPRAGESag1MM).

This is not a BIDS-valid suffix for anat.

There should be a dash between echo and 1.

The -1mm is not valid (but you can have task-oddity_acq-1mm if you want).

Same idea here.

Best,
Steven

1 Like

Hi Steven,

Ah okay I see! I was getting quite confused looking at the BIDS documentation, thank you for taking the time to provide some examples.

For anyone else struggling with BIDS and config files there is a great tutorial here: BIDS Overview and Tutorial — Andy's Brain Book 1.0 documentation

The config file example does not follow the latest dcm2bids conventions but they are not that different so its still a great start!

Thanks

1 Like