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

FSL FUGUE - Image Exception : #3 :: Attempted to divide images/ROIs of different sizes #33

Closed
tragus1 opened this issue Feb 1, 2019 · 35 comments

Comments

@tragus1
Copy link

tragus1 commented Feb 1, 2019

Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 11, in <module>
    load_entry_point('fmriprep==1.0.8', 'console_scripts', 'fmriprep')()
  File "/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py", line 267, in main
    fmriprep_wf.run(**plugin_settings)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/workflows.py", line 602, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py", line 168, in run
    self._clean_queue(jobid, graph, result=result))
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py", line 227, in _clean_queue
    raise RuntimeError("".join(result['traceback']))
RuntimeError: Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py", line 68, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 487, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 571, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 650, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 516, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 1023, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py", line 960, in raise_exception
    ).format(**runtime.dictcopy()))
RuntimeError: Command:
fugue --despike --despikethreshold=2.1 --loadfmap=/root/src/fmriprep/work/fmriprep_wf/single_subject_ACTIGLIA011BL_wf/func_preproc_task_rest_wf/phdiff_wf/demean/sub-ACTIGLIA011BL_acq-rest_phasediff_rads_unwrapped_filt_demean.nii.gz --savefmap=sub-ACTIGLIA011BL_acq-rest_phasediff_rads_unwrapped_filt_demean_fieldmap.nii.gz --mask=/root/src/fmriprep/work/fmriprep_wf/single_subject_ACTIGLIA011BL_wf/func_preproc_task_rest_wf/phdiff_wf/bet/sub-ACTIGLIA011BL_acq-rest_magnitude1_ras_corrected_brain_mask.nii.gz
Standard output:

Standard error:
Image Exception : poldracklab/fmriprep#3 :: Attempted to divide images/ROIs of different sizes
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Return code: 134
@oesteban
Copy link
Member

oesteban commented Feb 1, 2019

Could you share some data to replicate this?

@tragus1
Copy link
Author

tragus1 commented Feb 5, 2019

Thank you very much. I´ve sent you an email with the link to the download of the data.
Best regards
Boris

@effigies
Copy link
Member

Hi @tragus1 can you verify that this issue persists in the most recent release of fMRIPrep (1.3.0.post2)?

@oesteban oesteban transferred this issue from nipreps/fmriprep Sep 3, 2019
@oesteban oesteban changed the title Image Exception : #3 :: Attempted to divide images/ROIs of different sizes FSL FUGUE - Image Exception : #3 :: Attempted to divide images/ROIs of different sizes Nov 27, 2019
@dorianps
Copy link

dorianps commented Feb 2, 2020

I found this thread while searching for a similar error from some of our subjects. I would understand if this is a field map issue because we have some other problems with Philips fieldmaps. The question is: how do we know what is the source of the problem, and what could be a solution?

Here is the crash log:

Node: fmriprep_wf.single_subject_S12345678_wf.func_preproc_ses_07_task_restingstate_run_01_wf.sdc_estimate_wf.phdiff_wf.fmap_postproc_wf.cleanup_wf.Despike
Working directory: /DATA/dorian/fmriprepdata/STUDY/data/processed/fmriprep-1.5.5/work_sub-S12345678/fmriprep_wf/single_subject_S12345678_wf/func_preproc_ses_07_task_restingstate_run_01_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/cleanup_wf/Despike

Node inputs:

args = <undefined>
asym_se_time = <undefined>
despike_2dfilter = True
despike_threshold = 2.1
dwell_time = <undefined>
dwell_to_asym_ratio = <undefined>
environ = {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
fmap_in_file = <undefined>
fmap_out_file = <undefined>
forward_warping = False
fourier_order = <undefined>
icorr = <undefined>
icorr_only = <undefined>
in_file = <undefined>
mask_file = <undefined>
median_2dfilter = <undefined>
no_extend = <undefined>
no_gap_fill = <undefined>
nokspace = <undefined>
output_type = NIFTI_GZ
pava = <undefined>
phase_conjugate = <undefined>
phasemap_in_file = <undefined>
poly_order = <undefined>
save_fmap = True
save_shift = <undefined>
save_unmasked_fmap = <undefined>
save_unmasked_shift = <undefined>
shift_in_file = <undefined>
shift_out_file = <undefined>
smooth2d = <undefined>
smooth3d = <undefined>
unwarp_direction = <undefined>
unwarped_file = <undefined>
warped_file = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 397, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 792, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 723, in raise_exception
    ).format(**runtime.dictcopy())
RuntimeError: Command:
fugue --despike --despikethreshold=2.1 --loadfmap=/DATA/dorian/fmriprepdata/STUDY/data/processed/fmriprep-1.5.5/work_sub-S12345678/fmriprep_wf/single_subject_S12345678_wf/func_preproc_ses_07_task_restingstate_run_01_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/demean/sub-S12345678_ses-07_run-03_phasediff_rads_unwrapped_recentered_filt_demean.nii.gz --savefmap=sub-S12345678_ses-07_run-03_phasediff_rads_unwrapped_recentered_filt_demean_fieldmap.nii.gz --mask=/DATA/dorian/fmriprepdata/STUDY/data/processed/fmriprep-1.5.5/work_sub-S12345678/fmriprep_wf/single_subject_S12345678_wf/func_preproc_ses_07_task_restingstate_run_01_wf/sdc_estimate_wf/phdiff_wf/magnitude_wf/bet/sub-S12345678_ses-07_run-03_magnitude1_avg_corrected_brain_mask.nii.gz
Standard output:

Standard error:
Image Exception : #3 :: Attempted to divide images/ROIs of different sizes
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Return code: 134

@oesteban
Copy link
Member

Hi @dorianps, could you confirm whether the dimensions of the magnitude file match those of the phase difference?

@ins0mniac2
Copy link

The dimensions are the same.

@ins0mniac2
Copy link

ins0mniac2 commented Mar 6, 2020

@oesteban : I looked at the files further. Even though the dimensions of the original magnitude and phase difference files match, the two input files to the fugue command that threw the error have "different" sizes. I put that in quotes because the difference is in orientation, they do have the same size along the anatomical axes. See below c3d output:

func_preproc_ses_07_task_restingstate_run_01_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/demean/sub-12345_ses-07_run-03_phasediff_rads_unwrapped_recentered_filt_demean.nii.gz -info
Image #1: dim = [64, 64, 48]; bb = {[77.644 -116.206 -94.8365], [289.644 95.7936 63.7555]}; vox = [3.3125, 3.3125, 3.304]; range = [-4.02648, 5.25277]; orient = AIL

and

func_preproc_ses_07_task_restingstate_run_01_wf/sdc_estimate_wf/phdiff_wf/magnitude_wf/bet/sub-12345_ses-07_run-03_magnitude1_avg_corrected_brain_mask.nii.gz -info
Image #1: dim = [48, 64, 64]; bb = {[77.644 92.4811 -94.8365], [236.236 304.481 117.164]}; vox = [3.304, 3.3125, 3.3125]; range = [0, 1]; orient = LPI

@dorianps
Copy link

@oesteban We are still stuck with this problem. Any suggestion of how to figure out what might be the problem? Note, this happens with fmriprep 1.5.X, we have processed the rest of the data with that version and are hoping not to need 20.0.X just for 3 subjects.

Thank you for helping out.

@effigies
Copy link
Member

To be clear, the original fieldmaps have a common orientation, but they've been changed by the time they get to demean/bet? Or we're failing to normalize to correct orientations?

@ins0mniac2
Copy link

The original fieldmap mag/phassediff files have identical orientations/sizes. These are the c3d outputs for those files:

c3d sub-R12345/ses-07/fmap/sub-R12345_ses-07_run-03_phasediff.nii.gz -info
Image #1: dim = [64, 64, 48]; bb = {[77.644 -116.206 -94.8365], [289.644 95.7936 63.7555]}; vox = [3.3125, 3.3125, 3.304]; range = [-4096, 4092]; orient = AIL

c3d sub-R12345/ses-07/fmap/sub-R12345_ses-07_run-03_magnitude1.nii.gz -info
Image #1: dim = [64, 64, 48]; bb = {[77.644 -116.206 -94.8365], [289.644 95.7936 63.7555]}; vox = [3.3125, 3.3125, 3.304]; range = [1, 2219]; orient = AIL

c3d sub-R12345/ses-07/fmap/sub-R12345_ses-07_run-03_magnitude2.nii.gz -info
Image #1: dim = [64, 64, 48]; bb = {[77.644 -116.206 -94.8365], [289.644 95.7936 63.7555]}; vox = [3.3125, 3.3125, 3.304]; range = [1, 1888]; orient = AIL

The two input files have different orientation as I said in the previous post. brainmask is LPI, which is also the orientation of the T1:

c3d sub-R12345/ses-07/anat/sub-R12345_ses-07_run-01_T1w.nii.gz -info
Image #1: dim = [208, 256, 256]; bb = {[113.727 99.4097 -134.682], [342.527 381.41 147.318]}; vox = [1.1, 1.10156, 1.10156]; range = [0, 1324]; orient = LPI

I don't know how the brainmask is being generated -- whether using the magnitude fieldmap or the T1, but thought the T1 being LPI might be related.

@effigies
Copy link
Member

Hmm. That could be the source. It would be good to validate/normalize input orientations at the entrance to the workflow, to avoid potential mismatches. It looks like FUGUE is orientation-agnostic (otherwise it would be normalizing internally), so it probably makes sense to normalize to RAS or perhaps the BOLD orientation.

I won't have time to look into this more deeply until next week at the earliest, in case anybody else does.

@dorianps
Copy link

Thanks @effigies for looking into this when you can.

@dorianps
Copy link

@effigies just pinging this thread one more time, hoping we can find a fix. With most people working from home, things may not flaw as before, but I am hoping on my end to close this work once the last 3 subjects are processed with fmriprep.

Thanks again.
Dorian

@effigies
Copy link
Member

Thanks for the ping. I haven't had a chance to look into this, but it is still on my list. I'm down to half time due to childcare responsibilities.

@effigies
Copy link
Member

@dorianps Is there any chance that you have a pair of subjects (one passing, one failing) that you could share to help reproduce the issue?

@dorianps
Copy link

Sorry @effigies , for some strange reason I am not receiving emails from this thread.

Our data are strictly guarded with legal agreements, we can't share them without a DUA. Is there something else we can try (headers, check of temp data, etc.). I think @ins0mniac2 checked a few things on the temporary data without success.

@dcmonroe
Copy link

Checking on the status of this issue. Best I can tell, I'm getting the same error:


Node: fmriprep_wf.single_subject_C01_wf.func_preproc_ses_01_task_rest_wf.sdc_estimate_wf.phdiff_wf.fmap_postproc_wf.cleanup_wf.Despike
Working directory: /tmp/work/fmriprep_wf/single_subject_C01_wf/func_preproc_ses_01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/cleanup_wf/Despike

Node inputs:
args = <undefined>
asym_se_time = <undefined>
despike_2dfilter = True
despike_threshold = 2.1
dwell_time = <undefined>
dwell_to_asym_ratio = <undefined>
environ = {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
fmap_in_file = <undefined>
fmap_out_file = <undefined>
forward_warping = False
fourier_order = <undefined>
icorr = <undefined>
icorr_only = <undefined>
in_file = <undefined>
mask_file = <undefined>
median_2dfilter = <undefined>
no_extend = <undefined>
no_gap_fill = <undefined>
nokspace = <undefined>
output_type = NIFTI_GZ
pava = <undefined>
phase_conjugate = <undefined>
phasemap_in_file = <undefined>
poly_order = <undefined>
save_fmap = True
save_shift = <undefined>
save_unmasked_fmap = <undefined>
save_unmasked_shift = <undefined>
shift_in_file = <undefined>
shift_out_file = <undefined>
smooth2d = <undefined>
smooth3d = <undefined>
unwarp_direction = <undefined>
unwarped_file = <undefined>
warped_file = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 397, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 792, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 723, in raise_exception
    ).format(**runtime.dictcopy())
RuntimeError: Command:
fugue --despike --despikethreshold=2.1 --loadfmap=/tmp/work/fmriprep_wf/single_subject_C01_wf/func_preproc_ses_01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/demean/sub-C01_ses-01_phasediff_rads_unwrapped_recentered_filt_demean.nii.gz --savefmap=sub-C01_ses-01_phasediff_rads_unwrapped_recentered_filt_demean_fieldmap.nii.gz --mask=/tmp/work/fmriprep_wf/single_subject_C01_wf/func_preproc_ses_01_task_rest_wf/sdc_estimate_wf/phdiff_wf/magnitude_wf/bet/sub-C01_ses-01_magnitude1_avg_corrected_brain_mask.nii.gz
Standard output:

Standard error:
Image Exception : #3 :: Attempted to divide images/ROIs of different sizes
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted
Return code: 134

@effigies
Copy link
Member

effigies commented Apr 15, 2020

Thanks for bumping this. The big holdup is finding a suitable test dataset (and finding the time).

The Midnight Scan Club dataset has phasediffs, so I'm going to make a pared down version of one of their subjects with data rotated into your orientations. You have LPI for T1w and AIL for your fieldmaps. In case it's relevant, what about your BOLD series?

Edit: Nevermind. I was able to reproduce without modifying the BOLD orientation.

Expand for initial orientations...
$ for IMG in sub-*/ses-*/*/*.nii.gz; do echo $IMG; fslhd $IMG | grep form; done
sub-MSC01/ses-func01/fmap/sub-MSC01_ses-func01_magnitude1.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Posterior-to-Anterior
qform_yorient  Superior-to-Inferior
qform_zorient  Right-to-Left
sform_name     Scanner Anat
sform_code     1
sform_xorient  Posterior-to-Anterior
sform_yorient  Superior-to-Inferior
sform_zorient  Right-to-Left
sub-MSC01/ses-func01/fmap/sub-MSC01_ses-func01_magnitude2.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Posterior-to-Anterior
qform_yorient  Superior-to-Inferior
qform_zorient  Right-to-Left
sform_name     Scanner Anat
sform_code     1
sform_xorient  Posterior-to-Anterior
sform_yorient  Superior-to-Inferior
sform_zorient  Right-to-Left
sub-MSC01/ses-func01/fmap/sub-MSC01_ses-func01_phasediff.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Posterior-to-Anterior
qform_yorient  Superior-to-Inferior
qform_zorient  Right-to-Left
sform_name     Scanner Anat
sform_code     1
sform_xorient  Posterior-to-Anterior
sform_yorient  Superior-to-Inferior
sform_zorient  Right-to-Left
sub-MSC01/ses-func01/func/sub-MSC01_ses-func01_task-rest_bold.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Right-to-Left
qform_yorient  Posterior-to-Anterior
qform_zorient  Inferior-to-Superior
sform_name     Scanner Anat
sform_code     1
sform_xorient  Right-to-Left
sform_yorient  Posterior-to-Anterior
sform_zorient  Inferior-to-Superior
sub-MSC01/ses-struct01/anat/sub-MSC01_ses-struct01_run-01_angio.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Left-to-Right
qform_yorient  Posterior-to-Anterior
qform_zorient  Inferior-to-Superior
sform_name     Scanner Anat
sform_code     1
sform_xorient  Left-to-Right
sform_yorient  Posterior-to-Anterior
sform_zorient  Inferior-to-Superior
sub-MSC01/ses-struct01/anat/sub-MSC01_ses-struct01_run-01_T1w.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Right-to-Left
qform_yorient  Anterior-to-Posterior
qform_zorient  Superior-to-Inferior
sform_name     Scanner Anat
sform_code     1
sform_xorient  Right-to-Left
sform_yorient  Anterior-to-Posterior
sform_zorient  Superior-to-Inferior
sub-MSC01/ses-struct01/anat/sub-MSC01_ses-struct01_run-01_T2w.nii.gz
qform_name     Scanner Anat
qform_code     1
qform_xorient  Left-to-Right
qform_yorient  Posterior-to-Anterior
qform_zorient  Inferior-to-Superior
sform_name     Scanner Anat
sform_code     1
sform_xorient  Left-to-Right
sform_yorient  Posterior-to-Anterior
sform_zorient  Inferior-to-Superior

@ins0mniac2
Copy link

Thanks @effigies . So you were able to reproduce the error on your test data ?

@effigies
Copy link
Member

Yup:

200415-18:07:12,751 nipype.workflow INFO:
	 [Node] Setting-up "fmriprep_wf.single_subject_MSC01_wf.func_preproc_ses_func01_task_rest_wf.sdc_estimate_wf.phdiff_wf.fmap_postproc_wf.cleanup_wf.Despike" in "/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/cleanup_wf/Despike".
200415-18:07:12,755 nipype.workflow INFO:
	 [Node] Running "Despike" ("nipype.interfaces.fsl.preprocess.FUGUE"), a CommandLine Interface with command:
fugue --despike --despikethreshold=2.1 --loadfmap=/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/demean/sub-MSC01_ses-func01_phasediff_rads_unwrapped_recentered_filt_demean.nii.gz --savefmap=sub-MSC01_ses-func01_phasediff_rads_unwrapped_recentered_filt_demean_fieldmap.nii.gz --mask=/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/magnitude_wf/bet/sub-MSC01_ses-func01_magnitude1_avg_corrected_brain_mask.nii.gz
200415-18:07:13,95 nipype.workflow WARNING:
	 Storing result file without outputs
200415-18:07:13,96 nipype.workflow WARNING:
	 [Node] Error on "fmriprep_wf.single_subject_MSC01_wf.func_preproc_ses_func01_task_rest_wf.sdc_estimate_wf.phdiff_wf.fmap_postproc_wf.cleanup_wf.Despike" (/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/cleanup_wf/Despike)
200415-18:07:13,932 nipype.workflow ERROR:
	 Node Despike failed to run on host 9edc547b3d73.
200415-18:07:13,936 nipype.workflow ERROR:
	 Saving crash info to /out/fmriprep/sub-MSC01/log/20200415-180636_874ae2f4-d1b2-47c9-84e2-b08c96721001/crash-20200415-180713-root-Despike-9bf45840-5736-4c2b-adbd-10227276b23b.txt
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 397, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 792, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 723, in raise_exception
    ).format(**runtime.dictcopy())
RuntimeError: Command:
fugue --despike --despikethreshold=2.1 --loadfmap=/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/fmap_postproc_wf/demean/sub-MSC01_ses-func01_phasediff_rads_unwrapped_recentered_filt_demean.nii.gz --savefmap=sub-MSC01_ses-func01_phasediff_rads_unwrapped_recentered_filt_demean_fieldmap.nii.gz --mask=/scratch/fmriprep_wf/single_subject_MSC01_wf/func_preproc_ses_func01_task_rest_wf/sdc_estimate_wf/phdiff_wf/magnitude_wf/bet/sub-MSC01_ses-func01_magnitude1_avg_corrected_brain_mask.nii.gz
Standard output:

Standard error:
Image Exception : #3 :: Attempted to divide images/ROIs of different sizes
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Return code: 134

One difference is that the brainmask appears to be in RAS, rather than LPI, so I'm not sure what's different there. Hopefully we can come up with a solution that will make it robust to any such quirks.

@effigies
Copy link
Member

effigies commented Apr 15, 2020

@oesteban @mattcieslak I'm not finding it documented. Does anything downstream of the fieldmap tools care about orientation? Would it be reasonable to reorient everything coming in to RAS?

Nevermind. Reorienting to RAS is not needed to resolve this issue and is likely to generate new issues itself. See #98.

@mattcieslak
Copy link
Collaborator

I was only able to get the fsl pipeline working if everything was in the standard FSL orientation (LAS+).

@effigies
Copy link
Member

@mattcieslak In the sense that you had to manually reorient the images before runnig the pipeline, or the pipeline had to be written to reorient its inputs?

In either case, I would be wary of that, as we have been reorienting the magnitude images to RAS+ but not the phasediff. As RAS+ and LAS+ will have the same dimensions and voxel sizes, we would not see the error in this issue, but I think you'll be masking an LAS image with an RAS brain mask and getting bad results, because of the magmrg setting I'm fixing in #98.

@mattcieslak
Copy link
Collaborator

Ah, I was thinking of the topup pipeline in qsiprep. The phasediff shouldn't need this reorientation

@effigies
Copy link
Member

Okay. We should make sure, though, that if the TOPUP pipeline is potentially permuting or flipping axes of input images, that PhaseEncodingDirection gets adjusted in the same way. Should be pretty easy to build a test for if we have known good LAS+ images.

@effigies
Copy link
Member

@tragus1 @dorianps This should be resolved in fMRIPrep 1.5.10 and 20.0.6. Please let us know if it fails.

Thanks very much for your patience, and also your persistence in prodding us to resolve this issue. It was quite a subtle bug that all previous versions of fMRIPrep were subject to. I would highly recommend re-running your earlier subjects, though you can safely reuse the working directories.

@ins0mniac2
Copy link

Appreciate your effort @effigies . Thanks much!

@dorianps
Copy link

dorianps commented Apr 17, 2020

@effigies Thank you for fixing this. I will see to rerun the 3 subjects that had this issue.

P.s. I am assuming this is the only thing changing 1.5.9 -> 1.5.10, so it is safe to drop my old singularity container and keep only the last one with the processed data.

@effigies
Copy link
Member

Yes. This is the only change: nipreps/fmriprep@1.5.9...1.5.10

@mattcieslak
Copy link
Collaborator

Just checking on this - I noticed in the release notes for fmriprep 20.0.6 it says that there is a critical bug in earlier versions for phasediff fieldmaps. Is this the issue that is referenced?

And the release note also says that there may be subtle errors in SDC for earlier versions. Has this been confirmed or is it only a possibility? We aren't sure if we should re-run all our phasediff data

@effigies
Copy link
Member

@mattcieslak Yes.

@mattcieslak
Copy link
Collaborator

Just to confirm: if the fieldmap data is in LAS+ orientation, an RAS+ mask gets applied without being flipped, causing the displacements to be potentially misshapen?

@effigies
Copy link
Member

Yes. If the fieldmap is in any orientation, an RAS+ mask gets applied without being reoriented. In LAS+ it's likely to be somewhat subtle.

@mattcieslak
Copy link
Collaborator

Ah, that's a tricky one. Was there an announcement to fMRIPrep users about this? I imagine a lot of users will want to re-run their phasediff studies. Thanks for the quick replies!

@effigies
Copy link
Member

It was in the release notes and there is a mechanism in fmriprep that will warn users of older versions, but we don't have a mailing list where we make these outlines.

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

No branches or pull requests

7 participants