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

Hi,
I’ve tried to use other entities such as “label” but the software does the same. Please let me which of them I should use to make sure that I don’t get unwanted run label. BTW I need it to make finalize my workaround for spectroscopy - lobi-mri-scripts/spectroscopy at main · nencki-lobi/lobi-mri-scripts · GitHub

Hi @Bartosz_Kossowski,

Which version of dcm2bids are you using ? We have released a new version last week (3.2.0).
The first thing It would be good if you can check if it works or not with this version.

If not, please provide your config file and the output log file as well.

Thank you

Best,
Arnaud

Sorry for any confusion caused. I forgot to specify a unique ‘label’ in my configuration files, which resulted in the addition of duplicate runs.
Dcm2bids is the best :slight_smile:

mrs
├── sub-12_ses-01_acq-conc_label-lesion_svs.json
├── sub-12_ses-01_acq-conc_label-lesion_svs.nii.gz
├── sub-12_ses-01_acq-conc_label-nawm_svs.json
├── sub-12_ses-01_acq-conc_label-nawm_svs.nii.gz
├── sub-12_ses-01_label-lesion_svs.json
├── sub-12_ses-01_label-lesion_svs.nii.gz
├── sub-12_ses-01_label-nawm_svs.json
└── sub-12_ses-01_label-nawm_svs.nii.gz

B.