Ants Brain Extraction ERROR: command exited with nonzero status 139

I am trying to run antsBrainExtraction.sh but it gives me an error like this

/home/c25078236/Desktop/ANTs/lib64/bin/antsBrainExtraction.sh: line 216: 1527811 Segmentation fault      (core dumped) ( "$@" )
ERROR: command exited with nonzero status 139
Command: antsApplyTransforms -d 3 \
-i \
-o /home/c25078236/Desktop/WAND_data/ANAT/segmentation/ants_results/sub-05532_result_PSIR_nc_stripped_ants.niiBrainExtractionPriorWarped.nii.gz \
-r /home/c25078236/Desktop/WAND_data/ANAT/segmentation/ants_results/denoised/mp2rage.nii.gz \
-n Gaussian \
-t [ /home/c25078236/Desktop/WAND_data/ANAT/segmentation/ants_results/sub-05532_result_PSIR_nc_stripped_ants.niiBrainExtractionPrior0GenericAffine.mat,1 ] \
-t /home/c25078236/Desktop/WAND_data/ANAT/segmentation/ants_results/sub-05532_result_PSIR_nc_stripped_ants.niiBrainExtractionPrior1InverseWarp.nii.gz \
--float 0 \
--verbose 1

Have you ever met this error ?

Thanks in advance.

Hi @Manuela1,

In the future please use tickmarks (or the </> button in the text editor) to format your code/terminal outputs better for readability. You can see I edited your post for you this time.

You did not specify an input image. That is, your -i argument is not defined.

Best,
Steven

it’s impossible because I am using the following command:

antsBrainExtraction.sh -d 3 -a /path/mp2rage.nii.gz -e /path/MNI152_T1_1mm_brain_mask.nii.gz -o /path/sub-05532_result_stripped_ants.nii

is it right ?

Hi @Manuela1,

It looks like it also requires a -m argument. Also, the -e argument should be referring to a brain extraction template which isn’t typically just a brain mask. From the documentation:

❯ antsBrainExtraction.sh -h

antsBrainExtraction.sh performs template-based brain extraction.

Usage:

antsBrainExtraction.sh -d imageDimension
              -a anatomicalImage
              -e brainExtractionTemplate
              -m brainExtractionProbabilityMask
              <OPT_ARGS>
              -o outputPrefix

Example:

  bash /Applications/ants-2.5.3/bin/antsBrainExtraction.sh -d 3 -a t1.nii.gz -e brainWithSkullTemplate.nii.gz -m brainPrior.nii.gz -o output

Required arguments:

     -d:  Image dimension                       2 or 3 for 2- or 3-dimensional image (default = 3)
     -a:  Anatomical image                      Structural image, typically T1.  If more than one
                                                anatomical image is specified, subsequently specified
                                                images are used during the segmentation process.  However,
                                                only the first image is used in the registration of priors.
                                                Our suggestion would be to specify the T1 as the first image.
     -e:  Brain extraction template             Anatomical template.
     -m:  Brain extraction probability mask     Brain probability mask, with intensity range 1 (definitely brain)
                                                to 0 (definitely background).
     -o:  Output prefix                         Output directory + file prefix.

Best,
Steven

Many thanks. You were right. I was missing a piece.