Xcp_d: UnboundLocalError: local variable 'ds_report_about' referenced before assignment

Hi guys,

I am trying to run my fmriprep output through the xcp_d postprocessing pipeline and and I have been getting the above error.

Below is my code:

disk="/home/jiayi/Desktop"
project_dir=$disk/“Control_EXCI_MRI”
data_dir=$project_dir/“data_fmriprep/test”
output_dir=$project_dir/“data_fsl/data_ICA_resting”
scratch=$output_dir/“scratch”

docker run -it
-v /$data_dir:/data:ro
-v /$output_dir/:/out
-v /$scratch:/scratch
pennlinc/xcp_d:latest
/data /out participant -w /scratch -t rest --smoothing 6
–cifti
–despike
–head_radius 50 --input fmriprep
–nuissance-regressors acompcor
–lower-bpf 0.01 --upper-bpf 0.08
–dummytime 6
–omp-nthreads 2
–mem_gb 20
–verbose
–resource-monitor\

I can’t even pass the bids validator step, and I think this error has something to do with the nipreps bids workflow. I understand that fmriprep output files might not be bids compliant, and from my reading, I only included the $sub-id/$ses-id/[modality] outputs from fmriprep, along with the dataset_description.json and .bidsignore generated by fmriprep.

I tried both with and without .bidsignore, it didn’t help with the error.

Below is the full terminal output:
220823-12:40:20,14 nipype.workflow IMPORTANT:

Running xcp_d version 0.1.3+0.g9fec4d8.dirty:
  * fMRI directory path: /data.
  * Participant list: ['EXCI0100', 'EXCI0101'].
  * Run identifier: 20220823-124016_33ef2951-90e3-420f-bdad-2cccb5f4fa15.

Process Process-2:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.8/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/usr/local/miniconda/lib/python3.8/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/cli/run.py”, line 617, in build_workflow
retval[‘workflow’] = init_xcpd_wf(
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/workflow/base.py”, line 148, in init_xcpd_wf
single_subj_wf = init_subject_wf(
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/workflow/base.py”, line 433, in init_subject_wf
(about, ds_report_about, [(‘out_report’, ‘in_file’)])])
UnboundLocalError: local variable ‘ds_report_about’ referenced before assignment

Thank you for your time and help!
Vae

Hi Vae,

What version of fmriprep did you preprocess data with?

Are the HTML files also included? Can you try running XCPD on the fmriprep output directory before you do any manipulation to it?

Best,
Steven

Hi Steven,

Thanks for the quick reply!

I used the ouputs from fmriprep:22.0.0.

Nope i did not include the html files, and i tried with the html file added to the above folder configuration, and got the same error.

Previously I had tried on the fMRIprep outpuyt directory straight and i got this error:

Process Process-2:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.8/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/usr/local/miniconda/lib/python3.8/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/cli/run.py”, line 535, in build_workflow
layout = BIDSLayout(str(fmri_dir), validate=False, derivatives=True)
File “/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/layout.py”, line 145, in init
indexer(self)
File “/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/index.py”, line 111, in call
self._index_metadata()
File “/usr/local/miniconda/lib/python3.8/site-packages/bids/layout/index.py”, line 375, in _index_metadata
file_md.update(pl())
ValueError: dictionary update sequence element #0 has length 4; 2 is required

Also below is my fmriprep code if its relevant : nipreps/fmriprep:22.0.0
/data /fMRI participant
–work-dir /scratch
–error-on-aroma-warnings --use-aroma
–output-spaces MNI152NLin6Asym:res-2 MNI152NLin6Asym:res-1 MNI152NLin2009cAsym:res-2 MNI152NLin2009cAsym:res-1
–fd-spike-threshold 0.5
–dvars-spike-threshold 20
–use-plugin /plugin.yml
–dummy-scans 4
–write-graph
–n_cpus ‘4’
–omp-nthreads 4
–mem 20GB
–verbose
–resource-monitor\

Thanks again for all the help!!

I’m wondering if it is confused that there are two versions of MNI152NLin6Asym…

Also, you put --cifti in the XCP command, but I do not see cifti outputs in your fmriprep command.

1 Like

wow thank you so much! I removed the --cifti and the process started running!!! I will update again if it mange to finish the whole process. Thank you so much!!!

1 Like

Everything ran smoothly, it was indeed the --cifti flag.