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!

I’m having the same error unfortunately. Did you ever resolve this Millielow?
Here’s my error log

Node: fmriprep_22_1_wf.single_subject_S1033OC1490_wf.fmap_preproc_wf.fmap_reports_wf_phase-dif-estimation.fmap_rpt
Working directory: /dartfs-hpc/scratch/f0042vm/fmriprep/fmriprep_22_1_wf/single_subject_S1033OC1490_wf/fmap_preproc_wf/fmap_reports_wf_phase-dif-estimation/fmap_rpt

Node inputs:

apply_mask = False
fieldmap = <undefined>
mask = <undefined>
max_alpha = 0.7
moving = <undefined>
moving_label = Fieldmap (Hz)
out_report = report.svg
reference = <undefined>
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 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/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 fmap_rpt.

Traceback:
	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:>

For comparison, here’s my json file for my phase 1 data,

{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.223,
    "Manufacturer": "Siemens",
    "ManufacturersModelName": "TrioTim",
    "InstitutionName": "Intermountain Neuroimaging Consortium",
    "InstitutionalDepartmentName": "Department",
    "InstitutionAddress": "Exposition Drive 1777,Boulder- 6392da-,Denver,US,80301",
    "DeviceSerialNumber": "35451",
    "StationName": "MRC35451",
    "PatientPosition": "HFS",
    "ProcedureStepDescription": "TWAGER^BMRK5_200052",
    "SoftwareVersions": "syngo MR B17",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "gre_field_mapping",
    "ProtocolName": "gre_field_mapping",
    "ScanningSequence": "GR",
    "SequenceVariant": "SP",
    "SequenceName": "*fm2d2r",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "ND"
    ],
    "SeriesNumber": 4,
    "AcquisitionTime": "13:36:58.610000",
    "AcquisitionNumber": 1,
    "SliceThickness": 3,
    "SpacingBetweenSlices": 3.75,
    "SAR": 0.228873,
    "EchoNumber": 1,
    "EchoTime": 0.00492,
    "RepetitionTime": 0.4,
    "FlipAngle": 60,
    "PartialFourier": 1,
    "BaseResolution": 64,
    "ShimSetting": [
        6843,
        12694,
        -6732,
        440,
        442,
        4,
        -84,
        65
    ],
    "TxRefAmp": 336.382,
    "PhaseResolution": 1,
    "ReceiveCoilName": "32Ch_Head",
    "CoilString": "C:HEA;HEP",
    "PulseSequenceDetails": "%SiemensSeq%\\gre_field_mapping",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "PhaseEncodingSteps": 64,
    "AcquisitionMatrixPE": 64,
    "ReconMatrixPE": 64,
    "PixelBandwidth": 260,
    "DwellTime": 3e-05,
    "PhaseEncodingDirection": "i",
    "SliceTiming": [
        0.20312,
        0,
        0.21875,
        0.01562,
        0.21875,
        0.03125,
        0.23438,
        0.03125,
        0.25,
        0.04688,
        0.26562,
        0.0625,
        0.26562,
        0.0625,
        0.28125,
        0.07812,
        0.29688,
        0.09375,
        0.29688,
        0.09375,
        0.3125,
        0.10938,
        0.32812,
        0.125,
        0.34375,
        0.14062,
        0.34375,
        0.14062,
        0.35938,
        0.15625,
        0.375,
        0.17188,
        0.375,
        0.1875,
        0.39062,
        0.1875
    ],
    "ImageOrientationPatientDICOM": [
        1,
        -1.95611e-10,
        6.16758e-11,
        2.05103e-10,
        0.953717,
        -0.300706
    ],
    "InPlanePhaseEncodingDirectionDICOM": "ROW",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20210317",
    "B0FieldIdentifier": "phase-dif-estimation",
    "IntendedFor": [
        "func/sub-S1033OC1490_task-movies_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-norm_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-std_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-nback_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-nback_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-3_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-4_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-3_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-4_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-norm_run-1_sbref.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-std_run-1_sbref.nii.gz",
        "func/sub-S1033OC1490_task-stress_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-stress_acq-std_rec-std_run-1_bold.nii.gz"
    ]
}

And my phase2 data,

{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.223,
    "Manufacturer": "Siemens",
    "ManufacturersModelName": "TrioTim",
    "InstitutionName": "Intermountain Neuroimaging Consortium",
    "InstitutionalDepartmentName": "Department",
    "InstitutionAddress": "Exposition Drive 1777,Boulder- 6392da-,Denver,US,80301",
    "DeviceSerialNumber": "35451",
    "StationName": "MRC35451",
    "PatientPosition": "HFS",
    "ProcedureStepDescription": "TWAGER^BMRK5_200052",
    "SoftwareVersions": "syngo MR B17",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "gre_field_mapping",
    "ProtocolName": "gre_field_mapping",
    "ScanningSequence": "GR",
    "SequenceVariant": "SP",
    "SequenceName": "*fm2d2r",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "ND"
    ],
    "SeriesNumber": 4,
    "AcquisitionTime": "13:36:59.012500",
    "AcquisitionNumber": 1,
    "SliceThickness": 3,
    "SpacingBetweenSlices": 3.75,
    "SAR": 0.228873,
    "EchoNumber": 2,
    "EchoTime": 0.00738,
    "RepetitionTime": 0.4,
    "FlipAngle": 60,
    "PartialFourier": 1,
    "BaseResolution": 64,
    "ShimSetting": [
        6843,
        12694,
        -6732,
        440,
        442,
        4,
        -84,
        65
    ],
    "TxRefAmp": 336.382,
    "PhaseResolution": 1,
    "ReceiveCoilName": "32Ch_Head",
    "CoilString": "C:HEA;HEP",
    "PulseSequenceDetails": "%SiemensSeq%\\gre_field_mapping",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "PhaseEncodingSteps": 64,
    "AcquisitionMatrixPE": 64,
    "ReconMatrixPE": 64,
    "PixelBandwidth": 260,
    "DwellTime": 3e-05,
    "PhaseEncodingDirection": "i",
    "SliceTiming": [
        0.20312,
        0,
        0.21875,
        0.01562,
        0.21875,
        0.01562,
        0.23438,
        0.03125,
        0.25,
        0.04688,
        0.25,
        0.0625,
        0.26562,
        0.0625,
        0.28125,
        0.07812,
        0.29688,
        0.09375,
        0.29688,
        0.09375,
        0.3125,
        0.10938,
        0.32812,
        0.125,
        0.32812,
        0.125,
        0.34375,
        0.14062,
        0.35938,
        0.15625,
        0.375,
        0.17188,
        0.375,
        0.17188,
        0.39062,
        0.1875
    ],
    "ImageOrientationPatientDICOM": [
        1,
        -1.95611e-10,
        6.16758e-11,
        2.05103e-10,
        0.953717,
        -0.300706
    ],
    "InPlanePhaseEncodingDirectionDICOM": "ROW",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20210317",
    "B0FieldIdentifier": "phase-dif-estimation",
    "IntendedFor": [
        "func/sub-S1033OC1490_task-movies_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-norm_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-movies_acq-std_rec-std_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-nback_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-nback_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-3_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-norm_run-4_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-2_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-3_bold.nii.gz",
        "func/sub-S1033OC1490_task-painsound_acq-std_rec-std_run-4_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-norm_run-1_sbref.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-std_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-rest_acq-mb8_rec-std_run-1_sbref.nii.gz",
        "func/sub-S1033OC1490_task-stress_acq-std_rec-norm_run-1_bold.nii.gz",
        "func/sub-S1033OC1490_task-stress_acq-std_rec-std_run-1_bold.nii.gz"
    ]

Hi @Bogdan_Petre and welcome to neurostars!

Please open your issue as a new thread under the Software Support category, making sure to fill in the information in the pre-populated template.

Best,
Steven