Still waiting for help with error in fieldmap correction

Hello, I made this post back in April -

And I still haven’t gotten any responses. I am hoping someone can help me understand what it means that there was an error in
“wf.sdc_wf.pepolar_unwarp_wf.prepare_epi_opposite_wf.merge”

I realize it is due specifically to fieldmap distortion correction but I have no way to know how to debug this. What should I look for and how could I isolate the error?

If this is not possible to help with, could someone recommend a way to integrate a fieldmap correction step outside of fmri prep? Should I run it before or after?

Edit - here is a log file from the crash - it does say the license file should be updated but I have done that and get the same thing, so I am certainly perplexed and am wondering what else in this log file could tell me what is the problem?

Node: fmriprep_wf.single_subject_015_wf.func_preproc_ses_1_task_loc_run_1_wf.sdc_wf.pepolar_unwarp_wf.prepare_epi_opposite_wf.merge
Working directory: /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/merge

Node inputs:

args = <undefined>
auto_detect_sensitivity = True
average_metric = <undefined>
environ = {'SUBJECTS_DIR': '/opt/freesurfer/subjects', 'OMP_NUM_THREADS': '1'}
fixed_timepoint = True
in_files = ['/home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0000.nii.gz', '/home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0001.nii.gz', '/home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0002.nii.gz', '/home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0003.nii.gz']
in_intensity_scales = <undefined>
initial_timepoint = 1
initial_transforms = <undefined>
intensity_scaling = True
no_iteration = True
num_threads = 1
out_file = template.nii.gz
outlier_sensitivity = <undefined>
scaled_intensity_outputs = <undefined>
subjects_dir = /opt/freesurfer/subjects
subsample_threshold = 200
transform_outputs = <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/freesurfer/base.py", line 265, in run
    return super(FSCommandOpenMP, self).run(**inputs)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/freesurfer/base.py", line 144, in run
    return super(FSCommand, self).run(**inputs)
  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/base/core.py", line 758, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 695, in raise_exception
    ).format(**runtime.dictcopy()))
RuntimeError: Command:
mri_robust_template --satit --fixtp --mov /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0000.nii.gz /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0001.nii.gz /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0002.nii.gz /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0003.nii.gz --inittp 1 --iscale --noit --template template.nii.gz --subsample 200
Standard output:
$Id: mri_robust_template.cpp,v 1.54 2016/05/05 21:17:08 mreuter Exp $

--satit: Will estimate SAT iteratively!
--fixtp: Will map everything to init TP!
--mov: Using /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0000.nii.gz as movable/source volume.
--mov: Using /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0001.nii.gz as movable/source volume.
--mov: Using /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0002.nii.gz as movable/source volume.
--mov: Using /home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0003.nii.gz as movable/source volume.
    Total: 4 input volumes
--inittp: Using TP 1 as target for initialization
--iscale: Enableing intensity scaling!
--noit: Will output only first template (no iterations)!
--template: Using template.nii.gz as template output volume.
--subsample: Will subsample if size is larger than 200 on all axes!
Setting iscale ...
reading source '/home/aleshins/2019_SL1/fmri_prep/working/fmriprep_wf/single_subject_015_wf/func_preproc_ses_1_task_loc_run_1_wf/sdc_wf/pepolar_unwarp_wf/prepare_epi_opposite_wf/split/mapflow/_split0/vol0000.nii.gz'...
--------------------------------------------------------------------------
GNU libc version: 2.23
ERROR: Systems running GNU glibc version greater than 2.15
  require a newly formatted license file (it's free). Please
  download a new one from the following page:
  http://surfer.nmr.mgh.harvard.edu/registration.html
--------------------------------------------------------------------------
Standard error:

Return code: 255

Hi, thanks for the report, and sorry your first post got skipped over. Could you share your full command for fMRIPrep?

Thank you so much!

Yes of course, it is as follows:

set subjID = ‘sub-015’
set sessionID = ‘ses-1’

project directories

set rootDir = ‘/home/aleshins/2019_SL1/’
set fmriPrepDir = $rootDir’fmri_prep/’

singularity run --cleanenv /share/apps/fmriprep-1.4.1/fmriprep.simg $fmriPrepDir’/input/’ $fmriPrepDir’/output/’ participant --fs-license-file $rootDir’/templates/’ --participant_label $subjID -w $fmriPrepDir’/working/’ -vv --output-spaces ‘MNI152NLin2009cAsym’ anat --fs-no-reconall --nthreads 2 --mem_mb 20000 --n_cpus 8

The directory specifying the license file for freesurfer is where I have placed the updated license file.

--fs-license-file expects the actual path of the license, not the containing directory. I suspect that’s your issue.

Thank you! This indeed worked. It must have been sourcing a different license file for the other fsl processes, one that was not updated, likely from the freesurfer home directory.

However I did have another question, which is that it seems from the workflow that Susceptibility Distortion Correction is applied before registration to the T1 image. Is this correct? In such a workflow, would this mean that a fieldmap must be collected very close to each run, and otherwise, the distortion correction could be misapplied? I only have one field map image (using a reverse-direction epi) in the session, so it would actually seem like a bad idea to do it this way. Is there any reason not to apply distortion correction to epi-registered runs?

Thank you!

Annoyingly, FSL and FreeSurfer are actually not related. FSL is the FMRIB Software Library.

A fieldmap is registered to each EPI run, to account for any motion between acquisitions, before it’s used to perform SDC on that EPI series. It should at any rate be no worse than registering both to T1w and then applying. If the SDC is good, then the EPI shape and contrast should more closely match the anatomy, which will give the EPI-T1w registration more to work with and should thus result in a better alignment than reversing the orderr.

Hope this helps.

Thank you so much! Apologies, I often confuse FSL and Freesurfer by name and it does seem likely that no other Freesurfer functions were being called. I really appreciate your help and detailed answer!

Anna