QSIprep TOPUP Failure for Some

Hi,

I wanted to ask it here before posting it as an issue on QSIprep github. I’m running QSIprep 0.22 on GPU on a cluster (singularity --nv) for 64 subjects, and it is failing only for three subjects with an error that I cannot debug myself.

The crash report is:

Node: qsiprep_0_22_wf.sub_33_wf.dwi_preproc_ses_001_acq_dmri_dir_AP_wf.hmc_sdc_wf.gather_inputs
Working directory: /path/to/work/qsiprep_0_22_wf/sub_33_wf/dwi_preproc_ses_001_acq_dmri_dir_AP_wf/hmc_sdc_wf/gather_inputs

Node inputs:

b0_threshold = 100
bval_file = <undefined>
bvec_file = <undefined>
dwi_file = <undefined>
eddy_config = /output/code/eddy_params.json
epi_fmaps = ['/input/sub-33/ses-001/fmap/sub-33_ses-001_acq-dmri_dir-AP_epi.nii.gz', '/input/sub-33/ses-001/fmap/sub-33_ses-001_acq-dmri_dir-PA_epi.nii.gz']
json_file = <undefined>
original_files = <undefined>
raw_image_sdc = False
topup_max_b0s_per_spec = 1
topup_requested = True

Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/qsiprep/lib/python3.10/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 gather_inputs.

Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/eddy.py", line 92, in _run_interface
	    get_best_b0_topup_inputs_from(
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/epi_fmap.py", line 252, in get_best_b0_topup_inputs_from
	    raise Exception(
	Exception: Unable to run TOPUP: not enough distortion groups. Check "IntendedFor" fields or consider using --ignore fieldmaps.

I have two b0s (sub-##_ses-001_acq-dmri_dir-[AP/PA]_epi.nii.gz), and their accompanying JSON file has an IntendedFor field with “ses-001/dwi/sub-##_ses-001_acq-dmri_dir-AP_dwi.nii.gz”. All the b0s/main dMRI sequences exist and can be visualized without an error.

As I said, it is running perfectly fine for all other subjects. Looking forward to your suggestions.

Best,
Amir

Hi @AmirHussein,

Please return the BIDS validation report for his dataset.

Best,
Steven

Hi Steven,

Thanks for the reply. Here you can see the output based on the online BIDS validator: Cloud Storage

The only error was the mismatch between the subject IDs (I had included fewer subjects in the participants.tsv).

Best,
Amir

Sorry I am not sure how to parse that JSON, do you not have the command line tool or the one output by qsiprep itself?

Hi Amir,
It’s likely that you don’t have any fieldmaps with a different phase encoding direction from your dwi file. If this is the case then topup won’t work and you’ll see this error

@Steven here you can see the summary output with --ignore-warnings. The subject IDs are in the format of Sub-## rather than sub-##. I used --skip-bids-validation for QSIprep run, but the problem exists for three subjects with their fmap data and IntendedFor files correctly set:

1: [ERR] Participant_id column labels must consist of the pattern "sub-<subject_id>". (code: 212 - PARTICIPANT_ID_PATTERN)
		./participants.tsv
			@ line: 1
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 2
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 3
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 4
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 5
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 6
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 7
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 8
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 9
			Evidence: Column headers: participant_id, sex
		./participants.tsv
			@ line: 10
			Evidence: Column headers: participant_id, sex
		... and 54 more files having this issue (Use --verbose to see them all).

	Please visit https://neurostars.org/search?q=PARTICIPANT_ID_PATTERN for existing conversations about this issue.

        Summary:                   Available Tasks:                       Available Modalities: 
        2216 Files, 63.53GB        gonogo                                 MRI                   
        64 - Subjects              train                                                        
        1 - Session                rest                                                         
                                   TODO: full task name for gonogo                              
                                   TODO: full task name for rest                                
                                   TODO: full task name for train                               


	If you have any questions, please post on https://neurostars.org/tags/bids.

@mattcieslak Hi Matt, thanks for the comment. I have the fmap data with reverse and the same PE dir as the main diffusion sequence. The thing is that it works for all the subjects except 3 subjects, with the correct IntendedFor and presence of the files.

Hi @AmirHussein,

Any chance you can share one of the subject folders (at lease the anat dwi and fmap) zipped with us (Steven.Meisler@pennmedicine.upenn.edu)?

Best,
Steven

Sure. I sent it to you via email.

Amir

Hi @AmirHussein,

The error is because both of your fmaps have the same PhaseEncodingDirection of j-, which are the same direction as your DWI.

Best,
Steven

Thank you very much @Steven. I didn’t notice it earlier since we didn’t have this issue for all other subjects that have been acquired using the same protocol on the same scanner. Probably, there have been some tiny changes to the protocol at some point. Anyway, thanks for the time.

Best,
Amir