Fmriprep slice timing issue

Dear experts,

I’m running into a slice timing issue when using the singularity version of fmriprep version 21.0.2.
We’re using a multiband sequence with a multiband acceleration factor of 6 and 60 slices without online motion correction on a Siemens Prisma fit.
I get an error stating that saying “slice_timing.1D has 60 values but have 61 slices” (see error text of th html report below). I therefore checked the slice timing command, which I believe recognized the sequence as a multiband sequence (I’m no expert here though, so please see the content of the command.txt file below).
Further, I checked the respective nifti file and the dim3 output of the fslinfo command indicates 60 slices. I also checked the json file which seems to have 60 slice timings (see below).
I’m grateful for any input on this issue!

Best,
Martin

HTML report:

File: /home/PerPain/AVC/BIDS/derivatives/sub-017/log/20220823-105700_2e6ecbd5-0832-4c2c-8a3c-9e5b4a9754aa/crash-20220823-105955-martin.loeffler-slice_timing_correction-b1ee02c9-128e-4fdf-aaa7-87df886c411b.txt
Working Directory: /home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction
Inputs:

    args:
    environ: {}
    ignore:
    in_file:
    interp:
    num_threads: 1
    out_file:
    outputtype: NIFTI_GZ
    rlt:
    rltplus:
    slice_encoding_direction: k
    slice_timing: [0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525, 0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525, 0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525, 0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525, 0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525, 0.0, 0.825, 0.47, 0.1175, 0.9425, 0.59, 0.235, 1.06, 0.7075, 0.3525]
    tpattern:
    tr: 1.2s
    tslice:
    tzero: 0.53

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/opt/conda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 428, in run
    runtime = self._run_interface(runtime)
  File "/opt/conda/lib/python3.8/site-packages/nipype/interfaces/afni/base.py", line 124, in _run_interface
    return super(AFNICommandBase, self)._run_interface(
  File "/opt/conda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 822, in _run_interface
    self.raise_exception(runtime)
  File "/opt/conda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 749, in raise_exception
    raise RuntimeError(
RuntimeError: Command:
3dTshift -ignore 0 -prefix sub-017_task-aversive_run-01_bold_tshift.nii.gz -tpattern @slice_timing.1D -TR 1.2s -tzero 0.53 /home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction/sub-017_task-aversive_run-01_bold.nii.gz
Standard output:

Standard error:
++ 3dTshift: AFNI version=AFNI_22.1.02 (Apr  6 2022) [64-bit]
e[7m*+ WARNING:e[0m   If you are performing spatial transformations on an oblique dset,
  such as /home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction/sub-017_task-aversive_run-01_bold.nii.gz,
  or viewing/combining it with volumes of differing obliquity,
  you should consider running: 
     3dWarp -deoblique 
  on this and  other oblique datasets in the same session.
 See 3dWarp -help for details.
++ Oblique dataset:/home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction/sub-017_task-aversive_run-01_bold.nii.gz is 12.500000 degrees from plumb.
e[7m** FATAL ERROR:e[0m tpattern file slice_timing.1D has 60 values but have 61 slices
** Program compile date = Apr  6 2022
Return code: 1

The file for the slice timing command **

3dTshift -ignore 0 -prefix sub-017_task-aversive_run-01_bold_tshift.nii.gz -tpattern @slice_timing.1D -TR 1.2s -tzero 0.53 /home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction/sub-017_task-aversive_run-01_bold.nii.gz

Here the content of the json file:

{
    "Modality": "MR", 
    "MagneticFieldStrength": 3, 
    "ImagingFrequency": 123.251, 
    "Manufacturer": "Siemens", 
    "ManufacturersModelName": "Prisma_fit", 
    "InstitutionName": "deleted_to_anonymize_data", 
    "InstitutionalDepartmentName": "Department", 
    "InstitutionAddress": "J_5_Mannheim_District_DE_68159", 
    "DeviceSerialNumber": "167069", 
    "StationName": "MRC35396", 
    "BodyPartExamined": "HEAD", 
    "PatientPosition": "HFS", 
    "SoftwareVersions": "syngo_MR_E11", 
    "MRAcquisitionType": "2D", 
    "SeriesDescription": "cmrr_mbep2d_bold_av_hab", 
    "ProtocolName": "cmrr_mbep2d_bold_av_hab", 
    "ScanningSequence": "EP", 
    "SequenceVariant": "SK_SS", 
    "ScanOptions": "FS_EXT", 
    "SequenceName": "epfid2d1_84", 
    "ImageType": [
        "ORIGINAL", 
        "PRIMARY", 
        "M", 
        "MB", 
        "ND", 
        "NORM", 
        "MOSAIC"
    ], 
    "SeriesNumber": 17, 
    "AcquisitionTime": "deleted_to_anonymize_data",
    "AcquisitionNumber": 1, 
    "ImageComments": "Unaliased_MB6_PE3_LB", 
    "SliceThickness": 2.4, 
    "SpacingBetweenSlices": 2.4, 
    "SAR": 0.0404709, 
    "EchoTime": 0.038, 
    "RepetitionTime": 1.2, 
    "FlipAngle": 66, 
    "PartialFourier": 1, 
    "BaseResolution": 84, 
    "ShimSetting": [
        -4290, 
        -11564, 
        4906, 
        434, 
        -19, 
        200, 
        10, 
        4
    ], 
    "TxRefAmp": 239.767, 
    "PhaseResolution": 1, 
    "ReceiveCoilName": "HeadNeck_64", 
    "ReceiveCoilActiveElements": "HC1-7", 
    "PulseSequenceDetails": "%CustomerSeq%_cmrr_mbep2d_bold", 
    "WipMemBlock": "047ad1ee-3ff9-48f7-b5d8-2601271b87d5||Sequence: R016 ve11c/master r/e634e98; Dec 19 2017 11:00:25 by eja", 
    "ConsistencyInfo": "N4_VE11C_LATEST_20160120", 
    "MultibandAccelerationFactor": 6, 
    "PercentPhaseFOV": 100, 
    "PercentSampling": 100, 
    "EchoTrainLength": 84, 
    "PhaseEncodingSteps": 84, 
    "AcquisitionMatrixPE": 84, 
    "ReconMatrixPE": 84, 
    "BandwidthPerPixelPhaseEncode": 18.896, 
    "EffectiveEchoSpacing": 0.000630015, 
    "DerivedVendorReportedEchoSpacing": 0.000630015, 
    "TotalReadoutTime": 0.0522912, 
    "PixelBandwidth": 2290, 
    "DwellTime": 2.6e-06, 
    "PhaseEncodingDirection": "j", 
    "SliceTiming": [
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525, 
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525, 
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525, 
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525, 
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525, 
        0, 
        0.825, 
        0.47, 
        0.1175, 
        0.9425, 
        0.59, 
        0.235, 
        1.06, 
        0.7075, 
        0.3525
    ], 
    "ImageOrientationPatientDICOM": [
        1, 
        0, 
        0, 
        0, 
        0.976296, 
        -0.21644
    ], 
    "InPlanePhaseEncodingDirectionDICOM": "COL", 
    "ConversionSoftware": "dcm2niix", 
    "ConversionSoftwareVersion": "v1.0.20200331", 
    "Dcm2bidsVersion": "2.1.4", 
    "TaskName": "aversive"
}

Could you share the output of fslhd on the file?

@effigies yes, of course. Here the fslhd output:

filename sub-017_task-aversive_run-01_bold.nii.gz
size of header 348
data_type INT16
dim0 4
dim1 84
dim2 84
dim3 60
dim4 260
dim5 1
dim6 1
dim7 1
vox_units mm
time_units s
datatype 4
nbyper 2
bitpix 16
pixdim0 -1.000000
pixdim1 2.428571
pixdim2 2.428571
pixdim3 2.400000
pixdim4 1.200000
pixdim5 0.000000
pixdim6 0.000000
pixdim7 0.000000
vox_offset 352
cal_max 0.000000
cal_min 0.000000
scl_slope 1.000000
scl_inter 0.000000
phase_dim 2
freq_dim 1
slice_dim 3
slice_name Unknown
slice_code 0
slice_start 0
slice_end 0
slice_duration 0.000000
toffset 0.000000
intent Unknown
intent_code 0
intent_name
intent_p1 0.000000
intent_p2 0.000000
intent_p3 0.000000
qform_name Scanner Anat
qform_code 1
qto_xyz:1 -2.428571 0.000000 -0.000000 101.999992
qto_xyz:2 0.000000 2.371005 -0.519455 -73.703262
qto_xyz:3 0.000000 0.525639 2.343110 -74.934448
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Right-to-Left
qform_yorient Posterior-to-Anterior
qform_zorient Inferior-to-Superior
sform_name Scanner Anat
sform_code 1
sto_xyz:1 -2.428571 0.000000 -0.000000 101.999992
sto_xyz:2 -0.000000 2.371005 -0.519455 -73.703262
sto_xyz:3 0.000000 0.525639 2.343110 -74.934448
sto_xyz:4 0.000000 0.000000 0.000000 1.000000
sform_xorient Right-to-Left
sform_yorient Posterior-to-Anterior
sform_zorient Inferior-to-Superior
file_type NIFTI-1+
file_code 1
descrip TE=38;Time=105916.322;phase=0;mb=6
aux_file Unaliased_MB6_PE3_LB

Yeah, this seems like it should work. Can you verify that /home/PerPain/AVC/FMRIPREP/fmriprep_wf/single_subject_017_wf/func_preproc_task_aversive_run_01_wf/bold_stc_wf/slice_timing_correction/sub-017_task-aversive_run-01_bold.nii.gz hasn’t been modified from your source file?

@effigies
there are indeed some modifications. Here are all the differences found by fslhd:

modified original
dim1 85 84
dim2 85 84
dim3 61 60
dim4 249 260
phase_dim 0 2
freq_dim 0 1
slice_dime 0 3
qto_xyz:1 -2.428571 0.000000 -0.000000 104.428566 -2.428571 0.000000 -0.000000 101.999992
qto_xyz:2 0.000000 2.371005 -0.519455 -75.554810 0.000000 2.371005 -0.519455 -73.703262
qto_xyz:3 0.000000 0.525639 2.343110 -77.803200 0.000000 0.525639 2.343110 -74.934448
sto_xyz:1 -2.428571 0.000000 0.000000 104.428566 -2.428571 0.000000 -0.000000 101.999992
sto_xyz:2 0.000000 2.371005 -0.519455 -75.554810 -0.000000 2.371005 -0.519455 -73.703262
sto_xyz:3 0.000000 0.525639 2.343110 -77.803200 0.000000 0.525639 2.343110 -74.934448

the rest is identical (see last post)

Thanks, this appears to be a bug. Would you mind opening an issue here and filling in the requested details?

Dear @effigies
thanks a lot for your quick help. When filling out the details for the bug report I double checked the BIDS validation and found an interim step in my pipeline which messed with the dimensions of the data. My apologies for the inconvenience. I re-ran fmriprep on the data without that prior step and everything seems to be working as it should. No bug to report!

1 Like

Glad you found the issue!