distortion and rotation of anat_final

Dear colleagues,

I would appreciate any advice on how to fix wrong anatomical image after skull stripping or alignment (I am not share what causes such distortion and rotation). The initial anatomical and fMRI images are Ok. However, after alignment final_anat becomes distorted and rotated. This is the only subject out of 60 that has such a problem.

The script I implemented:

afni_proc.py -subj_id $subj
-script proc.$subj -scr_overwrite
-blocks despike tshift align tlrc volreg
blur mask scale regress
-copy_anat anat_dir/{subj}_T1w.nii.gz
-dsets
epi_dir/{subj}_task-pmt_run-01_bold.nii.gz
epi_dir/{subj}_task-pmt_run-02_bold.nii.gz
epi_dir/{subj}_task-pmt_run-03_bold.nii.gz
-tcat_remove_first_trs 0
-align_opts_aea -cost lpc+ZZ -giant_move -check_flip
-tlrc_base MNI_avg152T1+tlrc
-tlrc_opts_at -init_xform AUTO_CENTER
-volreg_align_to MIN_OUTLIER
-volreg_align_e2a
-volreg_tlrc_warp
-blur_size 8.0
-regress_stim_times
$epi_dir/cross.1D
$epi_dir/ADD1.1D
…….
$epi_dir/CON3.1D
-regress_stim_labels
cross ADD1……CON3
-regress_stim_types AM1
-regress_basis_multi dmBLOCK
-regress_motion_per_run
-regress_censor_motion 0.5
-regress_censor_outliers 0.1
-regress_compute_fitts
-regress_opts_3dD -jobs 2 -num_glt 30
-gltsym ‘SYM: ADD1 -cross’ -glt_label 1 ADD1-cross
……
-gltsym ‘SYM: CON2 -CON3’ -glt_label 30 CON3-CON3
-regress_3dD_stop
-regress_reml_exec
-regress_make_ideal_sum sum_ideal.1D
-regress_est_blur_epits
-regress_est_blur_errts
-regress_run_clustsim no
-html_review_style pythonic

Thank you in advance!

Sincerely,
Asya Istomina

Hi, Asya-

In your output “results” directory from afni_proc.py, there should be a “QC_${subj}” directory, which contains the afni_proc.py quality control (APQC) HTML.

Can you go into that results directory, and type:


afni_open -b QC_*/index.html

… to open the APQC HTML in your default web browser (or you can open that file in any browser you want).

Can you check the EPI-to-anatomical alignment in the “ve2a” block, and the anatomical-to-template alignment in “va2t”? Please let us know if whether each of those resulting alignment steps looks good or poor? I am guessing if “-tlrc_opts_at -init_xform AUTO_CENTER” was required that the va2t alignment might have failed. Is the anatomical oblique? (What is the output of “3dinfo -obliquity DSET_ANAT”?)

If the EPI-to-anatomical alignment does not look good, could you please check out the image of initial EPI-anatomical overlap image that shoudl be in the top “vorig” block—is there good overlap between the initial EPI-anatomical?

thanks,
pt

Hi, ptaylor!

Thank you for the answer!

I work on macOs 11.5.2 version. That’s why Quality check does not include neuroimaging, only plates and graphs, which is why I uploaded them directly.

va2t it definitely looks poor.
ve2a
vorig

However, I received a system warning in vorig: “The underlay/overlay pair of datasets (vr_base_min_outlier/X/jpg) have oblique angle difference of 4.015760 degrees. This may cause them to appear out of alignment in the viewer”.

I would be glad if you have a look.

Thanks in advance!

Hi, Asya-

You should be able to have the quality control HTML on any system. Can you please provide the output of:


afni_system_check.py -check_all

?

If I understand the images you have posted correctly, it looks like the anatomical dataset has the wrong header information: in what should be axial slices, the dataset looks like a rotated sagittal view. Is that what it looks like before any processing?

Re. the obliquity warning—I think this is just a warning here; 4 degrees of obliquity should be a small amount.

Having the QC HTML would resolve some of these questions, I think, because it would show the initial EPI, anatomical and their overlay.

-pt

Hi, -pt,

thank you for your answer!

The anatomical image of T1 before preprocessing looks normal, as does that of the other 59 participants.
I attach the output and the archive with the “index.html” here:

https://dropmefiles.com/pWwfa

R RHOME : /Library/Frameworks/R.framework/Resources

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 : /opt/anaconda3/lib/python3.8/site-packages/matplotlib/pyplot.py

– python binaries under /usr/local/bin:
/usr/local/bin/python3 (sym link to /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9)
/usr/local/bin/python3.6 (sym link to /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6)
/usr/local/bin/python3.9 (sym link to /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9)

-------------------------------- env vars --------------------------------
PATH = /opt/anaconda3/bin:/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/asyafgcs.ru/abin

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace:/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/asyafgcs.ru/abin

------------------------------ OS specific -------------------------------
** failed to parse X version string, ‘(null)’
** for macos install instructions, see:

https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html

XQuartz version : (null)

** no package manager found (okay for bootcamp)
++ 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 ‘bash’…
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace
– recent OS X, cheating to check DYLD_LIBRARY_PATH in shell ‘tcsh’…
** env var DYLD_LIBRARY_PATH not set to contain /opt/X11/lib/flat_namespace

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

  • just be aware: login shell ‘bash’, but our code examples use ‘tcsh’
  • shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
  • insufficient data for AFNI bootcamp
  • strange XQuartz version: (null)
  • please set DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace in tcsh

(base) asyafgcsrus-MacBook-Pro:~ asyafgcs.ru$

Thank you in advance!

Hi-

Is that the full “afni_system_check.py -check_all” output? There should be a lot more information at the start. I can see that you are using a Mac, but I can’t see what version. There are notable issues with not having XQuartz.

I think you should check the installation items for your Mac OS version here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/index.html
to make sure they are satisfactorially completed. This copy+paste item appears necessary to still be done:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html#setup-mac-env-variables
… and probably installing XQuartz, which is described here for Mac OS 10.*:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html#setup-terminal

Can you please run those, and report back with the system check output?

thanks,
pt

Hi, ptaylor!

Thank you for quick answer!
As a result, we solved the problem by re-slicing the RAW data from the scanner. After that preprocessing was carried out correctly.