fMRIPrep error?

Hi, I am trying to use fMRIPrep but keep encountering the same error:

Node: fmriprep_wf.single_subject_23807_wf.func_preproc_ses_1_task_tapping_run_01_wf.bold_reg_wf.fsl_bbr_wf.compare_transforms
Working directory: /Analysis/bids_and_fmriprep_setup/bids_working_2/fmriprep_wf/single_subject_23807_wf/func_preproc_ses_1_task_tapping_run_01_wf/bold_reg_wf/fsl_bbr_wf/compare_transforms

Node inputs:

function_str = def compare_xforms(lta_list, norm_threshold=15):
    """
    Computes a normalized displacement between two affine transforms as the
    maximum overall displacement of the midpoints of the faces of a cube, when
    each transform is applied to the cube.
    This combines displacement resulting from scaling, translation and rotation.

    Although the norm is in mm, in a scaling context, it is not necessarily
    equivalent to that distance in translation.

    We choose a default threshold of 15mm as a rough heuristic.
    Normalized displacement above 20mm showed clear signs of distortion, while
    "good" BBR refinements were frequently below 10mm displaced from the rigid
    transform.
    The 10-20mm range was more ambiguous, and 15mm chosen as a compromise.
    This is open to revisiting in either direction.

    See discussion in
    `GitHub issue #681`_ <https://github.com/poldracklab/fmriprep/issues/681>`_
    and the `underlying implementation
    <https://github.com/nipy/nipype/blob/56b7c81eedeeae884ba47c80096a5f66bd9f8116/nipype/algorithms/rapidart.py#L108-L159>`_.

    Parameters
    ----------

      lta_list : list or tuple of str
          the two given affines in LTA format
      norm_threshold : float (default: 15)
          the upper bound limit to the normalized displacement caused by the
          second transform relative to the first

    """
    from niworkflows.interfaces.surf import load_transform
    from nipype.algorithms.rapidart import _calc_norm_affine

    bbr_affine = load_transform(lta_list[0])
    fallback_affine = load_transform(lta_list[1])

    norm, _ = _calc_norm_affine([fallback_affine, bbr_affine], use_differences=True)

    return norm[1] > norm_threshold

lta_list = ['/Analysis/bids_and_fmriprep_setup/bids_working_2/fmriprep_wf/single_subject_23807_wf/func_preproc_ses_1_task_tapping_run_01_wf/bold_reg_wf/fsl_bbr_wf/fsl_to_lta/mapflow/_fsl_to_lta0/out.lta', '/Analysis/bids_and_fmriprep_setup/bids_working_2/fmriprep_wf/single_subject_23807_wf/func_preproc_ses_1_task_tapping_run_01_wf/bold_reg_wf/fsl_bbr_wf/fsl_to_lta/mapflow/_fsl_to_lta1/out.lta']
norm_threshold = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 69, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 472, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 563, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 643, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 375, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/utility/wrappers.py", line 144, in _run_interface
    out = function_handle(**args)
  File "<string>", line 39, in compare_xforms
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/algorithms/rapidart.py", line 131, in _calc_norm_affine
    newpos[i, :] = np.dot(affine, all_pts)[0:3, :].ravel()
ValueError: shapes (0,) and (4,6) not aligned: 0 (dim 0) != 4 (dim 0)

It is very strange because I had run fMRIprep with no errors previously on this same dataset, but now I am trying to rerun it on the two additional subjects I have since gotten, but this error has now occured. Any help would be appreciated

Hi. What version of fMRIPrep are you using?

Can you share the contents of the following files?

lta_list = ['/Analysis/bids_and_fmriprep_setup/bids_working_2/fmriprep_wf/single_subject_23807_wf/func_preproc_ses_1_task_tapping_run_01_wf/bold_reg_wf/fsl_bbr_wf/fsl_to_lta/mapflow/_fsl_to_lta0/out.lta',
            '/Analysis/bids_and_fmriprep_setup/bids_working_2/fmriprep_wf/single_subject_23807_wf/func_preproc_ses_1_task_tapping_run_01_wf/bold_reg_wf/fsl_bbr_wf/fsl_to_lta/mapflow/_fsl_to_lta1/out.lta']

I am using version 1.4.1

For _fl_to_lta0 the output is

type = 1 # LINEAR_RAS_TO_RASnxforms = 1mean = 0.0000 0.0000 0.0000sigma = 1.00001 4 49.999848008155823e-01 -4.629595205187798e-03 2.961140358820558e-03 9.626381993293762e-01 4.618125502020121e-03 9.999817013740540e-01 3.868130035698414e-03 6.044594645500183e-01 -2.978986594825983e-03 -3.854390932247043e-03 9.999880194664001e-01 -1.575305938720703e+00 0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00 src volume infovalid = 1 # volume info validfilename = path_too_long
volume = 64 64 34voxelsize = 3.437499046325684e+00 3.437500476837158e+00 4.000000000000000e+00xras = -9.988332390785217e-01 1.447700429707766e-02 4.607081413269043e-02yras = -1.188699807971716e-02 -9.983599185943604e-01 5.600199475884438e-02zras = 4.681060835719109e-02 5.539393797516823e-02 9.973666667938232e-01cras = 5.213920593261719e+00 3.482764434814453e+01 -2.502106475830078e+01dst volume infovalid = 1 # volume info validfilename = path_too_long
volume = 256 256 196voxelsize = 1.000000000000000e+00 1.000000000000000e+00 9.999989867210388e-01xras = 1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00cras = 7.126007080078125e+00 4.158399963378906e+01 -3.514110565185547e+01fscale 0.100000

for lta1 the output is

type = 1 # LINEAR_RAS_TO_RASnxforms = 1mean = 0.0000 0.0000 0.0000sigma = 1.00001 4 49.999790787696838e-01 -6.244568154215813e-03 1.774617703631520e-03 5.418208241462708e-01 6.213484797626734e-03 9.998360276222229e-01 1.701142266392708e-02 9.018688201904297e-01 -1.880558673292398e-03 -1.700003072619438e-02 9.998537898063660e-01 -4.253651618957520e+00 0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00 src volume infovalid = 1 # volume info validfilename = path_too_long
volume = 64 64 34voxelsize = 3.437499046325684e+00 3.437500476837158e+00 4.000000000000000e+00xras = -9.988332390785217e-01 1.447700429707766e-02 4.607081413269043e-02yras = -1.188699807971716e-02 -9.983599185943604e-01 5.600199475884438e-02zras = 4.681060835719109e-02 5.539393797516823e-02 9.973666667938232e-01cras = 5.213920593261719e+00 3.482764434814453e+01 -2.502106475830078e+01dst volume infovalid = 1 # volume info validfilename = path_too_long
volume = 256 256 196voxelsize = 1.000000000000000e+00 1.000000000000000e+00 9.999989867210388e-01xras = 1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00cras = 7.126007080078125e+00 4.158399963378906e+01 -3.514110565185547e+01fscale 0.100000

thanks for your help!

It looks like for some reason the LTA files don’t have newlines… I’ll get back to you.

Ah, this was fixed in 1.5.0. Sorry about that, but if you upgrade to the latest fMRIPrep, it should be resolved.

Thank you for your quick responses. I am still just a little confused because I had ran 1.4.1 on this exact dataset and it worked, but now a month later it is not working. are you confident this is an issue with the version of fMRIPrep? it is not working for subjects that previously worked using 1.4.1

Thanks,

I don’t mean to discredit your opinion, I just find it strange that it would have worked before but not now

Did you previously run with FreeSurfer? I think this issue specifically affected the version that used FSL registration.

Another possibility is that your working directory had a shorter path, previously. This only affected cases where the total file length exceeded 255 characters