QC file for proc.py with tedana

Hi,
I am running proc.py for 7T multi-echo data and I don’t get an output of the QC HTML file.
I will very much appreciate your help in understanding how to fix it.
attached is my proc.py script:


afni_proc.py \
     -subj_id $subject.$session.$scan.ME.blur \
     -blocks despike tshift align tlrc volreg blur mask combine scale \
     -radial_correlate_blocks tcat volreg                      \
     -blip_forward_dset $subject.$session.AP.ME+orig.HEAD                     \
     -blip_reverse_dset $subject.$session.PA.ME+orig.HEAD                     \
     -copy_anat anatSS.$subject.$session.$scan.ME.nii \
     -anat_has_skull no \
     -dsets_me_run $subject.$session.$scan.ME_00?+orig.HEAD \
     -echo_times 13.2 34.72 56.24 \
     -reg_echo 2                                               \
     -tcat_remove_first_trs 4                                  \
     -tshift_interp -wsinc9                                    \
     -align_opts_aea -cost lpc+ZZ -giant_move            \
     -tlrc_base MNI152_2009_template_SSW.nii.gz               \
     -tlrc_NL_warp                                             \
     -tlrc_NL_warped_dsets anatQQ.$subject.$session.$scan.ME.nii anatQQ.$subject.$session.$scan.ME.aff12.1D anatQQ.$subject.$session.$scan.ME_WARP.nii \
     -volreg_align_to MIN_OUTLIER                              \
     -volreg_align_e2a                                         \
     -volreg_tlrc_warp                                         \
     -blur_size 4												\
     -mask_epi_anat yes                                        \
     -combine_method tedana                                    \
     -html_review_style pythonic \
     -scr_overwrite
     
tcsh -xef proc.$subject.$session.$scan.ME.blur 2>&1 | tee output.proc.$subject.$session.$scan.ME.blur

Thank you in advance!
Maya

Hi, Maya-

Hmm, that is surprising. What is the output of:


afni_system_check.py -check_all

?

Also note that the combine_method you are using, “tedana” is the older one from Kundu et al; that doesn’t have a separate QC HTML block that is automatically created for the MEICA part. The newer MEICA from the ‘tedana’ group (Du Pre et al; here: https://tedana.readthedocs.io/en/stable/) would be selected with “m_tedana”. Note that the Kundu et al tedana can only run in Python 2.7; the developer of it doesn’t update/maintain it. The Du Pre et al. version requires Python 3.*.

Part of the help in afni_proc.py relevant to this choice (there are a loooot of combine_method opts) is:


        -combine_method METHOD  : specify method for combining echoes

                e.g. -combine_method OC
                default: OC

            When using the 'combine' block to combine echoes (for each run),
            this option can be used to specify the method used.  There are:

                - basic methods
                - methods using tedana.py (or similar) from Prantik
                - methods using tedana from the MEICA group


            ---- basic combine methods (that do not use any tedana) ----

                methods
                -------
                mean             : simple mean of echoes
                OC               : optimally combined (via @compute_OC_weights)
                                   (current default is OC_A)
                OC_A             : original log(mean()) regression method
                OC_B             : newer log() time series regression method
                                   (there is little difference between OC_A
                                   and OC_B)

            ---- combine methods that use Prantik's "original" tedana.py ----

               Prantik's tedana.py is run using the 'tedana*' combine methods.

                  Prantik's tedana.py requires python 2.7.

                  By default, tedana.py will be applied from the AFNI
                  installation directory.

                  Alternatively, one can specify the location of a different
                  tedana.py using -combine_tedana_path.  And if it is 
                  preferable to run it as an executable (as opposed to running
                  it via 'python PATH/TO/tedana.py'), one can tell this to
                  tedana_wrapper.py by applying:
                         -combine_opts_tedwrap -tedana_is_exec

                methods
                -------
                OC_tedort        : OC, and pass tedana orts to regression
                tedana           : run tedana.py, using output dn_ts_OC.nii
                tedana_OC        : run tedana.py, using output ts_OC.nii
                                   (i.e. use tedana.py for optimally combined)
                tedana_OC_tedort : tedana_OC, and include tedana orts


            ---- combine methods that use tedana from the MEICA group ----

               The MEICA group tedana is specified with 'm_tedana*' methods.

                  This tedana requires python 3.6+.

                  AFNI does not distribute this version of tedana, so it must
                  be in the PATH.  For installation details, please see:

                     https://tedana.readthedocs.io/en/stable/installation.html

                methods
                -------
                m_tedana         : tedana from MEICA group (dn_ts_OC.nii.gz)
                m_tedana_OC      : tedana OC from MEICA group (ts_OC.nii.gz)
                m_tedana_m_tedort: tedana from MEICA group (dn_ts_OC.nii.gz)
                                   "tedort" from MEICA group
                                   (--tedort: "good" projected from "bad")


            The OC/OC_A combine method is from Posse et. al., 1999, and then
            applied by Kundu et. al., 2011 and presented by Javier in a 2017
            summer course.

            The 'tedort' methods for Prantik's tedana.py are applied using
            @extract_meica_ortvec, which projects the 'good' MEICA components
            out of the 'bad' ones, and saves those as regressors to be applied
            later.  Otherwise, some of the 'good' components are removed with
            the 'bad.  The tedort method can be applied with either AFNI OC or
            tedana OC (meaning the respective OC method would be applied to
            combine the echoes, and the tedort components will be passed on to
            the regress block).

            The 'm_tedanam_m_tedort' method for the MEICA group's passes
            option --tedort to 'tedana', and tedana does the "good" from "bad"
            projection before projecting the modified "bad" components from the
            time series.

            Please see '@compute_OC_weights -help' for more information.
            Please see '@extract_meica_ortvec -help' for more information.
            See also -combine_tedana_path.

–pt

Hi,
Thanks for the answer.
this is the output of afni_system_check.py -check_all:


-------------------------------- general ---------------------------------
architecture:         64bit 
system:               Darwin
release:              21.3.0
version:              Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
distribution:         10.16
number of CPUs:       20
apparent login shell: zsh
shell RC file:        .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/ramotlab/abin/afni
afni version         : Precompiled binary macos_10.12_local: Jul 28 2021 
                     : AFNI_21.2.04 'Nerva'
AFNI_version.txt     : AFNI_21.2.04, macos_10.12_local, Jul 28 2021
which python         : /usr/bin/python
python version       : 2.7.18
which R              : 
which tcsh           : /bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/Users/ramotlab/abin/afni)
    R       : 0 
    python  : 1   (/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/pythonwrapper.app/Contents/MacOS/pythonwrapper)
    python2 : 1   (/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/pythonwrapper.app/Contents/MacOS/pythonwrapper)
    python3 : 1   (/usr/bin/python3)


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 : R: Command not found.

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 : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc

-------------------------------- env vars --------------------------------
PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/ramotlab/abin

PYTHONPATH = 
R_LIBS = 
LD_LIBRARY_PATH = 
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : found TT_N27+tlrc  under /Users/ramotlab/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.1

which brew           : /usr/local/bin/brew
brew version         : Homebrew >=2.5.0 (shallow or no git repository)

-- for PyQt4 under brew, consider running:
   brew install cartr/qt4/pyqt
-- consider installing gcc under homebrew
-- consider installing glib under homebrew
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
   -- found 'libXt' dylib files:
      /opt/X11/lib/flat_namespace/libXt.6.dylib
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'zsh'...
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in shell 'tcsh'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

=========================  summary, please fix:  =========================
*  just be aware: login shell 'zsh', but our code examples use 'tcsh'
*  failure under initial "AFNI and related program tests"
*  insufficient data for AFNI bootcamp


So if I want to apply MEICA (ICA and not only optimally combined), should I use m_tedana in the proc.py function combine_method?

Maya

Hi, Maya-

Your system looks set up AFNI-wise, though that is over a year old—I would probably run:


@update.afni.binaries -d

to update it.

Your system appears to only have Python 2.7 on it, so it would only be able to run the old meica (Kundu et al.), at present. If you wanted to run the more modern meica (Du Pre et al.), you should definitely update your AFNI, as above; you would then need Python 3.. You can use miniconda to add other environments to your computer, to “switch on/off” having Python 3., for example. Notes are here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/miniconda.html
(which even include instructions specifically for including the more modern meica/tedana).

I still think you should be getting the afni_proc.py-generated QC HTML—I will email you for some of the output log files to see what is happening in more detail.

–pt

… and the main resolution for why there was no QC HTML appearing is something I should have noticed at the start: there was no “regress” block in the afni_proc.py command. The QC HTML only gets created if the regress block is present. So, even if you don’t have plans on using those regression modeling outputs, it would still be good to include it, to have the convenient QC HTML for reviewing things (and maybe even still reviewing the regression aspects, for QC if not for usage).

–pt