whereami GUI crash and check_dsets_for_fs.py

Hi beautiful AFNI people!

I had the pleasure to attend your LIBR bootcamp earlier this month… just in time I guess.

Would you mind having a look at two questions?

  1. I’m setting up some resting-state data for preprocessing with the help of Example 11 of the afni_proc.py help.
    It is suggested to use check_dsets_for_fs.py to prepare the data before running Freesurfers recon_all.
    If I understand your update, Paul, correctly this is not necessary at all anymore? Is that true only for a certain (new) Freesurfer version or just a general conclusion?
    So can I just mri_convert my data from BRIK to mgz and proceed accordingly with recon_all?

I’m referring to this update:
12 Mar 2020, P Taylor, check_dset_for_fs.py, level 3 (MAJOR), type 0 (GENERAL)
This program has been deemed unnecessary.

Also the afni_proc.py help suggests now using @SSwarper’s skull stripping instead of Freesurfers.
Does this mean I just add the -skullstrip option to the recon_all program and change the -anat_has_skull option to ‘yes’ in afni_proc.py?

  1. I use AFNI on Windows Subsystem for Linux (shame on me, I know).
    Whenever I use the “whereami” option in the AFNI GUI to determine where the heck I’m at in a brain the program crashes without an error message.

Find my afni_system_check.py -check_all log attached. Any ideas on that?
-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 4.4.0-18362-Microsoft
version: #1-Microsoft Mon Mar 18 12:02:00 PST 2019
distribution: Ubuntu 18.04 bionic
number of CPUs: 4
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/jonas/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Feb 26 2020
: AFNI_20.0.18 ‘Galba’
AFNI_version.txt : AFNI_20.0.18, linux_ubuntu_16_64, Feb 26 2020
which python : /usr/bin/python
python version : 2.7.17
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/jonas/abin/afni)
R : 1 (/usr/bin/R)
python : 1 (/usr/bin/python2.7)
python2 : 1 (/usr/bin/python2.7)
python3 : 1 (/usr/bin/python3.6)

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 -------------------------------
++ module loaded: PyQt4
module file : /usr/lib/python2.7/dist-packages/PyQt4/init.pyc

** failed to load module matplotlib.pyplot
– matplotlib.pyplot is not required, but is desirable

-------------------------------- env vars --------------------------------
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2020.5.0_x64__79rhkp1fndgsc:/mnt/c/Program Files/Python38/Scripts/:/mnt/c/Program Files/Python38/:/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/PuTTY/:/mnt/c/Users/JSteinhauser/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/JSteinhauser/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/home/jonas/abin

R_LIBS = /home/jonas/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/jonas/abin

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

have Ubuntu system: Ubuntu 18.04 bionic
have Ubuntu afni : Precompiled binary linux_ubuntu_16_64: Feb 26 2020

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • shell bash: consider sourcing (non-login) .bashrc from (login) .profile

Thanks a lot for your help and the awesome bootcamp.
You guys rock!

Best regards,

Hi, Jonas-

Glad you enjoyed the Bootcamp!

Re. Q1a: Yes, this has been a roller coaster of an issue. After good discussions with the FreeSurfer folks, we discovered that the (mis)alignment issue that we thought was happening was due to our own way of viewing the before/after datasets. Somewhat humbling for us… but that is life. So, the check_dset_for_fs.py is no longer active nor needed. Proceed directly onwards with your recon-all commands.

Re. Q1b: re. skullstripping before or after recon-all—I haven’t looked at this systematically myself, so I couldn’t say definitely one way or the other (to date, I have typically just run FS’s recon-all on a non-skullstripped dataset). However, @SSwarper does a pretty darn nice job of skullstripping (typically), so I can see this being reasonable. I guess you could run @SSwarper, see if you like the results, and then decide if you want to use that as input to recon-all? (It would be great to have your feedback here, if you do decide to do that; this might be something I will try on some test data, as well, comparing results in both cases.)
Either way, I typically load the “anatSS.${subj}.nii” dataset from @SSwarper into afni_proc.py with “-copy_anat”, and then do, indeed, add “-anat_has_skull no”.

Re. Q2: No real shame in using WSL—at least you are using Linux! Re. your whereami woes: could you doublecheck if there is text in the terminal that shows any complaint that might point to the problem?
I have noticed that sometimes the problem is internet connection, because by default the “whereami” will try to connect to NeuroSynth, and if it can’t it breaks down. You can try checking yoru internet connection from the commandline, and make sure it is OK (“wget www.nytimes.com” or something to see if you can pull down an HTML page). You can also edit your ~/.afnirc file to add the environment variable to turn off using neurosynth: put this line at the bottom of that text file (you should be able to open it with any text editor, such as “gedit ~/.afnirc”), for example:


… and then see if things go better for you.

If your setup is different than the default, it might be that your AFNI can’t find some atlas file; to check that, does the following return anything if you copy+paste it into a terminal?

@FindAfniDsetPath TTatlas+tlrc

Bonus response: you didn’t ask, but I note that the afni_system_check.py found that you did not have matplotlib.pyplot on your system—that means that you won’t be able to use the muuuuuch nicer “pythonic” form of QC HTML from afni_proc.py (“-html_review_style pythonic”). I would strongly encourage you to put Python’s matplotlib library on your system (I like using Conda via miniconda for being able to have multiple Python setups cleanly on one machine, but you can also just “sudo apt-get install python-matplotlib” to install it on your system default, with Aptitude.)


Make sure you install an X11 server that supports X11 HTML properly like VcXsrv. Otherwise, turn off AFNI_WEBBY_WAMI, as Paul suggested.


Hi Paul,

thanks for your elaborate answer!
I certainly enjoyed bootcamp more than the people videocalling in from Norman campus… but I think that’s partly due to not a single person attending the bootcamp from over there.

Q1a: Seems reasonable, I will just do that then. And people desperate for finding an answer to the question I had will now be able to find it through the power of Google. Yeih!

Q1b: I just started processing the subject I had FS skull-stripped earlier with @SSwarper - I’ll keep you posted after comparing the two versions!
But I guess a good habit for me would be to script the analysis in a way that it does @SSwarper Skull Stripping → recon_all with no skull strip option → @SUMA_Make_Spec_FS —> eternal happiness.

Q2: In an ideal world I will just run AFNI on a all-linux machine. Maybe someday…
The terminal doesn’t show any complaints - it does give out the information that there might be other areas nearby etc that would normally pop-up in the GUI
Internet connection in the terminal is not an issue, I can download a .html site no problem.
I talked to other people in the lab and they have the same issue.

Buuuuut: Adding AFNI_WEBBY_WAMI = NO to my .afnirc does the trick. I don’t pretend to comprehend what consequences it will have if it can’t connect to NeuroSynth anymore but hey - at least it’s not crashing now!

It does find the TTatlas+tlrc in the bin ~/abin directory like it should.

Bonus answer:
Well good that you pointed that out - I would have run into that issue as soon as I had executed the created afni_proc.py script. I don’t want to live without this review ever again.
Over are the days of command line opening processed SPM images and clicking through all the slices manuallly! … that is, if I convince my home lab in Germany to switch to AFNI once my internship here finishes and I have to go back.

Does look a lot better:
------------------------------ python libs -------------------------------
++ module loaded: PyQt4
module file : /usr/lib/python2.7/dist-packages/PyQt4/init.pyc

++ module loaded: matplotlib.pyplot
module file : /usr/lib/python2.7/dist-packages/matplotlib/pyplot.pyc

Well, anyhow, thanks for your time and I’ll keep you posted on the Skull Stripping comparison.


//EDIT you guys are faster at sending out answers than I can type my response!
What Daniel suggested made it work - our internal guidelines still recommend Xming but I installed VcXSrv as you suggested, removed the entry from ~/.afnirc again and it works like a charm. Legends!

Great you worked it out - a few ways. Just to add some more options, other Xservers on Windows will probably work too. I’ve tried MobaXterm that combines an X11 server with a configurable terminal also works pretty well. That can start the WSL Ubuntu inside the application, so it may be easier. Others may be good too - Xwin32, Exceed3D, X410, but these others are not freeware.