Heudiconv - AttributeError: 'tuple' object has no attribute 'dim1'

Dear all,
I run the docker, an example from a control group (CTRL):

docker run --rm -it -v /Users/bids:/base nipy/heudiconv:latest -d /base/Dicom/CTRL{subject}//MR. -o /base/Nifti/ -f /base/Nifti/code/heuristic.py -s 31 -c dcm2niix -b --overwrite --minmeta

INFO: Running heudiconv version 0.6.0 latest 0.6.0

INFO: Need to process 0 study sessions

INFO: Running heudiconv version 0.6.0 latest 0.6.0

INFO: Need to process 1 study sessions

INFO: PROCESSING STARTS: {‘subject’: ‘31’, ‘outdir’: ‘/base/Nifti/’, ‘session’: None}

INFO: Processing 1111 dicoms

INFO: Analyzing 1111 dicoms

/src/heudiconv/heudiconv/dicoms.py:58: UserWarning: The DICOM readers are highly experimental, unstable, and only work for Siemens time-series at the moment

Please use with caution. We would be grateful for your help in improving them

import nibabel.nicom.dicomwrappers as dw

INFO: Generated sequence info with 4 entries

Traceback (most recent call last):

File “/opt/miniconda-latest/bin/heudiconv”, line 11, in

load_entry_point('heudiconv', 'console_scripts', 'heudiconv')()

File “/src/heudiconv/heudiconv/cli/run.py”, line 128, in main

process_args(args)

File “/src/heudiconv/heudiconv/cli/run.py”, line 346, in process_args

dcmconfig=args.dcmconfig,)

File “/src/heudiconv/heudiconv/convert.py”, line 181, in prep_conversion

info = heuristic.infotodict(seqinfo_list)

File “/base/Nifti/code/heuristic.py”, line 29, in infotodict

if (s.dim1 == 256) and (s.TR == 2.3):

AttributeError: ‘tuple’ object has no attribute ‘dim1’

dicominfo.txt (1.5 KB) heuristic.txt (1.4 KB)

Ahoi hoi @Tali_Weiss,

your post appears to be cut off/missing some parts, but based on what’s there,
I assume you’re asking why your conversion is failing with that error, eh?

Based on the heuristic you shared, you might want to change for s in enumerate(seqinfo): to the line above you commented out: for idx, s in enumerate(seqinfo):, because enumerate returns a tuple of index and value. As you want to access the information in value you need to adapt your code to for idx, s as otherwise you end up doing the following (idx, value).dim1 and thus your error.

HTH and if not, let me know and I’ll try to explain it better.

Cheers, Peer

Thank you! It works when I change it to idx, s in enumerate(seqinfo):