Fmriprep error in antsBRainExtraction: Segmentation fault +T1w.nii.gz does not exist (it does + dataset passes BIDS validation)

Dear fmriprep team,

Would appreciate your help with the following error:

180725-10:05:26,986 workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_022_wf.func_preproc_task_stroopst_wf.bold_hmc_wf.fsl2itk” in “/root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/func_preproc_task_stroopst_wf/bold_hmc_wf/fsl2itk”.
180725-10:05:26,993 workflow INFO:
[Node] Running “fsl2itk” (“fmriprep.interfaces.itk.MCFLIRT2ITK”)
180725-10:05:36,427 workflow INFO:
[Node] Finished “fmriprep_wf.single_subject_022_wf.func_preproc_task_stroopst_wf.bold_hmc_wf.fsl2itk”.
180725-10:05:38,218 workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_022_wf.anat_preproc_wf.skullstrip_ants_wf.t1_skull_strip” in “/root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip”.
180725-10:05:38,221 workflow INFO:
[Node] Running “t1_skull_strip” (“niworkflows.nipype.interfaces.ants.segmentation.BrainExtraction”), a CommandLine Interface with command:
antsBrainExtraction.sh -a /data/sub-022/anat/sub-022_T1w.nii.gz -m /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz -e /niworkflows_data/ants_oasis_template_ras/T_template0.nii.gz -d 3 -f /niworkflows_data/ants_oasis_template_ras/T_template0_BrainCerebellumRegistrationMask.nii.gz -s nii.gz -k 1 -o highres001_ -q 1
180725-10:37:40,934 workflow WARNING:
[Node] Error on “fmriprep_wf.single_subject_022_wf.anat_preproc_wf.skullstrip_ants_wf.t1_skull_strip” (/root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip)
Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
load_entry_point(‘fmriprep==1.0.12’, ‘console_scripts’, ‘fmriprep’)()
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 314, in main
fmriprep_wf.run(**plugin_settings)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/workflows.py”, line 595, 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 480, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 564, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 644, 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 520, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/ants/segmentation.py”, line 828, in _run_interface
runtime = super(BrainExtraction, self)._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py”, line 1020, in run_interface
self.raise_exception(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py”, line 957, in raise_exception
).format(**runtime.dictcopy()))
RuntimeError: Command:
antsBrainExtraction.sh -a /data/sub-022/anat/sub-022_T1w.nii.gz -m /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz -e /niworkflows_data/ants_oasis_template_ras/T_template0.nii.gz -d 3 -f /niworkflows_data/ants_oasis_template_ras/T_template0_BrainCerebellumRegistrationMask.nii.gz -s nii.gz -k 1 -o highres001
-q 1
Standard output:

Will run Atropos segmentation with K=3. Classes labeled in order of mean intensity. Assuming CSF=1, GM=2, WM=3

The output directory “highres001_” does not exist. Making it.
--------------------- Running antsBrainExtraction.sh on ce672c13d2e8 ---------------------


Bias correction of anatomical images (pre brain extraction)

  1. pre-process by truncating the image intensities
  2. run N4

BEGIN >>>>>>>>>>>>>>>>>>>>
/usr/lib/ants/ImageMath 3 highres001_N4Truncated0.nii.gz TruncateImageIntensity /data/sub-022/anat/sub-022_T1w.nii.gz 0.01 0.999 256
END <<<<<<<<<<<<<<<<<<<<

BEGIN >>>>>>>>>>>>>>>>>>>>
/usr/lib/ants/N4BiasFieldCorrection -d 3 -i highres001_N4Truncated0.nii.gz -s 4 -c [50x50x50x50,0.0000001] -b [200] -o highres001_N4Corrected0.nii.gz --verbose 1

Running N4 for 3-dimensional images.

Mask not read. Using the entire image as the mask.

Specified spline distance: 200mm
original image size: [256, 256, 192]
padded image size: [401, 401, 201]
number of control points: [5, 5, 4]

Current level = 1
Iteration 1 (of 50). Current convergence value = 0.000266834 (threshold = 1e-07)
Iteration 2 (of 50). Current convergence value = 0.000200864 (threshold = 1e-07)
Iteration 3 (of 50). Current convergence value = 0.000156018 (threshold = 1e-07)
.
.
.

2DIAGNOSTIC, 100, -5.814228653908e-01, 3.172523577177e-07, 3.4243e+02, 1.9823e+00,
Elapsed time (stage 0): 3.4453e+02

Stage 1
iterations = 1000x500x250x100
convergence threshold = 1.0000e-08
convergence window size = 10
number of levels = 4
using the Mattes MI metric (number of bins = 32, weight = 1.0000e+00)
preprocessing: winsorizing the image intensities
preprocessing: histogram matching the images
Shrink factors (level 1 out of 4): [8, 8, 8]
Shrink factors (level 2 out of 4): [4, 4, 4]
Shrink factors (level 3 out of 4): [2, 2, 2]
Shrink factors (level 4 out of 4): [1, 1, 1]
smoothing sigmas per level: [4, 2, 1, 0]
regular sampling (percentage = 2.5000e-01)

*** Running AffineTransform registration ***

DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST
2DIAGNOSTIC, 1, -1.042005896568e+00, inf, 6.4135e+00, 6.4135e+00,
.
.
.
1DIAGNOSTIC, 8, -6.264878511429e-01, inf, 8.3084e+02, 5.6771e+01,
1DIAGNOSTIC, 9, -6.291846036911e-01, inf, 8.9057e+02, 5.9736e+01,
1DIAGNOSTIC, 10, -6.317657232285e-01, inf, 9.4843e+02, 5.7858e+01,
Elapsed time (stage 2): 960.6

Total elapsed time: 1755
END <<<<<<<<<<<<<<<<<<<<

BEGIN >>>>>>>>>>>>>>>>>>>>
/usr/lib/ants/antsApplyTransforms -d 3 -i /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz -o highres001_BrainExtractionPriorWarped.nii.gz -r /data/sub-022/anat/sub-022_T1w.nii.gz -n Gaussian -t [highres001_BrainExtractionPrior0GenericAffine.mat,1] -t highres001_BrainExtractionPrior1InverseWarp.nii.gz --float 1 --verbose 1
Using single precision for computations.
Input scalar image: /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz
Reference image: /data/sub-022/anat/sub-022_T1w.nii.gz

The composite transform comprises the following transforms (in order):

  1. highres001_BrainExtractionPrior1InverseWarp.nii.gz (type = DisplacementFieldTransform)
  2. inverse of highres001_BrainExtractionPrior0GenericAffine.mat (type = AffineTransform)
    =============================================================================
    Default pixel value: 0
    ERROR: command exited with nonzero status 139
    Command: /usr/lib/ants/antsApplyTransforms -d 3 -i /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz -o highres001_BrainExtractionPriorWarped.nii.gz -r /data/sub-022/anat/sub-022_T1w.nii.gz -n Gaussian -t [highres001_BrainExtractionPrior0GenericAffine.mat,1] -t highres001_BrainExtractionPrior1InverseWarp.nii.gz --float 1 --verbose 1

Standard error:

Using antsBrainExtraction with the following arguments:
  image dimension         = 3
  anatomical image        = /data/sub-022/anat/sub-022_T1w.nii.gz
  extraction template     = /niworkflows_data/ants_oasis_template_ras/T_template0.nii.gz
  extraction reg. mask    = /niworkflows_data/ants_oasis_template_ras/T_template0_BrainCerebellumRegistrationMask.nii.gz
  extraction prior        = /root/src/fmriprep/work/fmriprep_wf/single_subject_022_wf/anat_preproc_wf/skullstrip_ants_wf/t1_skull_strip/T_template0_BrainCerebellumProbabilityMask.nii.gz
  output prefix           = highres001_
  output image suffix     = nii.gz

N4 parameters (pre brain extraction):
  convergence             = [50x50x50x50,0.0000001]
  shrink factor           = 4
  B-spline parameters     = [200]

Atropos parameters (extraction):
   convergence            = [3,0.0]
   likelihood             = Gaussian
   initialization         = kmeans[3]
   mrf                    = [0.1,1x1x1]
   use clock random seed  = 1

file /data/sub-022/anat/sub-022_T1w.nii.gz does not exist .
/usr/lib/ants/antsBrainExtraction.sh: line 117: 20470 Segmentation fault $cmd
Return code: 1

The key error here is segmentation fault. You are most likely running out of memory. If you are using docker check the settings to make sure you expose enough RAM.

1 Like