Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concat_blips #2706

Closed
juansanchezpena opened this issue Feb 7, 2022 · 14 comments
Closed

concat_blips #2706

juansanchezpena opened this issue Feb 7, 2022 · 14 comments
Labels
Milestone

Comments

@juansanchezpena
Copy link

juansanchezpena commented Feb 7, 2022

What happened?

I am unable to produce func results for a data that looks standard.

What command did you use?

/usr/local/pipelines/subfmri-arg_latest -i /MRI_DATA/nyspi/test/rawdata -o /MRI_DATA/nyspi/test/derivatives -l  /MRI_DATA/nyspi/test/derivatives/fmriprep/logs/gold.log -a "--participant-label test03gold --output-spaces T1w MNI152NLin2009cAsym:res-2 --cifti-output --output-layout legacy”

What version of fMRIPrep are you running?

21.0

How are you running fMRIPrep?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

Node Name: fmriprep_wf.single_subject_test03gold_wf.fmap_preproc_wf.wf_auto_00000.concat_blips
File: /output/fmriprep/sub-test03gold/log/20220204-140358_cfdc6d40-fc00-456a-9b71-4a44a81323ce/crash-20220204-140521-root-concat_blips-138212d8-935a-4164-a554-5ca62213c680.txt
Working Directory: /tmp/work/fmriprep_wf/single_subject_test03gold_wf/fmap_preproc_wf/wf_auto_00000/concat_blips
Inputs:
allow_4D: True
in_files:
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/niworkflows/interfaces/nibabel.py", line 191, in _run_interface
    img_4d = nb.concat_images(nii_list)
  File "/opt/conda/lib/python3.8/site-packages/nibabel/funcs.py", line 141, in concat_images
    raise ValueError(f'Affine for image {i} does not match affine for first image')
ValueError: Affine for image 2 does not match affine for first image

Additional information / screenshots

RAWDATA:
anat:
sub-test03gold_ses-21117_acq-cubepromo_T2w.json sub-test03gold_ses-21117_acq-nopromo_T1w.json
sub-test03gold_ses-21117_acq-cubepromo_T2w.nii.gz sub-test03gold_ses-21117_acq-nopromo_T1w.nii.gz

fmap:
sub-test03gold_ses-21117_dir-fpe_epi.json sub-test03gold_ses-21117_dir-rpe_epi.json
sub-test03gold_ses-21117_dir-fpe_epi.nii.gz sub-test03gold_ses-21117_dir-rpe_epi.nii.gz

func:
sub-test03gold_ses-21117_task-rest_run-01_bold.json sub-test03gold_ses-21117_task-rest_run-01_bold.nii.gz

This same raw data went through abcd

@reisnerv
Copy link

reisnerv commented Feb 8, 2022

I obtain the identical error about 40% of time when using v21.0.0 or v21.0.1 via Singularity.

@effigies
Copy link
Member

effigies commented Feb 8, 2022

Could you share the affine matrices of your fieldmap and BOLD files?

@juansanchezpena
Copy link
Author

juansanchezpena commented Feb 8, 2022 via email

@effigies
Copy link
Member

effigies commented Feb 8, 2022

No affine matrices are present in this data. You can use fslhd or mri_info or if you have nibabel installed in your Python environment: python -c "import sys; import nibabel as nb; print(nb.load(sys.argv[1]).header)" $FILENAME.

@juansanchezpena
Copy link
Author

juansanchezpena commented Feb 8, 2022 via email

@effigies
Copy link
Member

effigies commented Feb 8, 2022

It looks like there are some differences in your sforms, but they are close enough that we should probably relax our constraint.

@effigies effigies added this to the 21.0.2 milestone Feb 10, 2022
@julfou81
Copy link
Contributor

julfou81 commented Mar 2, 2022

Hi I noticed a similar error on a dataset where there was a tiny difference (in the fifth decimal in one component of the affine matrix!) between the two affines for the two _epi files used to perform topup.

For now, the workaround I used was to use fslcpgeom to copy the affine of one file to the other and fmriprep v21.0.1 was able to run correctly after this modification.

@MarcoB-MD
Copy link

MarcoB-MD commented Apr 21, 2022

So what is the current work-around to run fMRIprep 21.0.1 with very slight differences in the affine matrix of images ?

(I get the same error message as the affine matrix of my first image is slightly different from the affine of my 8th image)

@mgxd
Copy link
Collaborator

mgxd commented Apr 21, 2022

@MarcoB-MD we just released 21.0.2 which allows for slight differences between the affine matrix of your fmaps. Give that version a try and let us know if it fixes the problem!

@MarcoB-MD
Copy link

@mgxd Thanks Mathias - 21.0.2 seems to be working fine now.

@cmpetty
Copy link

cmpetty commented Aug 18, 2022

i just ran into this same issue in v22.0.0 .. the same data ran in 21.0.2 without the concat_blips error.

In [10]: run1.affine
Out[10]: 
array([[ -2.        ,   0.        ,   0.        , 126.12599945],
       [  0.        ,  -1.99296677,   0.16758209, 163.897995  ],
       [  0.        ,   0.16758142,   1.9929657 , -53.04059982],
       [  0.        ,   0.        ,   0.        ,   1.        ]])

In [11]: pe1.affine
Out[11]: 
array([[ -2.        ,   0.        ,   0.        , 126.12599945],
       [  0.        ,  -1.99296665,   0.16758209, 163.897995  ],
       [  0.        ,   0.16758208,   1.9929657 , -53.04059982],
       [  0.        ,   0.        ,   0.        ,   1.        ]])

In [12]: pe1.affine == run1.affine
Out[12]: 
array([[ True,  True,  True,  True],
       [ True, False,  True,  True],
       [ True, False,  True,  True],
       [ True,  True,  True,  True]])

In [14]: pe1.affine == pe2.affine
Out[14]: 
array([[ True,  True,  True,  True],
       [ True,  True,  True,  True],
       [ True,  True,  True,  True],
       [ True,  True,  True,  True]])


Inputs:
affine_tolerance:
allow_4D: True
in_files:
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 concat_blips.

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 398, in run
    runtime = self._run_interface(runtime)
  File "/opt/conda/lib/python3.9/site-packages/niworkflows/interfaces/nibabel.py", line 227, in _run_interface
    img_4d = nb.concat_images(
  File "/opt/conda/lib/python3.9/site-packages/nibabel/funcs.py", line 141, in concat_images
    raise ValueError(f'Affine for image {i} does not match affine for first image')
ValueError: Affine for image 1 does not match affine for first image

@smazurchuk
Copy link

smazurchuk commented Aug 29, 2022

Just adding a +1 to above comment

I upgraded from 20.1.0 to 22.0.0 and there are several participants who ran without error in the earlier version who are now giving the same error as above in the most recent version.

@cmpetty did you figure out any approach to deal with this, or plan to re-open the issue?

@effigies
Copy link
Member

Hi, please open a new issue. In general, comments on closed issues will not be as visible to us.

@cmpetty
Copy link

cmpetty commented Aug 29, 2022

Just adding a +1 to above comment

I upgraded from 20.1.0 to 22.0.0 and there are several participants who ran without error in the earlier version who are now giving the same error as above in the most recent version.

@cmpetty did you figure out any approach to deal with this, or plan to re-open the issue?

@smazurchuk

I edited site-packages/niworkflows/interfaces/nibabel.py to include the fix from here, which seemed to be missing in v22.0.0: https://github.com/nipreps/niworkflows/pull/706


227         #img_4d = nb.concat_images(
228         #    nii_list,
229         #    check_affines=not bool(self.inputs.affine_tolerance)
230         #)
231         img_4d = nb.concat_images(nii_list, check_affines=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants