[3dSkullStrip] glob error: Invalid argument


I’m totally new to this program. When I execute a command like:

$ 3dSkullStrip -input sub-08_T1w.nii.gz

I receive an error saying glob error like bellow,

** glob error: Invalid argument
** You may need to ‘setenv AFNI_SHELL_GLOB YES’
** In particular, if you are trying to access an NFS (network file
** system) mounted drive, you might be running into the situation
** where the NFS ‘cookie’ length on the remote system does not
** match the cookie length on your local system – this is the only
** situation in which we have ever seen this error. In that case,
** you can either set the environment variable as described above,
** or fix the cookie length mismatch by changing the way the NFS
** drive is exported.
** The following information from Graham Wideman of UCSD might also
** be helpful if you are reading this ‘glob error’ message:
** I’ve changed the NFS export settings on our Mac OS X 10.5 server
** to include the ‘-32bitclients’ option, and can confirm that
** this does cause AFNI to be able to see files that it could not
** see without this option. So this appears to be the more general
** way to fix the problem.
** For others in the same boat who may stumble on this message:
** It’s not at all obvious how to actually set this option,
** as OS X 10.5’s Server Admin NFS settings panels don’t have
** any way to do it.
** The short story is:
** You have to edit the /etc/exports file, as per usual in Unix,
** but decidedly not in line with all other SharePoint related
** settings in 10.5. But first, in order to have the edits not
** conflict with Server Admin management of those settings, you
** have to uncheck Server Admin’s ‘NFS Enabled’ checkbox for the
** relevant shares. Then, when editing the exports file, move
** the relevant lines outside the ‘Server Admin managed’ brackets,
** and add your options. In general, such options have to go in
** the middle section of a line; for example, after the path.
** Example:
** /Somedir -32bitclients -maproot=nobody -sec=sys -network -mask
The intensity in the output dataset is a modified version
of the intensity in the input volume.
To obtain a masked version of the input with identical values inside
the brain, you can either use 3dSkullStrip’s -orig_vol option
or run the following command:
3dcalc -a sub-08_T1w.nii.gz -b ./skull_strip_out+orig -expr ‘a*step(b)’
-prefix ./skull_strip_out_orig_vol
to generate a new masked version of the input.

What should I do to complete skull-stripping?
My system is Ubuntu18.04 on WSL2.

I will be grateful for any help you can provide.


One thing to note, you need to provide a “-prefix OUTPUT_NAME” option to that command, such as:

3dSkullStrip -input sub-08_T1w.nii.gz -prefix sub-08_T1w_SS.nii.gz

(where “SS” stands for skullstripped.

That error, as odd as it is, has come up a couple times before, and I don’t know that it was ever tracked down…

However, my guess is that something isn’t complete with your system setup. I guess you have probably already followed the setup instructions here:
Could you please copy+paste the following commands, and paste what is output in a reply:



ls -l /usr/lib/x86_64-linux-gnu/libgsl.so.23


afni_system_check.py -check_all




Thank you for your reply.
I’ve executed the 3dSkullStrip command with “prefix” option like:

3dSkullStrip -input sub-08_T1w.nii.gz -prefix sub-08_T1w_SS.nii.gz

Then, I’ve got the resulting image, where the skull-image was removed from the original image.
Although I hope it worked well, I’ve got a message like:

The intensity in the output dataset is a modified version
of the intensity in the input volume.
To obtain a masked version of the input with identical values inside
the brain, you can either use 3dSkullStrip’s -orig_vol option
or run the following command:
3dcalc -a sub-08_T1w.nii.gz -b ./sub-08_T1w_SS.nii.gz+orig -expr ‘a*step(b)’
-prefix ./sub-08_T1w_SS.nii.gz_orig_vol
to generate a new masked version of the input.

And here are outputs of the commands that you told.


$echo $DISPLAY

I use multiple displays.


$ls -l /usr/lib/x86_64-linux-gnu/libgsl.so.23

lrwxrwxrwx 1 root root 16 Aug 10 2017 /usr/lib/x86_64-linux-gnu/libgsl.so.23 → libgsl.so.23.0.0


afni_system_check.py -check_all

-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 4.19.104-microsoft-standard
version: #1 SMP Wed Feb 19 06:37:35 UTC 2020
distribution: debian buster/sid
number of CPUs: 8
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/mokamoto/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Jun 3 2020
: AFNI_20.1.13 ‘Otho’
AFNI_version.txt : AFNI_20.1.13, linux_ubuntu_16_64, Jun 03 2020
which python : /home/mokamoto/anaconda3/bin/python
python version : 3.7.3
which R : /usr/bin/R
R version : R version 3.6.3 (2020-02-29) – “Holding the Windsock”
which tcsh : /usr/bin/tcsh

instances of various programs found in PATH:
afni : 1 (/home/mokamoto/abin/afni)
R : 1 (/usr/bin/R)
python : 2
python2 : 1 (/usr/bin/python2.7)
python3 : 2

testing ability to start various programs…
afni : success
suma : success
3dSkullStrip : success
uber_subject.py : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
3dMVM : success

checking for R packages…
rPkgsInstall -pkgs ALL -check : success

R RHOME : /usr/lib/R

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** failed to load module PyQt4
– PyQt4 is no longer needed for an AFNI bootcamp

++ module loaded: matplotlib.pyplot
module file : /home/mokamoto/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py

-------------------------------- env vars --------------------------------
PATH = /home/mokamoto/anaconda3/bin:/home/mokamoto/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Program Files/MATLAB/R2019a/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/mokam/Anaconda3:/mnt/c/MinGW/bin:/mnt/c/vim81-kaoriya-win64:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files (x86)/PsychoPy3:/mnt/c/Program Files (x86)/PsychoPy3/DLLs:/mnt/c/Program Files (x86)/Nodist/bin:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/mokam/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/mokam/AppData/Local/GitHubDesktop/bin:/snap/bin:/home/mokamoto/abin

PYTHONPATH = /mnt/c/Users/mokam/myProjects/pk_verb_impression/current/src/_settings:

R_LIBS = /home/mokamoto/R


------------------------------ data checks -------------------------------
data dir : found AFNI_data6 under $HOME
top history: 20 Feb 2020 [rickr]: updated FT_analysis examples
data dir : found AFNI_demos under $HOME
top history: 22 Oct 2019 [discoraj]: added Cluster Explorer Demo
data dir : found suma_demo under $HOME
top history: …s_New/data/Build_tmp on Mon Mar 4 11:56:45 EST 2013
data dir : found afni_handouts under $HOME
atlas : found TT_N27+tlrc under /home/mokamoto/abin

------------------------------ OS specific -------------------------------
which apt-get : /usr/bin/apt-get
apt-get version : apt 1.6.12 (amd64)

========================= summary, please fix: =========================

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • have python version 3.7.3, some programs need 2.7.x



Hi, Masahiro-

OK, your afni_system_check.py results looks good, as do the other copy+paste results.

Since you said you are just starting with AFNI, I think a good resource might be this (growing) set of lectures on processing MRI data and using AFNI tools:

We also strongly recommend that people sign up for our (low traffic) message/announcement list called the AFNI Digest:
… so that you learn about updates, bug fixes, papers, etc.



Thank you for your reply and useful information.

I’ve registered the mailing list and subscribed to the youtube channel.
The youtube channel looks very nice. I’ll check those videos.