nipreps / mriqc

Automated Quality Control and visual reports for Quality Assessment of structural (T1w, T2w) and functional MRI of the brain
http://mriqc.readthedocs.io
Apache License 2.0
284 stars 128 forks source link

Further problem with multi-echo lists: `TypeError: unhashable type: 'list'` #1290

Closed celprov closed 2 months ago

celprov commented 2 months ago

What happened?

I was also running into the issue mentioned in #1282, which has been solved. However, the problem of multi-echo lists resurfaces here https://github.com/nipreps/mriqc/blob/04c1b90754b373f44e5a537b44df91fa46a330e4/mriqc/workflows/functional/base.py#L119

What command did you use?

singularity run -e /home/cprovins/singularity_images/mriqc_24_0_0.simg /data /out participant \
-B $DATADIR:/data:ro \
-B ${WORKDIR}:/work \
-B ${OUTDIR}:/out \
-B ${CODEDIR}/mriqc/mriqc:/opt/conda/lib/python3.11/site-packages/mriqc \
-w /work --participant-label sub-001 \
--nprocs 4 --mem 40G --omp-nthreads 8 \
-m bold --session-id 003 --no-datalad-get -vvv

What version of the software are you running?

24.0.0

How are you running this software?

Singularity

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.11/site-packages/mriqc/cli/workflow.py", line 56, in build_workflow
    retval['workflow'] = init_mriqc_wf()
                         ^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/mriqc/workflows/core.py", line 48, in init_mriqc_wf
    workflow.add_nodes([fmri_qc_workflow()])
                        ^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/mriqc/workflows/functional/base.py", line 119, in fmri_qc_workflow
    if set(dataset) - set(full_files):
       ^^^^^^^^^^^^
TypeError: unhashable type: 'list'

Additional information / screenshots

No response

oesteban commented 2 months ago
TypeError: unhashable type: 'list'

Python's set can only operate on 'hashable' types. A list is not 'hashable', so either you convert it to a tuple or you flatten the lists so all the elements are hashable. This fails for multi-echo because in both dataset and full_files multi-echo runs are merged into a list.

Do you want to give it a try or you want me to quickly fix it?

celprov commented 2 months ago

@oesteban please go ahead. I did not quickly come up with a fix.