BOLD_NOT_4D for one particular run (converting both single band and multi band files)

Summary of what happened:

I am trying to convert a set of dicom files to BIDS format using dcm2niix and a custom heuristic. See the following command:
heudiconv --files /mnt/LD4_PilotData/rawdata/LD001/*/*dcm -o /mnt/LD4_PilotData/subjects -f /mnt/LD4_PilotData/code/LD4_BIDS.py -s 001 -c dcm2niix -b --overwrite

Everything converts as expected except for one thing: One particular run, run # 5, which is the 6th run out of 7 runs (using a 0-6 naming convention) should be a functional bold 4D image, but for some reason it only has 3 dimensions after conversion. All the other functional runs are converted correctly with 4D. Hence, I’m not sure what’s going on with run # 5 (although I do not think it is a data issue, because I tried preprocessing the data in AFNI and it turns out fine).

Perhaps a factor is that my subject dicom files include both multiple multi-echo/multi-band scans and one or more non-ME/non-MB fMRI scans. So maybe I am not constructing my heurstic LD4_BIDS.py correctly to account for this? (This is my first time dealing with single and mutli band/ME files).

I have attached my custom heuristic LD4_BIDS.py.txt and any help is appreciated!

Command used (and if a helper script was used, a link to the helper script or the command generated):

heudiconv --files /mnt/LD4_PilotData/rawdata/LD001/*/*dcm -o /mnt/LD4_PilotData/subjects -f /mnt/LD4_PilotData/code/LD4_BIDS.py -s 001 -c dcm2niix -b --overwrite

Version:

  • OS: Ubuntu 18.04.6 LTS
  • Python version: Python 2.7.17
  • Heudiconv version: 0.5.4.dev1
  • dcm2niix version: v1.0.20181125

Environment (Docker, Singularity / Apptainer, custom installation):

  • Local environment

Data formatted according to a validatable standard? Please provide the output of the validator:

#### **Error 2: [Code 54] BOLD_NOT_4D**

Bold scans must be 4 dimensional.1 file

#### **sub-001_task-SD_run-05_echo-1_bold.nii.gz** **109.761 KB | application/gzip**

Location:

subjects/sub-001/func/sub-001_task-SD_run-05_echo-1_bold.nii.gz

Reason:

Bold scans must be 4 dimensional.

Evidence:

header field "dim" = 3,64,64,23

Hi @jsc180,

That’s an old version, try updating?

Any chance the file is something like an SBREF file?

Best,
Steven

Hi @Steven ,

Thank you so much for your reply.

I did try updating both my dcm2niix version and my heudiconv version (it was old as well), but it did not solve the problem of my 3D BOLD run # 5 directly.

However, your advice

did help me pinpoint the problem of the 3D BOLD nifti file. I think what’s going on is that the row in my dicominfo.tsv file which corresponds to run # 5, contains both the SBREF and BOLD dicom files. Thus, when I select that row in my custom heuristic file,

if ('29-fMRI_cmrr' in s.series_id):
            info[run05_ses05] = [s.series_id]

dcm2niix converts the SBREF dicoms as well, from which it determines that the converted nifti file should be 3D instead of 4D.

So now my problem is trying to figure out how I can construct the condition in my custom heuristic file that adds run # 5 to the info dictionary so that it only adds the BOLD dicom files and not the SBREF ones.

Is there any way to access the metadata of the dicom files within the for loop of your infotodict(seqinfo) function so that you can select dicoms with the desired name or dimension, or any ideas of other ways to be more specific in your selection of dicom files?

Many thanks,
John

Hi @jsc180,

I do not use heudiconv, but this sounds like a matter of just using multiple criteria. That is rather than using just the series_id, additionally use another part of the JSON meta data. You should see at least one thing in there that would indicate whether the associated nifti is the SBREF.

Best,
Steven