XCP-D occasionally not running for multiple fMRI sessions

Hi there,

I’m using XCP-D on a large fMRI dataset that’s been preprocessed using fmriprep. For some subjects I have multiple timepoints.

The issue is that for some subjects I’ll only get the XCP-D output for one scan, either for the baseline or follow up scan.

Here is the command I used:

source_data=/data/project/PSYSCAN_analysis/preprocessed_datasets/fMRI/fmriprep/sub-PSYF02014
output_data=/data/project/PSYSCAN_analysis/preprocessed_datasets/fMRI/xcp_d
work=/data/project/PSYSCAN_analysis/wd/sub-PSYF02014

singularity run --cleanenv /data/project/PSYSCAN_analysis/software/xcp_d/xcp_d-0.7.5.simg \
${source_data} \
${output_data} \
participant \
--participant-label PSYF02014 \
--work-dir ${work} \
--nprocs 2 \
--omp-nthreads 2 \
--despike \
--nuisance-regressors "36P" \
--smoothing 6 \
--random-seed 1 \
--fs-license-file /data/project/PSYSCAN_analysis/software/freesurfer/license.txt

And I do get the following error:

** AFNI converts NIFTI_datatype=64 (FLOAT64) in file /data/project/PSYSCAN_analysis/wd/sub-PSYF02014/xcp_d_0_7_wf/sub_PSYF02014_wf/nifti_postprocess_0_wf/reho_nifti_wf/reho_3d/inset.nii.gz to FLOAT32
     Warnings of this type will be muted for this session.
     Set AFNI_NIFTI_TYPE_WARN to YES to see them all, NO to see none.
++ Final vox neighbood: ellipsoid with Nneigh=27 and radii (1.900,1.900,1.900).
++ ReHo (Kendall's W) calculated.
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.10/site-packages/bids/layout/index.py", line 303, in load_json
    return json.load(handle)
  File "/usr/local/miniconda/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/miniconda/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/miniconda/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/miniconda/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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

Traceback (most recent call last):
  File "/usr/local/miniconda/bin/xcp_d", line 8, in <module>
    sys.exit(main())
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/cli/run.py", line 174, in main
    failed_reports = generate_reports(
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/reports/core.py", line 163, in generate_reports
    exsumm = ExecutiveSummary(
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/interfaces/execsummary.py", line 47, in __init__
    self.layout = BIDSLayout(xcpd_path, config="figures", validate=False)
  File "/usr/local/miniconda/lib/python3.10/site-packages/bids/layout/layout.py", line 177, in __init__
    _indexer(self)
  File "/usr/local/miniconda/lib/python3.10/site-packages/bids/layout/index.py", line 154, in __call__
    self._index_metadata()
  File "/usr/local/miniconda/lib/python3.10/site-packages/bids/layout/index.py", line 415, in _index_metadata
    file_md.update(pl())
  File "/usr/local/miniconda/lib/python3.10/site-packages/bids/layout/index.py", line 305, in load_json
    raise OSError(
OSError: Error occurred while trying to decode JSON from file /data/project/PSYSCAN_analysis/preprocessed_datasets/fMRI/xcp_d/sub-PSYC18019/ses-baseline/func/sub-PSYC18019_ses-baseline_task-rest_space-MNI152NLin2009cAsym_seg-Tian_stat-pearsoncorrelation_relmat.json

Any advice would be much appreciated!

BW,
George

Do you get the error for all of the scans that don’t produce outputs?

I haven’t seen that error before, but I expect that most of the scans that don’t produce outputs don’t have enough low-motion data. That is controlled with the --min-time parameter, which has a default value of 240 seconds.

I’ve had a look at some of the scans that’ve been missed out and the average FD is over the threshold so this would make a lot of sense.

Thanks for your reply! I think that’s the issue solved.

1 Like

If you continue to see the JSON decoding error we can dig into that, but I might need access to consistently failing data. If that error was just a one-off random kind of thing, then I think everything will be fine. Best of luck!