full mask issues


I am checking the alignment between the final anatomical and the full mask for each participant to ensure that coverage is appropriate. I have a couple of instances where the coverage is really off and others where some voxels appear around the actual brain.
What may I do to improve the coregistration? Finally, how much off is acceptable? For example, would sub-020 in the picture be considered OK or would you preprocess differently?

My current proc.py is

afni_proc.py -subj_id $subj_id                          \
              -blocks tshift align tlrc volreg blur mask scale 	  \
              regress 											  \
              -copy_anat $data_root/$subj_id/$session/anat/sub-0??_ses-T?_T1w.nii.gz \
              -dsets                                              \
                  $data_root/$subj_id/$session/func/sub-0??_ses-T?_task-Num_run-0?_bold.nii.gz \
              -align_opts_aea -cost lpc+ZZ                        \
              -tshift_interp -quintic   						  \
              -tlrc_base HaskinsPeds_NL_template1.0+tlrc          \
              -tlrc_NL_warp                                       \
              -volreg_align_to MIN_OUTLIER                        \
              -volreg_align_e2a                                   \
              -volreg_tlrc_warp                                   \
              -regress_motion_per_run                             \
              -regress_censor_motion 0.6                          \
              -regress_censor_outliers 0.1						  \
              -regress_censor_prev no                             \
              -regress_reml_exec 				                  \
              -regress_stim_times                                 \
		         $data_root/$subj_id/$session/stim/Easy.*         \
                 $data_root/$subj_id/$session/stim/Medium.*       \
                 $data_root/$subj_id/$session/stim/Hard.*         \
                 $data_root/$subj_id/$session/stim/control_n.*    \
              -regress_stim_labels                                \
                  LargeD MediumD SmallD Ctrl_n                    \
              -regress_basis GAM            		              \
              -regress_opts_3dD                                   \
                  -bout                                           \
                  -jobs 4                                         \
                  -gltsym 'SYM: SmallD -LargeD' -glt_label 1 Small-Large  \
                  -gltsym 'SYM: SmallD -MediumD' -glt_label 2 Small-Medium  \
                  -gltsym 'SYM: MediumD -LargeD' -glt_label 3 Medium-Large  \
                  -gltsym 'SYM: SmallD MediumD LargeD -3*Ctrl_n' -glt_label 4 All-control \
                  -gltsym 'SYM: LargeD -Ctrl_n' -glt_label 5 Large-Control \
                  -gltsym 'SYM: SmallD -Ctrl_n' -glt_label 6 Small-Control \
                  -gltsym 'SYM: MediumD -Ctrl_n' -glt_label 7 Medium-Control \
              -regress_est_blur_epits							  \
              -regress_est_blur_errts                             \
              -write_3dD_prefix stats.MoreContrasts               \

Thank you!

You may need to add “-giant_move” to your -align_opts_aea line. The overall contour isn’t very revealing for alignment except for gross misalignment. Use the various edge displays and the other tools in the AFNI GUI and the AFNI QC reports for more guidance.

Thank you, I will try the -giant_move.
Also regarding the QC output, when I checked the output of the processing that you helped me with, I could see the movement graphs as well as the brain alignment. With my current preprocessing, I only get numerical output (TR removed, # TRs…). I don’t understand what I have changed for it to not show the same output. It is much less informative now. Is there an option I can add to my current script?

Hmm, is there an “@ss_review_html” script created in your “results” directory?

Is this running on the same computer as you previously had run afni_proc.py with full HTML QC output?



yes I do have the @ss_review_html in the folder. This is a different computer and I am using a more recent version of AFNI compared to my practice proc.py with Daniel. Attaching a picture of the current output if it can help. It is still very useful except for the alignment of anat and EPI.

Edited to add that this proc.py is within a batch file and the training was an individual proc.py file…

Hi, Ilaria-

OK, if it is a different computer, could we check the AFNI installation? What is the output of:

afni_system_check.py -check_all



Here it is!

-------------------------------- general ---------------------------------
architecture:         64bit 
system:               Darwin
release:              17.7.0
version:              Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
distribution:         10.13.6 x86_64
number of CPUs:       4
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/nens.lab/ABIN/afni
afni version         : Precompiled binary macos_10.12_local: Feb 22 2019 
                     : AFNI_19.0.17 'Tiberius'
AFNI_version.txt     : AFNI_19.0.17, macos_10.12_local, Feb 22 2019
which python         : /usr/bin/python
python version       : 2.7.10
which R              : /usr/local/bin/R
R version            : R version 3.5.1 (2018-07-02) -- "Feather Spray"
which tcsh           : /bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/Users/nens.lab/ABIN/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/3.5/Resources/bin/R)
    python  : 1   (/usr/bin/python)
    python2 : 0 
    python3 : 0 

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

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

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

------------------------------ python libs -------------------------------
** python module not found: PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp

-------------------------------- env vars --------------------------------
PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/nens.lab/ABIN:/Users/nens.lab/ABIN

DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : found AFNI_demos   under $HOME
           top history: ... [pault]: remove rank from FATCAT_DEMO, FAT_MVM_DEMO
data dir : found suma_demo    under $HOME
           top history: .../SUMA_data/Build_tmp on Wed Aug 20 10:04:23 EDT 2014
data dir : found afni_handouts under $HOME
atlas    : found TT_N27+tlrc  under /Users/nens.lab/ABIN

------------------------------ OS specific -------------------------------
which brew           : /usr/local/bin/brew
brew version         : Homebrew 2.0.0

-- 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:
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'bash'...
++ 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:  =========================
*  login shell 'bash', trusting user to translate code examples from 'tcsh'
*  shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
*  consider running: apsearch -update_all_afni_help
*  insufficient data for AFNI bootcamp

Hi, Ilaria-

Hmm, OK, that looks fine, then. To do this part “You might want to open your ~/.bash_profile file and add to it”, you can run:

echo ''  >> ~/.bash_profile
echo 'source ~/.bashrc'  >> ~/.bash_profile

and then open a new terminal (and every new terminal will have that property, so should be fine).

In order to check the image making part, can you please go to any directory with a 3D data set, say DSET, and try:

@chauffeur_afni -ulay DSET -prefix __test -save_ftype JPEG

… and does that produce an set of three image files there, called __test*jpg?



sorry for not replying earlier but the computer was still running analyses.
What I think you want from the output is this. If you want more, please let me know.
I suppose I need to install something like Netbpm?

++ Can't find program mpeg_encode for Save to MPEG-1
++ Can't find program cjpeg for Save to JPEG
++ Can't find program ppmtogif AND/OR ppmquant for Save to GIF
++ Can't find program ppm2tiff OR pnmtotiff OR pamtotiff for Save to TIFF
++ Can't find program ppmtobmp for Save to BMP
++ Can't find program pnmtopng for Save to PNG
++ Some of the missing image Save programs are in
++  the netpbm software package, which is freeware.
++  The 'fink' package at http://fink.sourceforge.net/
++  is a way to get the netpbm programs for OS X; *OR*
++  Netpbm can be found at http://netpbm.sourceforge.net/
++ To disable these warnings, set environment
++  variable AFNI_IMSAVE_WARNINGS to 'NO'.

\n++ NOT removing temporary directory './__tmp_chauf_5oScWWu9WDs'.\n

thank you

Hi, Ilaria-

Yes, netpbm is required as part of the AFNI install-- please see here to get it:

Hope that sorts it out.