“Could not find missing matrix” error in XCP_D

Summary of what happened:

Hi everyone
I encountered an issue while using xcp_d, and the error message is printed in the terminal window:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/cli/run.py", line 578, in main
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/base.py", line 224, in run
    raise error from cause
RuntimeError: 44 raised. Re-raising first.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda/bin/xcp_d", line 8, in <module>
  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/cli/run.py", line 664, in main
    failed_reports = generate_reports(
  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/interfaces/report_core.py", line 157, in generate_reports
  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/interfaces/execsummary.py", line 195, in collect_inputs
    task_entity_sets = task_entity_sets.sort_values(by=task_entity_sets.columns.tolist())
  File "/usr/local/miniconda/lib/python3.8/site-packages/pandas/core/frame.py", line 5454, in sort_values
    by = by[0]
IndexError: list index out of range
Sentry is attempting to send 50 pending error messages

Command used (and if a helper script was used, a link to the helper script or the command generated):

docker run --rm -v E:/GL/temp:/wd -v E:/GL/data135_out_fmriprep:/data -v E:/GL/xcpd_out_globalsignal_data135:/out -v D:/fantest/:/freesurfer_license pennlinc/xcp_d:0.6.0 /data /out participant -w /wd  -p aroma --fd-thresh 0
 --despike --lower-bpf 0.01 --upper-bpf 0.1 --smoothing 6 --cifti



Environment (Docker, Singularity / Apptainer, custom installation):


Data formatted according to a validatable standard? Please provide the output of the validator:


Relevant log outputs (up to 20 lines):

The output log for an individual participant:
Node: xcpd_wf.single_subject_MDD119_wf.cifti_postprocess_1_wf.prepare_confounds_wf.generate_confounds
Working directory: /wd/xcpd_wf/single_subject_MDD119_wf/cifti_postprocess_1_wf/prepare_confounds_wf/generate_confounds

Node inputs:

TR = 2.0
band_stop_max = None
band_stop_min = None
custom_confounds_file = None
fd_thresh = 0.0
fmriprep_confounds_file = /data/sub-MDD119/func/sub-MDD119_task-rest_acq-pa_run-1_desc-confounds_timeseries.tsv
fmriprep_confounds_json = /data/sub-MDD119/func/sub-MDD119_task-rest_acq-pa_run-1_desc-confounds_timeseries.json
head_radius = 50.0
in_file = /data/sub-MDD119/func/sub-MDD119_task-rest_acq-pa_run-1_space-fsLR_den-91k_bold.dtseries.nii
motion_filter_order = 4
motion_filter_type = None
params = aroma

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node generate_confounds.

	Traceback (most recent call last):
	  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/interfaces/censoring.py", line 501, in _run_interface
	    confounds_df, confounds_metadata = load_confound_matrix(
	  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/utils/confounds.py", line 458, in load_confound_matrix
	    ica_mixing_matrix = _get_mixing_matrix(img_file)
	  File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/utils/confounds.py", line 499, in _get_mixing_matrix
	    raise FileNotFoundError(f"Could not find mixing matrix for {img_file}")
	FileNotFoundError: Could not find mixing matrix for /data/sub-MDD119/func/sub-MDD119_task-rest_acq-pa_run-1_space-fsLR_den-91k_bold.dtseries.nii

Screenshots / relevant information:

As shown in the figure, the fmriprep output results file for one of the participants.

Hi @Donggua,

Sounds like you did not run fmriprep with aroma outputs, so xcp_d cannot find the aroma components. Note that aroma was removed from recent versions of fmriprep so you’d have to rollback versions to use it, or choose a different denoising scheme in xcp_d.

Additionally, instead of those screen shots, it is easier for us to read the results of tree run on the fmriprep directory, which returns the file structure as text (which you would format as code like you did the command for xco_d).


Hi @Steven ,
Thanks so much for responding to my question!
So does that mean I have to rerun fmriprep (with aroma option : --use-aroma), or could you provide a solution? Specifically, using xcpd (0.6.0) for post-processing the output data already processed with fmriprep, where the step of regressing out noise can remove motion noise, white matter noise, and
CSF noise, while preserving the global signal .

Hi @Donggua,

If you want to use AROMA, then that is one option (again, keep in mind that you may have to go to a previous version to this). You can also run AROMA outside of fMRIPrep, but the outputs will have to be organized in the way that XCP_D expects (e.g., as fMRIPrep outputs them). I don’t know precisely how to do that right off the bat (I think an app is being developed for it, but no timeline on release), but I know at the very least you will need MNI152NLin6Asym-space outputs, which you do not have at the moment, so you may need another fMRIPrep call to get those. But you can use other non-AROMA XCP_D denoising pipelines.

You can see the denoising options here Processing Pipeline Details — xcp_d 0.6.1rc2.dev4+g673efa3 documentation


Hi @Steven
I’m new to both neuroimaging and this site.I have a question after reviewing the link you provided(Processing Pipeline Details — xcp_d 0.6.1rc2.dev4+g673efa3 documentation). Why isn’t there an option(-p 24P \27P\36P…It appears that only AROMA meets that requirement, but it needs to be compatible with the preprocessing performed by fMRIPrep in order to work properly.)to remove head motion noise, white matter noise, CSF noise, but retain the global brain signal? Coincidentally, my requirement is to preserve the global brain signal while removing other noise sources.

Hi @Donggua

Looks like the acompcor option will achieve what you want.