I am interested in testing XCP_D on our data but I am stuck right at the beginning with this error which I believe is linked to the fact that the singularity container does not have access to the internet on the HPC I am using it:
Downloading https://templateflow.s3.amazonaws.com/tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_desc-brain_mask.nii.gz
0%| | 0.00/28.0 [00:00<?, ?B/s]
29.0B [00:00, 324B/s]
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 395, in init_subject_wf
bold_postproc_wf = init_boldpostprocess_wf(
File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/workflow/bold.py", line 341, in init_boldpostprocess_wf
bold2MNI_trans, bold2T1w_trans = get_transformfilex(
File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/utils/utils.py", line 87, in get_transformfilex
t1w_to_mni = glob.glob(mnisf + 'from-T1w_to-' + template +
UnboundLocalError: local variable 'template' referenced before assignment
I do not think this issue is related to templateflow, but rather to the naming convention of the .h5 transformation files. That is, looking at the code here (xcp_d/utils.py at 8aa79b9ba4612fbf38231886ee9ac71215ec88e3 Β· PennLINC/xcp_d Β· GitHub), there are different conditions that they use to try to figure out what template is being used based on the transformation name, but somehow, it is not satisfying any of them, leading to the undefined variable error.
Hmm, the h5 files look fine, I guess it would help to know what h5 file is being checked, which would mean introducing print statements in the utils command linked above. You could try building the singularity container as a sandbox and making the changes yourself, but I wish the error would be more obvious
I had an issue for another study where only MNI152NLin2009cAsym was asked as an output for fmriprep so I tried for another when where the MNI152NLin2009cAsym MNI152NLin6Asym T1w were called for the output.
I am puzzled still by this output in the error log:
I think this case warrants a github issues post, as it is may be due to the code not filtering the transform files properly as opposed to any user error. Hope you can get to the bottom of this!
Thank you again!
ok I will dig deeper into this, I will let you know in this thread if I find a solution.
I agree, I will post an issue on GitHub. As it was my first trial with the XCP_D toolbox for which I read good recommendations, I was wondering if I was missing something obvious in my command line.
For information, here is the output for a subject for which only MNI152NLin2009cAsym was asked for as output-spaces in fmriprep (v21.0.2):
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 329, in init_subject_wf
anatomical_wf = init_anatomical_wf(
File "/usr/local/miniconda/lib/python3.8/site-packages/xcp_d/workflow/anatomical.py", line 364, in init_anatomical_wf
h5_file = fnmatch.filter(
IndexError: list index out of range