AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
January 15, 2020 06:21PM
Hi, Clément-

OK, I have looked at the data and I have a few thoughts:
+ the original coordinates are a bit odd-- while the anatomical and EPI overlay each other, the (x, y, z) = (0, 0, 0) location is far outside the brain; this can affect some alignment issues.
+ the EPI has fairly low contrast (not a lot of details easily seen).
+ both datasets were acquired with oblique coordinates.

So, my thoughts on this:
+ purge the obliquity information, rather than applying it for alignment, because for the anatomical-template alignment, applying the obliquity information will introduce a larger relative rotation to the template brain. Once we purge the anatomical obliquity info, then we should do the same to the EPI (so there isn't a relative rotation introduced).
+ we should put have (0, 0, 0) of each dset be somewhere in the brain-- mainly to help the anatomical-template alignment.
+ align_epi_anat.py will try to remove the skull of both the anatomical and the EPI by default; after @animal_warper, we will have a skullstripped version of the anatomical, so we should tell align_epi_anat.py that "-anat_has_skull no"; for this EPI, align_epi_anat.py tended to remove a lot of actual brain if it tried to remove the skull (I think because of the general lack of contrast); therefore, one can either not remove the skull of the EPI, or tell it to use "3dAutomask" to do so, via "-epi_strip 3dAutomask".

Note that when I ran/tested this here, I just used the first 5 time points or so from the EPI time series, for the sake of speed of running.
#!/bin/tcsh

set dset_anat = anatT1.nii.gz
set dset_bold = BOLD_restingstate.nii.gz

set dset_anat_deob = a00_deob.nii
set dset_anat_ss   = a01_ss.nii

set dset_bold_deob = e00_deob.nii

set refvol = template/NMT_SS.nii.gz
set refatl = template/D99_atlas_1.2a_al2NMT.nii.gz
set aw_dir = s01_anwarp

# ==========================================================================

# copy and get rid of obliquity info of anatomical
3dcopy                                \
    ${dset_anat}                      \
    ${dset_anat_deob}

3drefit                               \
    -deoblique                        \
    ${dset_anat_deob}

# ------------------- for center of mass of anatomical
# this should be good enough to center mass around 0 0 0 for template
# alignment
3dSkullStrip                          \
    -prefix    ${dset_anat_ss}        \
    -input     ${dset_anat_deob}      \
    -blur_fwhm 2                      \
    -orig_vol

3dCM                                   \
    -set 0 0 0                         \
    ${dset_anat_ss}

3drefit                                \
    -duporigin ${dset_anat_ss}         \
    ${dset_anat_deob}


# --------------------- for obliquity and center of mass of EPI

3dcalc \
    -a       ${dset_bold}        \
    -expr    'a'                         \
    -prefix  ${dset_bold_deob}

# purge obliquity info, and apply shifts so BOLD dset overlays anat dset well
3drefit                               \
    -deoblique                        \
    ${dset_bold_deob}

3dCM                                  \
    -set 0 0 0                        \
    ${dset_bold_deob}

# ---------------------------------- run main prog for nonlinear warp + skullstripping

@animal_warper                          \
    -input  ${dset_anat_deob}           \
    -base   ${refvol}                   \
    -atlas  ${refatl}                   \
    -outdir ${aw_dir}                   \
    -ok_to_exist


# -----------------------------------------------------------------

# use skullstripped anatomical in orig space (and don't skullstrip it again!);  either use 3dAutomask to skullstrip EPI, or do none at all; results are quite similar:

align_epi_anat.py                         \
    -epi2anat                             \
    -epi ${dset_bold_deob}                \
    -anat ${aw_dir}/a00_deob_ns.nii.gz    \
    -anat_has_skull no \
    -epi_strip 3dAutomask \
    -epi_base 0 -volreg off -tshift off   \
    -suffix TRY5                          \
    -cost lpc+ZZ

align_epi_anat.py                         \
    -epi2anat                             \
    -epi ${dset_bold_deob}                \
    -anat ${aw_dir}/a00_deob_ns.nii.gz    \
    -anat_has_skull no \
    -epi_strip None \
    -epi_base 0 -volreg off -tshift off   \
    -suffix TRY6                          \
    -cost lpc+ZZ

echo "++ Done with aligning anatomical with template"

To provide the same kind of info used in the align_epi_anat.py commands to afni_proc.py, you would use something like the following (exact paths and file names might be different):
-copy_anat      ${aw_dir}/a00_deob_ns.nii.gz        \
-anat_has_skull no                                         \
...
-align_opts_aea                                            \
-cost lpc+ZZ                  \
-epi_strip None            \
... or the same iwth "-epi_strip 3dAutomask", instead.

Happy to answer any followup questions.

--pt
Subject Author Posted

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 03, 2020 05:38PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Daniel Glen January 03, 2020 05:58PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 07, 2020 05:48PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 08, 2020 09:46AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 08, 2020 11:21AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 08, 2020 12:09PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 08, 2020 12:35PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 08, 2020 01:03PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 08, 2020 12:37PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 08, 2020 11:47AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 08, 2020 12:10PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 08, 2020 12:38PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Daniel Glen January 08, 2020 06:30PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 09, 2020 09:37AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 09, 2020 09:54AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 09, 2020 11:22AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 09, 2020 12:00PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 09, 2020 12:06PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 09, 2020 12:27PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 15, 2020 06:21PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 21, 2020 05:49PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 21, 2020 10:56PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 22, 2020 10:14AM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 22, 2020 06:03PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys January 22, 2020 06:33PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

ptaylor January 22, 2020 06:46PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys February 13, 2020 01:15PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Doughboys May 21, 2020 09:27PM

Re: can't malloc -1437173116 bytes in 3dNwarpApply

Daniel Glen May 25, 2020 11:35PM