Heudiconv not creating output

I hope this is just me messing up something small, but I can’t figure out what. I am running heudiconv on a set of data. The docker output appears to be working correctly

docker run --rm -it -v /Users/gracer/Google\ Drive/Insulin_brain/raw:/data:ro -v /Users/gracer/Google\ Drive/Insulin_brain/BIDS:/output nipy/heudiconv:latest -d /data/sub_{subject}_{session}/dicoms//.IMA -s 20001 --ses 2 -f /output/heuristic.py -c dcm2niix -b -o output --overwrite

WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

INFO: Running heudiconv version 0.13.0 latest 0.13.0

INFO: Need to process 1 study sessions

INFO: PROCESSING STARTS: {‘subject’: ‘20001’, ‘outdir’: ‘/output/’, ‘session’: ‘2’}

INFO: Processing 768 dicoms

INFO: Reloading existing filegroup.json because /output/.heudiconv/20001/ses-2/info/20001_ses-2.edit.txt exists

INFO: Doing conversion using dcm2niix

INFO: Populating template files under /output/

INFO: PROCESSING DONE: {‘subject’: ‘20001’, ‘outdir’: ‘/output/’, ‘session’: ‘2’}

But my BIDS output folder only has the participants.tsv and json files… No nifti files. I tested dcm2niix alone and it works fine on my dicoms.

Here is a link to my heuristic.py and an example tsv (ID redacted) generated from using the convertall

Any help is appreciated,

Hi @Grace_Shearrer,

sorry to hear that you’re having troubles with heudiconv.

Just a few quick questions:

  • did your actual run include the / before output, ie -o /output and not -o output?
  • is the // in .../dicoms//.IMA a typo and did you include a * in the actual run, ie .../dicoms/*.IMA?
  • is the output you posted everything you get when running the command (usually there should be a lot of nipype worklow messages?

I had a quick look at the heuristic.py file you shared. As far as I can tell, the identifier you want to use for the t1w is not existing in the dicominfo.tsv and thus might have to be adapted. Also, could you maybe try updating the heuristic.py file like so:

import os

def create_key(template, outtype=('nii.gz',), annotation_classes=None):

    if template is None or not template:
    raise ValueError('Template must be a valid format string')
    return template, outtype, annotation_classes

def infotodict(seqinfo):
    """Heuristic evaluator for determining which runs belong where
    allowed template fields - follow python string module:
    item: index within category
    subject: participant id
    seqitem: run number during scanning
    subindex: sub index within group
    t1w = create_key('sub-{subject}/{session}/anat/sub- {subject}_{session}_T1w')
    clamp_mprage = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_desc-clamp_bold')
    mprage = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_bold')

    info = {t1w: [], clamp_mprage: [], mprage: []}

    for idx, s in enumerate(seqinfo):
        if 't1_mprage_sag_brain' in s.protocol_name:
        if 'fMRI_loc_3mm' in s.protocol_name:
        if 'fMRI_sa3_3mm_3600reps' in s.protocol_name:
    return info

and try again? Before doing so, could you maybe delete the (ie all) content under /output/.heudiconv/?

HTH, cheers, Peer

Hi Peer!
Thank you so much for your help. I followed your advice (and yes those // were a weird formatting error they should have been * ) and deleted the .heudiconv directory, I changed the heudiconv to:
for s in seqinfo:
for idx, s in enumerate(seqinfo):
if ‘t1_mprage_sag_brain’ in s.protocol_name:
if ‘fMRI_loc_3mm’ in s.protocol_name:
if ‘fMRI_sa3_3mm_3600reps’ in s.protocol_name:
I took the quotation marks off of the keys.

Now it works :slight_smile:

Thank you again!


1 Like

Hi @Grace_Shearrer,

super cool, happy it works now.

Cheers, Peer