Preprocessing failing to finish with 22.0.0

Hello,

I’ve been testing out running preprocessing in fMRIPrep 20.2.5 with a subset of my dataset, and was ready to run on the whole dataset so thought I’d upgrade to 22.0.0 so that I’m using the latest version (I’ll reprocess the ones I’d been testing on). I understand that to do SDC the json file needs to contain TotalReadoutTime rather than EffectiveEchoSpacing so I’ve added that, but when I run fMRIPrep it fails- the html report contains no images and no images seem to have been stored, and I get an error saying preprocessing did not finish successfully. The crash report is as follows:

> Node: fmriprep_22_0_wf.single_subject_155_wf.fmap_preproc_wf.fmap_reports_wf_auto_00000.fmap_rpt
> Working directory: /scratch/fmriprep_22_0_wf/single_subject_155_wf/fmap_preproc_wf/fmap_reports_wf_auto_00000/fmap_rpt
> 
> Node inputs:
> 
> apply_mask = False
> fieldmap = /scratch/fmriprep_22_0_wf/single_subject_155_wf/fmap_preproc_wf/wf_auto_00000/bs_filter/sub-155_phasediff_rads_unwrapped_fmap_extra.nii.gz
> mask = /scratch/fmriprep_22_0_wf/single_subject_155_wf/fmap_preproc_wf/wf_auto_00000/magnitude_wf/brainextraction_wf/masker/clipped_mask.nii.gz
> max_alpha = 0.7
> moving = <undefined>
> moving_label = Fieldmap (Hz)
> out_report = report.svg
> reference = /scratch/fmriprep_22_0_wf/single_subject_155_wf/fmap_preproc_wf/wf_auto_00000/magnitude_wf/brainextraction_wf/clipper_post/clipped.nii.gz
> reference_label = Reference
> show = 1
> 
> Traceback (most recent call last):
>   File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
>     result["result"] = node.run(updatehash=updatehash)
>   File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 524, in run
>     result = self._run_interface(execute=True)
>   File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 642, in _run_interface
>     return self._run_command(execute)
>   File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 750, in _run_command
>     raise NodeExecutionError(
> nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node fmap_rpt.
> 
> Traceback (most recent call last):
>   File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 399, in run
>     runtime = self._post_run_hook(runtime)
>   File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook
>     self._generate_report()
>   File "/opt/conda/lib/python3.9/site-packages/sdcflows/interfaces/reportlets.py", line 126, in _generate_report
>     plot_registration(
>   File "/opt/conda/lib/python3.9/site-packages/sdcflows/viz/utils.py", line 87, in plot_registration
>     svg = extract_svg(display, compress=compress)
>   File "/opt/conda/lib/python3.9/site-packages/niworkflows/viz/utils.py", line 140, in extract_svg
>     image_svg = svg2str(display_object, dpi)
>   File "/opt/conda/lib/python3.9/site-packages/niworkflows/viz/utils.py", line 132, in svg2str
>     display_object.frame_axes.figure.savefig(
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/figure.py", line 3046, in savefig
>     self.canvas.print_figure(fname, **kwargs)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2319, in print_figure
>     result = print_method(
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 1648, in wrapper
>     return func(*args, **kwargs)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 389, in wrapper
>     return func(*inner_args, **inner_kwargs)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 415, in wrapper
>     return func(*inner_args, **inner_kwargs)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/backends/backend_svg.py", line 1333, in print_svg
>     self.figure.draw(renderer)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/artist.py", line 73, in draw_wrapper
>     result = draw(artist, renderer, *args, **kwargs)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
>     return draw(artist, renderer)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/figure.py", line 2823, in draw
>     artists = self._get_draw_artists(renderer)
>   File "/opt/conda/lib/python3.9/site-packages/matplotlib/figure.py", line 235, in _get_draw_artists
>     pos = locator(ax, renderer)
>   File "/opt/conda/lib/python3.9/site-packages/nilearn/plotting/displays/_slicers.py", line 1386, in _locator
>     return Bbox([[left_dict[axes], y0],
> KeyError: <Axes:>

I’ve tried creating a new working folder, uninstalling and reinstalling, and tried redoing freesurfer (I thought maybe somehow the output from the old version would be causing the problem) but it’s not resolved it. Is there something obvious I’m missing that’s different between 20.2.5 and 22.0.0?

My fmap json is:

{"EchoTime1": 0.01, "EchoTime2": 0.01476, "PhaseEncodingDirection": "i", "IntendedFor": ["func/sub-160_task-affvis_bold.nii"]}

And the task one:

{
	"SliceThickness": 2,
	"SpacingBetweenSlices": 3,
	"SAR": 0.019142,
	"EchoTime": 0.05,
	"RepetitionTime": 3.5,
	"FlipAngle": 90,
	"EffectiveEchoSpacing": 0.0005,
	"TotalReadoutTime": 0.0032,
	"PhaseEncodingDirection": "j-",
	"SliceTiming":[0,
		0.0875,
		0.1750,
		0.2625,
		0.3500,
		0.4375,
		0.5250,
		0.6125,
		0.7000,
		0.7875,
		0.8750,
		0.9625,
		1.0500,
		1.1375,
		1.2250,
		1.3125,
		1.4000,
		1.4875,
		1.5750,
		1.6625,
		1.7500,
		1.8375,
		1.9250,
		2.0125,
		2.1000,
		2.1875,
		2.2750,
		2.3625,
		2.4500,
		2.5375,
		2.6250,
		2.7125,
		2.8000,
		2.8875,
		2.9750,
		3.0625,
		3.1500,
		3.2375,
		3.3250,
		3.4125],
		"trial_type":{
		"LongName": "Type of trial presented",
		"Description": "Circle size, and classification status for medium circles",
		"Levels": {
			"low": "low reward circle presented",
			"high": "high reward circle presented",
			"ambig_low": "ambiguous circle presented, categorised as low reward circle",
			"ambig_high": "ambiguous circle presented, categorised as high reward circle",
			"ambig_missed": "ambiguous circle presented, no response from participant"
			}
		}
}

Any help would be very appreciated!

Hi,

It would help if you could answer the following questions:

  1. Are your data BIDS valid?

I thought the file extensions has to be .nii.gz. Have you tried with the compressed files?

  1. Is this error subject specific or does it happen with everyone?
  2. What is your fmriprep command?

Best,
Steven

Thanks for your fast response Steven!

  1. When I run the BIDS validator there aren’t any issues with the data
  2. I’ve not tried with the compressed files, I’ll try that now and report back!
  3. It’s happening with everyone
  4. My fmriprep command is:
fmriprep-docker $bids_root_dir $save_dir \
	participant \
	--participant-label $subj \
    --md-only-boilerplate \
    --output-spaces MNI152NLin2009cAsym:res-2 \
    --fs-license-file $HOME/freesurfer/license.txt \
	--n_cpus $n_cpus \
    --stop-on-first-crash \
    --mem_mb $mem_mb \
    --dummy-scans 4 \
    --work-dir $save_dir/fmriprep_wd

@Steven the error is the same when using the compressed files unfortunately!