RE: field map

Hi AFNI Gurus,

I’m wrestling with a dataset that has Siemens GRE dual TEs field maps. Can anyone recommend an efficient way to use these in AFNI for distortion correct? There seems to be an easy approach in afni_proc.py for when one has two flip images (A-P, P-A), but not for dual TE maps. Any help would be much appreciated!!

Thanks!
Chuck

Hi, Chuck-

There is a program in AFNI called epi_b0_correct.py, mostly written by Vinai Roopchansingh:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/programs/epi_b0_correct.py_sphx.html#ahelp-epi-b0-correct-py

That should help.

I forget if the way to use that directly with afni_proc.py is available yet. I will have to ping Rick.

–pt

Thanks, Paul.

So, I’m using the below code, but the program ends with an error. I think I’m making an error with the freq maps…but not sure. In the following, 16_FieldMap.nii is the phase file I get from the scanner and 15_FieldMap.nii is one of the magnitude files. Do I need to alter the phase file or is putting the -scale_freq doing this for me?

epi_b0_correct.py
-epi_pe_echo_sp 0.00031 \
-epi_pe_dir AP
-scale_freq 0.311785
-in_freq 16_FieldMap.nii \
-do_recenter_freq MEAN
-in_magn 15_FieldMap.nii
-in_epi sub-055_ses-01_task-rest_bold.nii \
-prefix b0_corr

Thanks again. --C

Hi, Chuck-

What is the error?

-pt

Hi,
Below is the error I’m getting:

** ERROR executing this command in the shell:
@chauffeur_afni -ulay “15_FieldMap.nii” -edge_enhance_ulay 0.5 -ulay_range_nz 0% 95% -pass -set_subbricks 0 0 0 -obliquify u2o -olay mb_02_dil8.nii.gz -func_range_perc_nz 95 -cbar RedBlueGreen -pbar_posonly -pbar_saveim …/b0_corr_QC/qc_00_ee_magn+mask -pbar_comm_range ‘95%ile of nonzero vox’ -prefix …/b0_corr_QC/qc_00_ee_magn+mask -opacity 4 -montx 5 -monty 3 -set_xhairs OFF -label_mode 1 -label_size 3

** Exit status : 1
** Standard error :

Thanks,
–Chuck

I wonder if your system can run @chauffeur_afni commands…

If you run the following with some 3D dset DSET:


@chauffeur_afni -input DSET

… do you get an error?

And also, what is the output of


afni_system_check.py -check_all

?

–pt

Hi,

1). Running @chauffeur_afni -input DSET results in an error –
@chauffeur_afni -ulay sub-055_ses-01_T1w.nii
++ My command:
@chauffeur_afni -ulay sub-055_ses-01_T1w.nii
** ERROR: Xvfb – not found in path – program fails

++ DONE (bad exit): check for errors

  1. Here’s my output of afni_system_check.py -check_all :

afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 2.6.32-754.35.1.el6.x86_64
version: #1 SMP Wed Sep 16 06:48:01 EDT 2020
distribution: Red Hat Enterprise Linux Server 6.10 Santiago
number of CPUs: 20
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /gpfs/group/dml129/default/sw/afni/20.1.13/bin/afni
afni version : Precompiled binary linux_openmp_64: Jun 4 2020
: AFNI_20.1.13 ‘Otho’
AFNI_version.txt : AFNI_20.1.13, linux_openmp_64, Jun 04 2020
which python : /opt/aci/sw/python/3.6.3_anaconda-5.0.1/bin/python
python version : 3.6.3
which R : /usr/bin/R
R version : R version 3.5.2 (2018-12-20) – “Eggshell Igloo”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/gpfs/group/dml129/default/sw/afni/20.1.13/bin/afni)
R : 1 (/usr/bin/R)
python : 2
/opt/aci/sw/python/3.6.3_anaconda-5.0.1/bin/python3.6
/usr/bin/python
python2 : 1 (/usr/bin/python)
python3 : 2
/opt/aci/sw/python/3.6.3_anaconda-5.0.1/bin/python3.6
/usr/bin/python3.4

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 : FAILURE

    oo Warning: 
       These packages are not installed on the computer: afex!
    These packages are not installed on the computer: phia!
    These packages are not installed on the computer: snow!
    These packages are not installed on the computer: lmerTest!
    These packages are not installed on the computer: paran!
    These packages are not installed on the computer: psych!
    These packages are not installed on the computer: brms!
    These packages are not installed on the computer: corrplot!
    These packages are not installed on the computer: metafor!

R RHOME : /usr/lib64/R

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

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

++ module loaded: matplotlib.pyplot
module file : /opt/aci/sw/python/3.6.3_anaconda-5.0.1/lib/python3.6/site-packages/matplotlib/pyplot.py

-------------------------------- env vars --------------------------------
PATH = storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/gpfs/group/dml129/default/sw/afni/20.1.13/bin:/opt/aci/sw/python/3.6.3_anaconda-5.0.1/scripts:/opt/aci/sw/python/3.6.3_anaconda-5.0.1/bin:/usr/local/bin:/usr/local/sbin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/usr/local/bin:/usr/local/sbin:/usr/local/moab/bin:/usr/local/bin:/usr/local/sbin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/usr/local/bin:/usr/local/sbin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/usr/local/bin:/usr/local/sbin:/opt/TurboVNC/bin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/usr/local/bin:/usr/local/sbin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:storage/home/cfg2/.local/bin:/gpfs/group/cfg2/default/sw/freesurfer/bin:/gpfs/group/cfg2/default/sw/freesurfer/fsfast/bin:/gpfs/group/cfg2/default/sw/freesurfer/tktools:/gpfs/group/cfg2/default/sw/freesurfer/mni/bin:/usr/lpp/mmfs/bin:/usr/local/bin:/usr/local/sbin:/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/opt/puppetlabs/bin:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/storage/home/cfg2/bin:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/opt/puppetlabs/bin:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab:/storage/work/cfg2/dcm2niix/build/bin:/storage/work/cfg2/r_packages:/storage/home/cfg2/work/chuck_scripts:/gpfs/group/cfg2/default/projects/ahab

PYTHONPATH = /opt/aci/sw/python/3.6.3_anaconda-5.0.1/lib

R_LIBS =
LD_LIBRARY_PATH = /opt/aci/sw/python/3.6.3_anaconda-5.0.1/lib

DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

------------------------------ 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 /gpfs/group/dml129/default/sw/afni/20.1.13/bin

------------------------------ OS specific -------------------------------
which yum : /usr/bin/yum
yum version : 3.2.29

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • have python version 3.6.3, some programs need 2.7.x
  • missing R packages (see rPkgsInstall)
  • please run: cp /gpfs/group/dml129/default/sw/afni/20.1.13/bin/AFNI.afnirc ~/.afnirc
  • please run: “suma -update_env” for .sumarc
  • please run: apsearch -update_all_afni_help
  • insufficient data for AFNI bootcamp

Hi, Chuck-

OK, from the error message in Part 1, it seems your OS is missing an AFNI dependency, listed here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_linux_Fed_RH.html#install-prerequisite-packages

Could you please run:


sudo yum update

and then you might as well run all of these, to make sure that nothing else is missing:


sudo yum install -y epel-release
sudo yum install -y tcsh libXp openmotif gsl xorg-x11-fonts-misc       \
                    PyQt4 R-devel netpbm-progs gnome-tweak-tool ed     \
                    libpng12 xorg-x11-server-Xvfb firefox
sudo yum update -y

(You have Red Hat v6 there, hopefully these all work.) Though, I am guessing given the PATH that you might be running on an administered system? If so, it would be nice to run that set of dependencies, but if someone balks at all of those, I would try the smaller set here:


sudo yum install -y  netpbm-progs libpng12 xorg-x11-server-Xvfb

You can try that test @chauffeur_afni command again, and that should work.

In the meantime, I note that that Xvfb error message is “just” about making the automatic QC images; if you still want to run the code without an error message before the Xvfb dependencies get fixed, you can add this option to your command “-no_qc_image”, but then you just have to verify that things have gone right in the GUI yourself.

Also, from the bottom section of the afni_system_check output, you can/should probably also run the following (none of which requires sudo/admin privileges, so you should be able to run them OK yourself on any system):


cp /gpfs/group/dml129/default/sw/afni/20.1.13/bin/AFNI.afnirc ~/.afnirc
suma -update_env
apsearch -update_all_afni_help

–pt