Heudiconv does not create func folder

Hi NeuroStars Community,

For days I have been wrestling to get heudiconv to convert all my data into the BIDS structure. This works well for the T1 (anat), DTI (dwi), and fieldmap (fmap) images, but somehow there is no conversion of the functional images (bold and sbref) into a func folder.

The heuristics file is created, convertall.py, where the correct BIDS folders are referenced in the create_key fields I think.

One other peculiarity I encountered: For DWI, I have a second image file, which are six b0 volumes. Although I specified this as a criterion for this scan [if(‘diff_PA’ in s.protocol_name) and (s.dim4 == 6)],
it isn’t created, although I confirmed dim4 to be 6 after converting the dicoms myself with dcm2niix. The conversion is done when removing the s.dim4 criterion though…

I am running version 0.8.0, and tried it using both PIP install and singularity.

Looking forward to see if someone knows a solution to these issues!
Ilya

One potential problem with how the heuristic is set up is everything is a separate if statement. This could run into trouble on some series that fall under multiple criteria. You can avoid this by changing them to elif after the initial if.

Otherwise, there’s likely some discrepancy between the dicominfo.tsv and your conditions, I would double check both files to be sure you are applying the correct rules.

Hi Mathias,

Thanks for your thoughts, you put me on the right track and I managed to solve. There wasn’t a problem of if-statements only. However, I noticed that for all functional scans the string needed to match the protocol name exactly, which it did not. I just had to change the == into in :sweat_smile:.

For the DWI scan, I indeed located the problem in the dicominfo.tsv file. Somehow the 6 volumes were not coded in dim4, but multiplied with dim3. Not sure why this happened, and whether this is random behavior or a structural error related to this specific scan. After conversion, the 4D image does have 6 volumes though…

Cheers, and thanks again for your reply!
Ilya

1 Like