[fmriprep] tCompCorr crashes on empty array?

Hi there,

I’m very impressed with the robustness and easiness of converting my datasets to BIDS and throwing them into fmriprep. Thanks a bunch!

I’m currently running a Singularity container on Dutch cloud service for scientists (SurfSara/LISA). The workflow worked fine for three openfmri datasets (ds008, ds102 and ds164). However, now I’m trying my own dataset and it fails to get the confounds matrix. Specifically, the TCompCorr-Node fails for al subjects, in the following way:

Node Name: fmriprep_wf.single_subject_01_wf.func_preproc_task_binocularrivalry_run_01_wf.discover_wf.tcompcor
File: crash-20170807-144733-gholland-tcompcor-6b4fcf74-36b7-4911-89c2-4e00d09ca668.pklz
Working Directory: /scratch/wf/fmriprep_wf/single_subject_01_wf/func_preproc_task_binocularrivalry_run_01_wf/discover_wf/tcompcor
components_file: tcompcor.tsv
compress_report: auto
generate_report: True
high_pass_cutoff: 128.0
ignore_exception: False
mask_files: [’/scratch/wf/fmriprep_wf/single_subject_01_wf/func_preproc_task_binocularrivalry_run_01_wf/discover_wf/CSF_roi/erodd_mask.nii.gz’]
num_components: 6
out_report: report.html
percentile_threshold: 0.05
pre_filter: cosine
realigned_file: /scratch/wf/fmriprep_wf/single_subject_01_wf/func_preproc_task_binocularrivalry_run_01_wf/epi_reg_wf/merge/vol0000_trans_merged.nii.gz
regress_poly_degree: 1
repetition_time: 0.972075
save_pre_filter: True
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py”, line 52, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 372, in run
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 482, in _run_interface
self._result = self._run_command(execute)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 613, in _run_command
result = self._interface.run()
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py”, line 1083, in run
runtime = self._run_wrapper(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py”, line 1031, in _run_wrapper
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/common/report.py”, line 53, in _run_interface
ReportCapableInterface, self)._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/algorithms/confounds.py”, line 420, in _run_interface
mask_images = self._process_masks(mask_images, imgseries.get_data())
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/algorithms/confounds.py”, line 549, in _process_masks
(1. - self.inputs.percentile_threshold)).astype(int))
File “/usr/local/miniconda/lib/python3.6/site-packages/numpy/lib/function_base.py”, line 4116, in percentile
File “/usr/local/miniconda/lib/python3.6/site-packages/numpy/lib/function_base.py”, line 3858, in _ureduce
r = func(a, **kwargs)
File “/usr/local/miniconda/lib/python3.6/site-packages/numpy/lib/function_base.py”, line 4233, in _percentile
x1 = take(ap, indices_below, axis=axis) * weights_below
File “/usr/local/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py”, line 134, in take
return _wrapfunc(a, ‘take’, indices, axis=axis, out=out, mode=mode)
File “/usr/local/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py”, line 57, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
IndexError: cannot do a non-empty take from an empty axes.
Interface TCompCorRPT failed to run.

These are the only errors I get.

Does anyone have a clue what is going on here? It seems to not find any voxels that cross the percentile threshold or something…

And is there a way to still get a confounds matrix, without the tcompcorr components?


This crash could be unrelated to tCompCor. Could you share the HTML report for this participant? It should be in the output directory.


Even though the BOLD-T1w coregistration seems ok the overlaid aCompCor masks seem off (they should outline the ventricles and white matter). I think something went wrong when the transformation was applied. Could you share data of one example participant so we could fix this?

Yeah, it looks like tCompCor isn’t finding any components, which the interface doesn’t handle gracefully. A test file would be very useful in figuring out how best to handle that case.

I also agree that the aCompCor masks are too small. To resolve this, in addition to a BOLD file, we would also need the fmriprep/sub-03/anat/*_probtissue.nii.gz files.

Thanks for helping out. I sent one subject to Chris by email.

1 Like

AFAIK this should be solved in the latest release. Could you try it out?

I don’t get the empty array-error anymore, but now the workflow crashes on a MemoryError, even when using only 4 cpus on a 64GB Node.

The --low-mem flag of this version solves that problem, but is not yet in 1.0.rc2

@Gilles_de_Hollander I’ve updated the --low-mem branch to include all of the updates in -rc2, so I’d encourage you to re-download https://github.com/effigies/fmriprep/archive/enh/unzip_option.tar.gz and use that until the next release candidate.

1 Like