The "NV" button in QC HTML is not responding

Hello,

The "NV" button in QC HTML isn't responding after clicking (processed in Rocky Linux). I have flask and flask_cors installed. This also happens when running the same code in WSL (Ubuntu). Do I need to specify some options in afni_proc.py? I do set -html_review_style pythonic. The "RATE" button appears to be struck through and A, A+ etc are also not responding. Could you please help to fix this?

Here is afni_system_check.py -check_all result

-------------------------------- general ---------------------------------
architecture:         64bit ELF
cpu type:             AMD EPYC 7532 32-Core Processor
system:               Linux
release:              4.18.0-513.24.1.el8_9.x86_64
version:              #1 SMP Thu Apr 4 18:13:02 UTC 2024
distribution:         Rocky Linux 8.9 (Green Obsidian)
number of CPUs:       64
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/afni
afni version         : Precompiled binary 1: Apr 19 2024
                     : AFNI_99.99.99 'Alexios V Doukas the Bushy-eyebrowed'
AFNI_version.txt     :
which python         : /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/python/3.11.5/bin/python
python version       : 3.11.5
which R              : /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/r/4.3.1/bin/R
R version            : R version 4.3.1 (x86_64-pc-linux-gnu)

instances of various programs found in PATH:
    afni    : 2
      /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/afni
      /home/djangoc/abin/afni
    R       : 1   (/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/r/4.3.1/bin/R)
    python  : 2
      /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/python/3.11.5/bin/python3.11
      /cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/bin/python-exec2c
    python2 : 0
    python3 : 3
      /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/python/3.11.5/bin/python3.11
      /cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/bin/python-exec2c
      /usr/libexec/platform-python3.6

** have python3 but not python2

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

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/bin/tcsh
which Xvfb           : /cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/bin/Xvfb

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

R RHOME : /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/r/4.3.1/lib64/R

------------------------------ python libs -------------------------------

++ module loaded: matplotlib.pyplot
   module file : /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/scipy-stack/2023b/lib/python3.11/site-packages/matplotlib/pyplot.py
   matplotlib version : 3.7.2

++ module loaded: flask
   module file : /home/djangoc/.local/lib/python3.11/site-packages/flask/__init__.py
   flask version : 3.0.3

++ module loaded: flask_cors
   module file : /home/djangoc/.local/lib/python3.11/site-packages/flask_cors/__init__.py
   flask_cors version : 4.0.0

-------------------------------- env vars --------------------------------
PATH                       = /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/scipy-stack/2023b/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/ipykernel/2023b/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/python/3.11.5/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/protobuf/24.4/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/fftw/3.3.10/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/netcdf/4.9.2/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/hdf5/1.14.2/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/gsl/2.7/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/qt/5.15.11/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/r/4.3.1/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Core/java/17.0.6:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Core/java/17.0.6/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Core/flexiblascore/3.3.1/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Core/flexiblascore/3.3.1/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/openmpi/4.1.5/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/ucc/1.2.0/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/pmix/4.2.4/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/libfabric/1.18.0/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/ucx/1.14.1/bin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/hwloc/2.9.1/sbin:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcccore/hwloc/2.9.1/bin:/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/x86_64-pc-linux-gnu/gcc-bin/12:/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Core/mii/1.1.2/bin:/cvmfs/soft.computecanada.ca/easybuild/bin:/cvmfs/soft.computecanada.ca/custom/bin:/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/bin:/cvmfs/soft.computecanada.ca/custom/bin/computecanada:/home/djangoc/.local/bin:/home/djangoc/bin:/opt/software/slurm/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin:/home/djangoc/abin

PYTHONPATH                 = /cvmfs/soft.computecanada.ca/easybuild/python/site-packages:/cvmfs/soft.computecanada.ca/custom/python/site-packages

R_LIBS                     =
LD_LIBRARY_PATH            =
DYLD_LIBRARY_PATH          =
DYLD_FALLBACK_LIBRARY_PATH =
CONDA_SHLVL                =
CONDA_DEFAULT_ENV          =

----------------------------- eval dot files -----------------------------

----------- AFNI $HOME files -----------

    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

--------- shell startup files ----------

   -- good: .tcshrc seems to contain 'source .cshrc'
   -- considered operations: path, apsearch

   -- note: followers should not need edits, so edit flags should be 0
      (have 1 follower(s), which can be ignored)

   dot file test : want 1 modifications across 3 files:

      file             path  flatdir  apsearch        follower
      ---------------  ----  -------  --------        --------
      .cshrc           0     0        1               0
      .tcshrc          0     0        0               1
      .bashrc          0     0        0               0

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : did not find TT_N27+tlrc

------------------------------ OS specific -------------------------------
which dnf            : /usr/bin/dnf
dnf version          : 4.7.0
which yum            : /usr/bin/yum
yum version          : 4.7.0


=========================  summary, please fix:  =========================
*  just be aware: login shell 'bash', but our code examples use 'tcsh'
*  missing AFNI_version.txt, maybe package is old
*  failure under initial "AFNI and related program tests"
*  have multiple versions of AFNI in PATH
*  dot file test : want 1 modifications across 3 files:
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)
*  possibly missing atlases

Here is the output chuck related to QC

apqc_make_tcsh.py -review_style pythonic -subj_dir . -uvar_json out.ss_review_uvars.json
++ Done making (executable) IC errts script: 
      run_instacorr_errts.tcsh
++ Done making (executable) GV errts script: 
      run_graphview_errts.tcsh
++ Done making (executable) IC pbrun script: 
      run_instacorr_pbrun.tcsh
++ Done making (executable) GV pbrun script: 
      run_graphview_pbrun.tcsh
+* WARNING: cannot find logo file:
   /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/apqc_logo_main.svg
+* WARNING: cannot find logo file:
   /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/apqc_logo_help.svg
+* WARNING: cannot find font file:
   /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/FiraCode-Bold.woff2
+* WARNING: cannot find font file:
   /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/FiraCode-Regular.woff2
++ APQC create: qc_00_vorig_EPI
++ APQC create: qc_01_vorig_anat
++ APQC create: qc_02_vorig_olap
++ APQC create: qc_03_ve2a_epi2anat
++ APQC create: qc_04_ve2a_mask2final
++ Found 3 stats items to use for vstat QC block
++ APQC create: qc_05_vstat_Full_Fstat
++ APQC create: qc_06_vstat_type1_0_Coef
++ APQC create: qc_07_vstat_type2_0_Coef
++ APQC create: qc_08_mot_enormoutlr
++ APQC create: qc_09_mot_VR6
++ APQC create: qc_10_mot_grayplot
++ APQC create: qc_11_regr_ideal
++ APQC create: qc_12_regr_stims
++ APQC create: qc_13_regr_df
++ APQC create: qc_14_regr_corr_errts
++ APQC create: qc_15_regr_tsnr_vreg
++ APQC create: qc_16_regr_tsnr_fin
++ APQC create: qc_17_radcor_rc_tcat
                run: r01/9
                run: r02/9
                run: r03/9
                run: r04/9
                run: r05/9
                run: r06/9
                run: r07/9
                run: r08/9
                run: r09/9
++ APQC create: qc_18_radcor_rc_volreg
                run: r01/9
                run: r02/9
                run: r03/9
                run: r04/9
                run: r05/9
                run: r06/9
                run: r07/9
                run: r08/9
                run: r09/9
++ APQC create: qc_19_warns_xmat
++ APQC create: qc_20_warns_cen_total
++ APQC create: qc_21_warns_cen_stim
++ APQC create: qc_22_warns_decon
++ APQC create: qc_23_warns_press
++ APQC create: qc_24_warns_sat_4095
++ APQC create: qc_25_warns_flip
++ APQC create: qc_26_warns_vlines
++ APQC create: qc_27_qsumm_ssrev
++ APQC create: copy jsons to info dir
++ APQC create: copy ss_review_basic file
++ APQC create: display ss_review_basic info

Hi-

The "RATE" button in the upper left is in gray text with a red line through it---none of the buttons will work. Since your afni_system_check.py -check_all output (thanks for including that!) shows that you have both the flask and flask_cors Python modules, I wonder if the QC HTML just wasn't opened with the necessary AFNI program open_apqc.py to start up the local server? To get the buttons working, you should open one or more the HTML with:

open_apqc.py -infiles INDEX1 INDEX2 INDEX3 ...

where INDEX1 can include any amount of path, just ending with the index.html in a subject's QC_* directory.

More description and details are provided here:

In your system check, I also see this warning at the end, which might be a concern:

*  possibly missing atlases

What is the output of these two commands on your computer?

@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz

ls `@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz`/*.{nii,HEAD}*

?

On a minor note, it is odd to see this series of warnings:

+* WARNING: cannot find logo file:
   /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/apqc_logo_main.svg

I'm not sure what to make of that. I wonder the way your HPC is setup that some parts of a regular install have been changed around. From seeing the version information as

AFNI_99.99.99 'Alexios V Doukas the Bushy-eyebrowed'

I think that means you are using a singularity instance built by NeuroDocker. That OS is Rocky Linux 8, and we do have our own compiled binaries for that:

https://afni.nimh.nih.gov/pub/dist/tgz/linux_rocky_8.tgz

I wonder if that would make more sense for your HPC maintainers to use for AFNI.

--pt

Thanks a lot, Paul,

This indeed opens the HTML with a green "RATE" button. However, a black box is given after clicking the NV button. I will read the preprint to get more familiar with this new APQC feature.

I realized that I might be doing something silly. Is niiview rendering the interactive view online after clicking the NV button? or this QC HTML is standalone? I was opening it on Windows, and it shows red "RATE" button. Since it was computed on the HPC, I can only download the result folder and open it locally. When tried in WSLg, it gave me this black box. Should I try on a Linux PC?

[djangoc@narval1 ~]$ @FindAfniDsetPath MNI152_2009_template_SSW.nii.gz
ath MNI152_2009_template_SSW.nii.gz`/*.{nii,HEAD}*[djangoc@narval1 ~]$
[djangoc@narval1 ~]$ ls `@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz`/*.{nii,HEAD}*
ls: cannot access '/*.nii*': No such file or directory
ls: cannot access '/*.HEAD*': No such file or directory

I also have this warning with the AFNI installed on my laptop (WSL) for fonts.

Regarding the AFNI version, Rick told me in another post about this linux_rocky8 version. I mentioned it to the HPC technician, but they have rules for installing modules and this is what I can get. It seems it was compiled from the source code. AFNI runs fine, just this niiview in APQC does not work so far.

Thanks,
Zhengchen

Hi, Zhengchen-

I'm glad that using open_apqc.py -infiles .. solves one issue. I wonder if that system has NiiVue installed, then? From your afni_system_check.py output, I can see the directory storing the AFNI programs. So, what is the output of looking for the NiiVue *.js file there:

ls /cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/gcc12/afni/24.1.03/bin/niivue_afni.umd.js

? Indeed, clicking the "NV" button should open a new rectange in the APQC HTML with relevant information to displayed---you don't need to do anything else there. This should work on any macOS or Linux (including WSL) that has a complete installation. (At recent Bootcamps, it has worked on all these OSs).

Re. the commands on the command line: I don't understand this one (it looks like two copy+pastes got merged together a bit):

@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz
ath MNI152_2009_template_SSW.nii.gz`/*.{nii,HEAD}*

Could you please try copy+pasting this again:

@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz

?

The output you have for the second---not showing any files---suggests that your system install did not include the templates+atlases we distribute, which are basically this tarball:

curl -O https://afni.nimh.nih.gov/pub/dist/atlases/afni_atlases_dist.tgz

I don't know why. You could download+unpack that on your computer, and then add that file location as a "global session" directory in your ~/.afnirc file, so that they would always be loaded when you open your AFNI GUI. I have the following line at the bottom of my ~/.afnirc file, and you can do the same, just changing the path to the right of the = to point to the afni_atlases_dist on your computer:

AFNI_GLOBAL_SESSION = /home/ptaylor/REF_TEMPLATES  

Re. WSL and font warnings, under the install pages here we have a link to webpage about installing those.

Re. the HPC installation stuff: hmm, that is unfortunate. If your HPC is set up with all AFNI dependencies, though, can you just download the binaries to your home directory there:

curl -O https://afni.nimh.nih.gov/pub/dist/tgz/linux_rocky_8.tgz

... and then put that location at the start of your path? That should be sure to have NiiVue in it, and would even have the datasets we distribute (and you could either still have a separate global session directory, or set that variable to that location).

--pt

1 Like

I don't see this .js file under the folder, cannot access 'niivue_afni.umd.js': No such file or directory

It just returns an empty line

That's the very first plan I tried, if it worked I can even update AFNI by myself. However, there is no module that I can load to have all the libs needed. Then I can not run AFNI.

Given the limitation of HPC, probably what I can do is run the analysis with HPC and render the APQC again locally.

Hi, Zhengchen-

Re. not seeing niivue_afni.umd.js in the AFNI binary directory: indeed, that is an issue, and I will ping the Neurodocker folks to make sure they include it.

Re. this returning an empty line:

@FindAfniDsetPath MNI152_2009_template_SSW.nii.gz

I guess that this is also something with the Neurodocker installation. That is unfortunate. But at least you can download the datasets and have knowledge of them separately in AFNI:

# download the datasets into your home directory
cd
curl -O https://afni.nimh.nih.gov/pub/dist/atlases/afni_atlases_dist.tgz
# unpack the directory
tar -xf afni_atlases_dist.tgz

... then add that full path location to the bottom of your ~/.afnirc file, with

AFNI_GLOBAL_SESSION = <whatever your path to home is>/afni_atlases_dist

Sorry to hear about the dependency woe on the HPC. Hopefully we can get things sorted with Neurodocker to have NiiVue available, and then you will have things fully available.

In the meantime, hopefully the AV, IC, and GV buttons work for you, since those "just" use AFNI. And the rating+comment buttons at the top of the APQC HTML should also work (all this still requiring opening the HTML with open_apqc.py -infiles ...). That way you can save ratings+comments in the HTML as you go through it.

Thanks for bringing these issues up.

--pt

1 Like

Thanks a lot Paul. I will also explore more on my side and keep you posted.

Hi Paul,

I finally found a way to make it work. Actually, it is a problem with the browser in WSL... I just copied the local address after open_apqc.py to Chrome on Windows, and everything is fine. It works for both results computed by HPC and WSL. Thanks again.

1 Like

Hi, Zhengchen-

Oh, wow, OK, that is good news! What was the other browser you were using in WSL before this?

--pt

I tried both Chrome and Firefox. None of them worked. I also tried to uninstall them and reinstall, it didn’t work until I just copied the address to Windows Chrome… this is a bit silly I’m sorry about that :)

OK, that is good to know but I haven't seen that issue before. Sometimes people have trouble getting firefox on WSL, and this set of steps helped that, but I haven't seen NiiVue not work. Hmm, sorry for the hassle. I'm not sure why that would happen.

--pt

Firefox installation was fine. I also don’t know why it didn’t work with NiiVue. To be precise, I’m using WSLg on Win11. Not sure if it makes a difference, but it usually gives better GUI performance.

OK, it is good to know that distinction. I haven't used (or heard of, actually) WSLg. It's hard to guess what might be different without testing it out in person (one can rightclick on a webpage -> Inspect (Q) -> Console, and then see if error messages pop up as one navigates).

Glad you have a workable solution for now, at least for viewing a single page. Opening multiple pages is also useful, and so hopefully we can find a way to have it work natively still.

Thanks, this is what it shows, it seems related to the support on WebGL2. Uncaught (in promise) Error: unable to get WebGL context. Maybe the browser doesn't support WebGL2.

Hi, Zhengchen-

Ah, thanks. That is interesting to see the "unable to get WebGL context". What is the output of:

firefox --version

in your WSLg terminal?

Also, are you able to open the afni or suma GUIs on that WSLg?

thanks,
pt

Hi Paul,

This was Chrome Version 124.0.6367.91 (Official Build) (64-bit).

I installed Mozilla Firefox 125.0.2 and got a similar message.

OK, the problem for running NiiVue directly in WSLg appears to be that the native browsers in WSLg do not allow WebGL to be used (at present). @zhengchencai showed this nicely by putting get.webgl.org/webgl2/ into the browser tab, and the WSLg-native browser produced:


while in the Windows-based browser, doing the same produced:
image
... and showed a rotating rectangle, as it should.

There are now 2 solutions for having the NiiVue instance work, when opening the APQC HTML with:

open_apqc.py -infiles ..

Thanks very much to @zhengchencai for continuing the discussion and work on this in a message thread, and to Taylor Hanayik (one of the main NiiVue developers) for discussing this, as well.

Each involves setting an environment variable in your default shell settings file (like, ~/.bashrc for bash, ~/.tcshrc for tcsh, etc.; note that each shell has a particular syntax):

  1. Tell OpenGL to use your local hardware for rending, by setting this system environment variable LIBGL_ALWAYS_SOFTWARE to 1:

    # in ~/.tcshrc or ~/.cshrc:
    setenv LIBGL_ALWAYS_SOFTWARE 1
    
    # in ~/.bashrc:
    export LIBGL_ALWAYS_SOFTWARE=1
    

    This is fine, but will result is slightly slower performance than the section option, below.

  2. Tell WSLg to use the browser on the Windows OS to be the default (indeed, WSL and WSLg can get at files on the Windows side, as noted in the install instructions; to set it to be Firefox:

    # in ~/.tcshrc or ~/.cshrc:
    setenv BROWSER '/mnt/c/Program Files/Firefox/firefox.exe'
    
    # in ~/.bashrc:
    export BROWSER='/mnt/c/Program Files/Firefox/firefox.exe'
    

    ... and you could do similarly for Chrome, too.

Note: that someday this kind of thing might not be necessary if Windows improves WSL/WSLg. I look forward to that day! Until then, thanks for mentioning this and troubleshooting.

Thanks,
pt