Alignment problem with afni_proc.py

Hello,

There is an alignment issue with preprocessing of fMRI data using afni_proc.py and I don’t know how to fix it. I didn’t get any warning or error message but when visually examine the images, I found that after volreg block, the epi data is clearly not correctly aligned to anatomical image.

The “align_epi_anat.py -anat P05_2_t1+orig -epi P05_vwfa_1+orig -epi_base 0 -giant_move -epi2anat” gives the same alignment results. Following is the output:

#++ align_epi_anat version: 1.58
#Script is running (command trimmed):
3dAttribute DELTA ./P05_vwfa_1+orig
#Script is running (command trimmed):
3dAttribute DELTA ./P05_vwfa_1+orig
#Script is running (command trimmed):
3dAttribute DELTA ./P05_2_t1+orig
#++ Multi-cost is lpc
#++ Removing all the temporary files
#Script is running:
\rm -f ./__tt_P05_vwfa_1*
#Script is running:
\rm -f ./__tt_P05_2_t1*
#Script is running (command trimmed):
3dcopy ./P05_2_t1+orig ./__tt_P05_2_t1+orig
++ 3dcopy: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
#++ Removing skull from anat data
#Script is running (command trimmed):
3dSkullStrip -orig_vol -input ./__tt_P05_2_t1+orig -prefix ./__tt_P05_2_t1_ns
#Script is running (command trimmed):
3dinfo ./__tt_P05_2_t1_ns+orig | \grep ‘Data Axes Tilt:’|\grep ‘Oblique’
#++ Dataset /Volumes/PatientReadingMRI/FischerBaum_PatientRSA/orig/P05_VWFA/__tt_P05_2_t1_ns+orig is not oblique
#Script is running (command trimmed):
3dinfo ./P05_vwfa_1+orig | \grep ‘Data Axes Tilt:’|\grep ‘Oblique’
#++ Dataset /Volumes/PatientReadingMRI/FischerBaum_PatientRSA/orig/P05_VWFA/P05_vwfa_1+orig is not oblique
#Script is running (command trimmed):
3dAttribute TAXIS_OFFSETS ./P05_vwfa_1+orig
#++ Correcting for slice timing
#Script is running (command trimmed):
3dTshift -prefix ./__tt_P05_vwfa_1_tsh -cubic ./P05_vwfa_1+orig
++ 3dTshift: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
#++ Volume registration for epi data
#Script is running (command trimmed):
3dvolreg -1Dfile ./P05_vwfa_1_tsh_vr_motion.1D -1Dmatrix_save ./__tt_P05_vwfa_1_tsh_vr_mat.aff12.1D -prefix ./__tt_P05_vwfa_1_tsh_vr -base 0 -cubic ./__tt_P05_vwfa_1_tsh+orig
++ 3dvolreg: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
++ Authored by: RW Cox
++ Max displacement in automask = 0.29 (mm) at sub-brick 111
++ Max delta displ in automask = 0.12 (mm) at sub-brick 20
#++ Creating representative epi sub-brick
#Script is running (command trimmed):
3dbucket -prefix ./__tt_P05_vwfa_1_tsh_vr_ts ./__tt_P05_vwfa_1_tsh_vr+orig’[0]’
++ 3dbucket: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
#++ removing skull or area outside brain
#Script is running (command trimmed):
3dSkullStrip -orig_vol -input ./__tt_P05_vwfa_1_tsh_vr_ts+orig -prefix ./__tt_P05_vwfa_1_tsh_vr_ts_ns
#++ Computing weight mask
#Script is running (command trimmed):
3dBrickStat -automask -percentile 90.000000 1 90.000000 ./__tt_P05_vwfa_1_tsh_vr_ts_ns+orig
#++ Applying threshold of 1274.000000 on /Volumes/PatientReadingMRI/FischerBaum_PatientRSA/orig/P05_VWFA/__tt_P05_vwfa_1_tsh_vr_ts_ns+orig
#Script is running (command trimmed):
3dcalc -datum float -prefix ./__tt_P05_vwfa_1_tsh_vr_ts_ns_wt -a ./__tt_P05_vwfa_1_tsh_vr_ts_ns+orig -expr ‘min(1,(a/1274.000000))’
++ 3dcalc: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
++ Authored by: A cast of thousands
++ Output dataset ././__tt_P05_vwfa_1_tsh_vr_ts_ns_wt+orig.BRIK
#++ Aligning anat data to epi data
#Script is running (command trimmed):
3dAllineate -lpc -wtprefix ./__tt_P05_2_t1_ns_al_wtal -weight ./__tt_P05_vwfa_1_tsh_vr_ts_ns_wt+orig -source ./__tt_P05_2_t1_ns+orig -prefix ./__tt_P05_2_t1_al -base ./__tt_P05_vwfa_1_tsh_vr_ts_ns+orig -cmass -1Dmatrix_save ./P05_2_t1_al_mat.aff12.1D -master BASE -mast_dxyz 0.976562 -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -twobest 11 -twopass -VERB -maxrot 45 -maxshf 40 -fineblur 1 -source_automask+2
++ 3dAllineate: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
++ Authored by: Zhark the Registrator
++ Source dataset: ./__tt_P05_2_t1_ns+orig.HEAD
++ Base dataset: ./__tt_P05_vwfa_1_tsh_vr_ts_ns+orig.HEAD
++ Loading datasets
++ 1625226 voxels in -source_automask+2
++ Zero-pad: ybot=12 ytop=10
++ Zero-pad: zbot=16 ztop=14
++ 214271 voxels [14.9%] in weight mask
++ Output dataset ./__tt_P05_2_t1_ns_al_wtal+orig.BRIK
++ Number of points for matching = 214271
++ NOTE: base and source coordinate systems have different handedness

  •   Orientations: base=Right handed (RAI); source=Left handed (ASR)
    
  • - It is nothing to worry about: 3dAllineate aligns based on coordinates.
    
  • - But it is always important to check the alignment visually to be sure.
    

++ Local correlation: blok type = ‘RHDD(7.38)’
++ base center of mass = 65.499 68.146 40.939 (index)

  • source center of mass = 137.546 122.640 95.330 (index)
  • source-target CM = -2.418 15.720 -8.544 (xyz)
  • center of mass shifts = -2.418 15.720 -8.544
    ++ shift param auto-range: -63.6…58.7 -56.0…87.5 -79.8…62.7
  • Range param#4 [z-angle] = -6.000000 … 6.000000
  • Range param#5 [x-angle] = -6.000000 … 6.000000
  • Range param#6 [y-angle] = -6.000000 … 6.000000
  • Range param#1 [x-shift] = -12.417618 … 7.582382
  • Range param#2 [y-shift] = 5.719864 … 25.719864
  • Range param#3 [z-shift] = -18.544090 … 1.455910
  • Range param#4 [z-angle] = -45.000000 … 45.000000
  • Range param#5 [x-angle] = -45.000000 … 45.000000
  • Range param#6 [y-angle] = -45.000000 … 45.000000
  • Range param#1 [x-shift] = -42.417618 … 37.582382
  • Range param#2 [y-shift] = -24.280136 … 55.719864
  • Range param#3 [z-shift] = -48.544090 … 31.455910
  • 12 free parameters
    ++ Normalized convergence radius = 0.0000089
    ++ changing output grid spacing to 0.9766 mm
    ++ OpenMP thread count = 4
    ++ ======= Allineation of 1 sub-bricks using Local Pearson Correlation Signed =======
  • source mask has 1625226 [out of 12582912] voxels
  • base mask has 243567 [out of 1440000] voxels
    ++ ========== sub-brick #0 ========== [total CPU to here=3.4 s]
    ++ *** Coarse pass begins ***
    • Enter alignment setup routine
    • copying base image
    • copying source image
    • Smoothing base; radius=3.00
    • Smoothing source; radius=3.00
  • !source mask fill: ubot=0 usiz=267.5
    • copying weight image
    • using 98765 points from base image [use_all=0]
    • Exit alignment setup routine
    • Search for coarse starting parameters
  • 88762 total points stored in 1312 ‘RHDD(7.96645)’ bloks
    • number of free params = 6
    • Test (64+61)*64 params [top5=o±.]:#[#1=-0.0135179] o[#3=-0.0169718] -…[#10=-0.0273781] o.+±[#131=-0.032992] -.±.+o++.-[#1155=-0.0396421] .[#3628=-0.0411247] ++$[#4490=-0.0452505] *o…
    • best 45 costs found:
      0 v=-0.045251: -14.02 20.28 -4.65 -24.53 29.49 26.10 [rand]
      1 v=-0.043390: -14.02 11.16 -4.65 -24.53 29.49 26.10 [rand]
      2 v=-0.041125: -15.75 2.39 4.79 -30.00 30.00 -30.00 [grid]
      3 v=-0.039642: 10.92 -10.95 4.79 15.00 30.00 15.00 [grid]
      4 v=-0.038775: -6.50 21.95 -0.75 -4.32 22.85 18.95 [rand]
      5 v=-0.037162: -24.74 -13.91 -1.55 -8.73 38.75 -33.73 [rand]
      6 v=-0.036055: -14.02 11.16 -12.44 -24.53 29.49 26.10 [rand]
      7 v=-0.035914: 9.18 20.28 -12.44 24.53 29.49 -26.10 [rand]
      8 v=-0.034816: -6.50 9.49 -0.75 -4.32 22.85 18.95 [rand]
      9 v=-0.034808: 24.25 42.39 -35.21 -30.00 30.00 -30.00 [grid]
      10 v=-0.034664: 24.25 29.05 -21.88 -30.00 30.00 -30.00 [grid]
      11 v=-0.034424: 1.66 9.49 -0.75 4.32 22.85 18.95 [rand]
      12 v=-0.033785: 1.66 21.95 -0.75 4.32 22.85 18.95 [rand]
      13 v=-0.033208: 28.97 45.68 -12.95 -42.54 -9.20 -25.31 [rand]
      14 v=-0.032992: 10.92 -10.95 4.79 15.00 15.00 15.00 [grid]
      15 v=-0.032827: 11.00 -6.97 22.79 4.37 -20.12 -15.12 [rand]
      16 v=-0.032718: -15.75 2.39 18.12 -15.00 -15.00 15.00 [grid]
      17 v=-0.032241: 12.87 -5.17 21.85 14.56 -29.40 -15.92 [rand]
      18 v=-0.032012: -15.75 -10.95 18.12 -15.00 -15.00 15.00 [grid]
      19 v=-0.031864: 24.25 42.39 -35.21 -30.00 15.00 -30.00 [grid]
      20 v=-0.031721: -18.56 6.25 15.81 -20.99 15.73 16.09 [rand]
      21 v=-0.031403: -26.77 -13.97 4.48 -28.68 38.91 -32.36 [rand]
      22 v=-0.031373: 10.92 29.05 4.79 15.00 30.00 15.00 [grid]
      23 v=-0.031365: 1.66 21.95 -0.75 4.32 22.85 -18.95 [rand]
      24 v=-0.031262: 10.92 2.39 -21.88 -15.00 30.00 30.00 [grid]
      25 v=-0.031121: -15.75 -10.95 18.12 -15.00 -30.00 15.00 [grid]
      26 v=-0.030997: -18.56 6.25 15.81 -20.99 15.73 -16.09 [rand]
      27 v=-0.030917: 19.90 -13.91 -1.55 8.73 38.75 33.73 [rand]
      28 v=-0.030900: -14.02 20.28 -4.65 24.53 29.49 26.10 [rand]
      29 v=-0.030745: 32.45 46.27 -24.32 -11.68 29.04 -39.38 [rand]
      30 v=-0.030671: -14.02 20.28 -12.44 -24.53 29.49 26.10 [rand]
      31 v=-0.030353: 13.73 6.25 15.81 20.99 15.73 16.09 [rand]
      32 v=-0.030296: 11.61 0.00 6.12 24.25 37.55 4.41 [rand]
      33 v=-0.030214: -6.50 9.49 -0.75 4.32 22.85 -18.95 [rand]
      34 v=-0.030064: 10.92 -10.95 18.12 15.00 -30.00 -15.00 [grid]
      35 v=-0.030029: 10.92 -10.95 18.12 15.00 -15.00 15.00 [grid]
      36 v=-0.029969: 32.45 -14.83 7.23 -11.68 29.04 -39.38 [rand]
      37 v=-0.029882: -39.22 48.81 -28.74 39.82 23.12 9.72 [rand]
      38 v=-0.029564: 1.66 9.49 -0.75 -4.32 22.85 18.95 [rand]
      39 v=-0.029416: 10.92 42.39 4.79 15.00 30.00 15.00 [grid]
      40 v=-0.029388: 24.25 42.39 4.79 -30.00 15.00 -30.00 [grid]
      41 v=-0.029384: -15.75 2.39 4.79 -30.00 15.00 30.00 [grid]
      42 v=-0.029250: -6.50 9.49 -0.75 4.32 22.85 18.95 [rand]
      43 v=-0.029233: -15.75 -10.95 4.79 -15.00 -15.00 30.00 [grid]
      44 v=-0.029180: -21.91 32.39 -5.94 -30.54 19.59 20.03 [rand]
    • A little optimization:*[#8005=-0.0533862] *[#8012=-0.0540303] [#8018=-0.0541096] …[#8121=-0.0557016] *[#8125=-0.0563337] [#8129=-0.0564603] …[#8945=-0.0573645] *[#8956=-0.05757] …
    • costs of the above after a little optimization:
      0 v=-0.054110: -13.99 20.72 -4.96 -19.71 29.29 25.98 [rand]
      1 v=-0.053381: -14.18 14.61 -4.76 -24.42 29.35 25.58 [rand]
      2 v=-0.050748: -16.64 2.81 5.03 -30.23 33.93 -29.00 [grid]
      3 v=-0.040017: 11.14 -11.13 4.38 14.83 30.01 14.92 [grid]
      4 v=-0.056460: -6.70 21.57 -1.29 -3.95 26.10 19.51 [rand]
      5 v=-0.047045: -22.28 -13.37 -0.41 -8.12 38.30 -30.94 [rand]
      6 v=-0.044907: -13.47 6.19 -13.61 -23.97 30.09 24.93 [rand]
      7 v=-0.048707: 4.74 20.51 -13.68 23.36 29.29 -27.78 [rand]
      8 v=-0.047900: -7.09 13.44 -1.02 -2.10 22.91 19.01 [rand]
      9 v=-0.038326: 24.02 38.62 -35.51 -30.00 29.66 -30.16 [grid]
      10 v=-0.035157: 24.25 25.12 -21.86 -29.78 30.26 -30.28 [grid]
      11 v=-0.054864: -3.32 10.96 -0.54 2.18 22.48 17.92 [rand]
      12 v=-0.045747: 1.55 21.87 -1.92 6.34 30.22 17.25 [rand]
      13 v=-0.042513: 32.55 44.43 -12.82 -42.93 -10.10 -25.19 [rand]
      14 v=-0.039537: 11.19 -11.60 4.55 19.14 14.37 14.30 [grid]
      15 v=-0.043267: 9.74 -3.30 25.47 3.77 -20.98 -12.14 [rand]
      16 v=-0.048370: -16.62 -0.51 16.99 -13.69 -14.55 13.82 [grid]
      17 v=-0.046601: 13.53 -9.16 21.48 14.90 -30.04 -14.74 [rand]
      18 v=-0.040405: -19.15 -9.86 18.80 -14.58 -15.14 15.48 [grid]
      19 v=-0.047657: 23.90 52.17 -34.22 -33.07 12.76 -32.94 [grid]
      20 v=-0.047672: -19.26 9.75 10.90 -20.39 14.67 14.52 [rand]
      21 v=-0.037578: -26.96 -12.88 3.49 -27.55 43.49 -32.41 [rand]
      22 v=-0.038698: 10.81 34.00 5.97 15.96 30.94 16.48 [grid]
      23 v=-0.044498: 2.99 19.00 -1.86 6.19 24.38 -17.19 [rand]
      24 v=-0.040177: 13.97 0.63 -20.54 -14.24 30.96 29.44 [grid]
      25 v=-0.049061: -15.54 -11.96 24.00 -14.19 -31.04 14.42 [grid]
      26 v=-0.033165: -14.47 6.13 16.08 -21.35 15.06 -16.04 [rand]
      27 v=-0.035432: 20.61 -10.53 -1.41 8.60 38.22 33.46 [rand]
      28 v=-0.037227: -14.33 20.95 -4.81 24.56 29.57 30.50 [rand]
      29 v=-0.036375: 31.62 45.51 -24.30 -13.13 25.22 -41.69 [rand]
      *30 v=-0.057570: -11.77 19.08 -9.33 -21.84 33.82 32.48 [rand]
      31 v=-0.036822: 13.74 7.48 14.86 20.87 16.11 21.05 [rand]
      32 v=-0.036050: 15.10 0.15 5.43 24.77 37.98 5.09 [rand]
      33 v=-0.045941: -6.48 9.78 0.17 2.14 22.10 -20.74 [rand]
      34 v=-0.040540: 11.38 -10.83 19.20 14.94 -30.00 -10.27 [grid]
      35 v=-0.041124: 11.76 -10.07 17.72 18.62 -14.34 13.85 [grid]
      36 v=-0.034122: 32.64 -10.38 6.76 -12.06 28.80 -39.05 [rand]
      37 v=-0.029933: -39.22 48.79 -28.71 40.20 22.89 9.74 [rand]
      38 v=-0.048851: -2.51 10.87 -0.92 -1.07 23.89 20.66 [rand]
      39 v=-0.041334: 10.85 36.61 4.03 17.30 30.37 12.84 [grid]
      40 v=-0.051590: 24.36 45.92 5.73 -32.28 14.13 -35.85 [grid]
      41 v=-0.036594: -16.60 3.07 10.35 -29.92 13.30 29.67 [grid]
      42 v=-0.057548: -2.46 10.92 -1.54 3.40 23.63 18.15 [rand]
      43 v=-0.042594: -15.42 -10.04 8.84 -19.60 -14.99 31.05 [grid]
      44 v=-0.042530: -22.22 30.13 -5.38 -29.92 23.76 19.94 [rand]
    • save #30 for twobest
    • save #42 for twobest
    • save # 4 for twobest
    • skip #11 for twobest: too close to set #42
    • save # 0 for twobest
    • save # 1 for twobest
    • save #40 for twobest
    • save # 2 for twobest
    • save #25 for twobest
    • skip #38 for twobest: too close to set #42
    • save # 7 for twobest
    • save #16 for twobest
    • skip # 8 for twobest: too close to set #11
    • save #20 for twobest
    • save #19 for twobest
    • save # 5 for twobest
    • save #17 for twobest
    • save #33 for twobest
    • save #12 for twobest
    • save # 6 for twobest
    • save #23 for twobest
    • save #15 for twobest
    • save #43 for twobest
    • save #44 for twobest
    • save #13 for twobest
    • Coarse startup search net CPU time = 74.5 s
      ++ Start refinement #1 on 12 coarse parameter sets
    • Enter alignment setup routine
    • Smoothing base; radius=2.33
    • Smoothing source; radius=2.33
  • !source mask fill: ubot=0 usiz=267.5
    • retaining old weight image
    • using 148147 points from base image [use_all=0]
    • Exit alignment setup routine
  • 134205 total points stored in 1459 ‘RHDD(7.74001)’ bloks
    • param set #1 has cost=-0.043121
  • – Parameters = -9.9694 19.6426 -12.0330 -21.8889 32.6208 31.6563 0.9988 0.9978 0.9972 -0.0006 -0.0013 -0.0008
    • param set #2 has cost=-0.041630
  • – Parameters = -2.5993 10.7355 -1.2286 3.5636 24.5090 18.1499 0.9985 0.9997 1.0160 0.0002 -0.0013 0.0004
    • param set #3 has cost=-0.051865
  • – Parameters = -4.9751 18.2290 -1.2610 -2.9689 28.3231 20.8112 0.9918 0.9936 0.9892 -0.0017 -0.0004 -0.0012
    • param set #4 has cost=-0.048052
  • – Parameters = -14.8404 20.6154 -4.7928 -17.6563 28.9977 24.0110 1.0179 1.0160 0.9798 0.0086 0.0028 0.0085
    • param set #5 has cost=-0.040196
  • – Parameters = -10.0658 12.6635 -4.5300 -25.3428 31.3415 25.2382 0.9942 0.9881 0.9921 0.0004 -0.0001 -0.0010
    • param set #6 has cost=-0.033409
  • – Parameters = 25.1326 45.8854 5.5569 -36.8977 14.0327 -36.2070 1.0020 0.9979 0.9976 0.0003 -0.0002 -0.0017
    • param set #7 has cost=-0.030861
  • – Parameters = -17.5032 2.4168 5.4143 -30.5263 33.5889 -28.2097 1.0183 0.9966 0.9991 0.0013 -0.0018 -0.0031
    • param set #8 has cost=-0.045340
  • – Parameters = -15.7492 -7.7707 23.4522 -13.5180 -30.9793 13.9098 1.0027 1.0045 1.0075 0.0011 -0.0006 -0.0004
    • param set #9 has cost=-0.042422
  • – Parameters = 2.2223 18.7067 -14.2616 22.0933 31.0277 -27.4179 1.0180 0.9973 1.0001 -0.0101 0.0025 -0.0045
    • param set #10 has cost=-0.046714
  • – Parameters = -17.1995 -0.0310 16.9801 -13.6789 -12.6963 13.0761 1.0091 1.0014 0.9985 0.0004 0.0098 0.0004
    • param set #11 has cost=-0.034054
  • – Parameters = -16.1730 10.0147 11.3248 -20.6098 14.6952 14.3819 0.9994 1.0003 0.9994 0.0007 -0.0009 -0.0012
    • param set #12 has cost=-0.007297
  • – Parameters = -6.7736 14.6889 -7.1094 4.8006 -5.0657 -5.9875 1.0062 0.9947 0.9994 -0.0072 -0.0103 0.0053
    • sorting parameter sets by cost
  • – scanning for distances from #1
  • — dist(#2,#1) = 0.163
  • — dist(#3,#1) = 0.456
  • — dist(#4,#1) = 0.659
  • — dist(#5,#1) = 0.21
  • — dist(#6,#1) = 0.536
  • — dist(#7,#1) = 0.0937
  • — dist(#8,#1) = 0.249
  • — dist(#9,#1) = 0.196
  • — dist(#10,#1) = 0.634
  • — dist(#11,#1) = 0.545
  • — dist(#12,#1) = 0.371
    ++ Start refinement #2 on 12 coarse parameter sets
    • Enter alignment setup routine
    • Smoothing base; radius=1.81
    • Smoothing source; radius=1.81
  • !source mask fill: ubot=0 usiz=267.5
    • retaining old weight image
    • using 214271 points from base image [use_all=2]
    • Exit alignment setup routine
  • 197716 total points stored in 1578 ‘RHDD(7.59978)’ bloks
    • param set #1 has cost=-0.033294
  • – Parameters = -3.8184 19.0032 -1.8176 -4.0699 27.9744 22.7102 0.9755 1.0045 0.9983 -0.0089 -0.0080 -0.0289
    • param set #2 has cost=-0.034206
  • – Parameters = -12.5026 18.3983 -4.3858 -18.4392 29.8676 23.9771 1.0178 1.0084 0.9788 0.0041 0.0006 0.0121
    • param set #3 has cost=-0.037990
  • – Parameters = -17.7464 -0.0225 17.7982 -13.9703 -12.2185 12.6734 1.0153 1.0076 0.9603 0.0096 0.0144 -0.0020
    • param set #4 has cost=-0.033718
  • – Parameters = -14.1873 -9.3466 23.4292 -12.5474 -31.2266 14.3433 0.9992 1.0115 1.0083 0.0042 -0.0020 0.0034
    • param set #5 has cost=-0.037089
  • – Parameters = -10.0067 19.4104 -10.9290 -21.1368 32.5227 31.0925 1.0011 0.9995 0.9946 -0.0044 -0.0030 0.0055
    • param set #6 has cost=-0.033284
  • – Parameters = 1.5649 18.8423 -15.0626 21.8053 30.2110 -28.0623 1.0216 0.9820 0.9908 -0.0120 -0.0082 0.0096
    • param set #7 has cost=-0.034455
  • – Parameters = -2.7269 10.7341 -1.0181 3.7795 24.2385 17.8604 0.9929 0.9984 1.0187 0.0025 -0.0032 0.0065
    • param set #8 has cost=-0.030560
  • – Parameters = -10.7979 12.1044 -4.5482 -26.5220 33.9561 25.3831 0.9922 0.9856 0.9922 0.0005 -0.0012 -0.0016
    • param set #9 has cost=-0.035608
  • – Parameters = -15.2296 11.9613 11.7811 -20.2914 15.0675 11.8668 0.9128 1.0058 0.8637 -0.0316 0.0120 -0.0443
    • param set #10 has cost=-0.026236
  • – Parameters = 27.5441 45.8854 5.5569 -36.8977 14.0327 -36.2070 1.0020 0.9979 0.9976 0.0003 -0.0002 -0.0017
    • param set #11 has cost=-0.026951
  • – Parameters = -20.4037 1.3127 5.2475 -30.0338 34.2486 -28.8468 1.0106 0.9986 1.0045 -0.0015 -0.0041 -0.0128
    • param set #12 has cost=-0.016754
  • – Parameters = -5.7663 16.2245 -7.0513 10.5477 -6.2983 -6.6435 0.9566 0.9625 0.9881 -0.0186 -0.0300 0.0019
    • sorting parameter sets by cost
  • – scanning for distances from #1
  • — dist(#2,#1) = 0.497
  • — dist(#3,#1) = 0.303
  • — dist(#4,#1) = 0.405
  • — dist(#5,#1) = 0.468
  • — dist(#6,#1) = 0.211
  • — dist(#7,#1) = 0.447
  • — dist(#8,#1) = 0.471
  • — dist(#9,#1) = 0.513
  • — dist(#10,#1) = 0.516
  • — dist(#11,#1) = 0.574
  • — dist(#12,#1) = 0.311
    ++ Start refinement #3 on 12 coarse parameter sets
    • Enter alignment setup routine
    • Smoothing base; radius=1.41
    • Smoothing source; radius=1.41
  • !source mask fill: ubot=0 usiz=267.5
    • retaining old weight image
    • using 214271 points from base image [use_all=2]
    • Exit alignment setup routine
  • 200029 total points stored in 1661 ‘RHDD(7.51369)’ bloks
    • param set #1 has cost=-0.031640
  • – Parameters = -17.4781 -1.1867 19.3804 -13.4607 -13.4822 11.6862 1.0165 1.0013 0.9584 0.0058 0.0219 -0.0017
    • param set #2 has cost=-0.032614
  • – Parameters = -9.6189 20.1433 -10.7745 -21.0669 32.1527 31.1101 1.0002 0.9993 1.0005 -0.0045 -0.0025 0.0065
    • param set #3 has cost=-0.030774
  • – Parameters = -14.9719 12.4497 11.9636 -20.6430 15.0753 12.3127 0.9272 1.0046 0.8628 -0.0323 0.0123 -0.0439
    • param set #4 has cost=-0.027454
  • – Parameters = -2.9902 11.1126 -1.3846 3.4951 23.9161 17.5728 0.9903 0.9960 1.0234 0.0058 -0.0026 0.0026
    • param set #5 has cost=-0.030288
  • – Parameters = -10.9560 17.9728 -3.7029 -18.2166 30.4516 24.3528 1.0144 1.0088 0.9684 0.0033 -0.0024 0.0096
    • param set #6 has cost=-0.030396
  • – Parameters = -14.2582 -9.5287 22.8284 -13.3167 -31.1844 13.2422 0.9987 1.0081 1.0047 0.0080 -0.0030 0.0049
    • param set #7 has cost=-0.025539
  • – Parameters = -3.5477 18.5784 -2.0867 -4.4372 28.1996 24.9459 0.9742 1.0035 0.9941 -0.0076 -0.0092 -0.0290
    • param set #8 has cost=-0.030909
  • – Parameters = 1.5149 19.2815 -15.3015 21.4615 30.6321 -27.9194 1.0607 0.9836 1.0197 -0.0168 0.0125 0.0376
    • param set #9 has cost=-0.023220
  • – Parameters = -11.2217 12.3240 -4.3522 -26.9986 33.7929 25.7639 0.9812 0.9869 0.9905 -0.0004 -0.0000 -0.0017
    • param set #10 has cost=-0.027451
  • – Parameters = -19.5986 0.5165 7.0534 -29.7898 35.0601 -30.5226 1.0057 1.0004 1.0004 -0.0010 -0.0047 -0.0143
    • param set #11 has cost=-0.022302
  • – Parameters = 27.5039 46.2583 5.5854 -36.6678 14.0445 -35.9381 1.0093 0.9978 0.9969 0.0007 -0.0005 -0.0014
    • param set #12 has cost=-0.014453
  • – Parameters = -3.5636 16.6200 -6.7698 11.2696 -7.3720 -7.1708 0.9519 0.9504 0.9833 -0.0168 -0.0511 -0.0239
    • sorting parameter sets by cost
  • – scanning for distances from #1
  • — dist(#2,#1) = 0.507
  • — dist(#3,#1) = 0.656
  • — dist(#4,#1) = 0.375
  • — dist(#5,#1) = 0.704
  • — dist(#6,#1) = 0.0884
  • — dist(#7,#1) = 0.273
  • — dist(#8,#1) = 0.685
  • — dist(#9,#1) = 0.185
  • — dist(#10,#1) = 0.0977
  • — dist(#11,#1) = 0.745
  • — dist(#12,#1) = 0.439
    • Total coarse refinement net CPU time = 42.5 s; 3151 funcs
      ++ *** Fine pass begins ***
    • Enter alignment setup routine
    • Smoothing base; radius=1.00
    • Smoothing source; radius=1.00
  • !source mask fill: ubot=0 usiz=267.5
    • retaining old weight image
    • Exit alignment setup routine
      ++ Picking best parameter set out of 13 cases
  • 204116 total points stored in 1791 ‘RHDD(7.44744)’ bloks
    • cost(#1)=-0.024551 *
  • – Parameters = -9.6189 20.1433 -10.7745 -21.0669 32.1527 31.1101 1.0002 0.9993 1.0005 -0.0045 -0.0025 0.0065
    • cost(#2)=-0.026364 *
  • – Parameters = -17.4781 -1.1867 19.3804 -13.4607 -13.4822 11.6862 1.0165 1.0013 0.9584 0.0058 0.0219 -0.0017
    • cost(#3)=-0.023197
  • – Parameters = 1.5149 19.2815 -15.3015 21.4615 30.6321 -27.9194 1.0607 0.9836 1.0197 -0.0168 0.0125 0.0376
    • cost(#4)=-0.025450
  • – Parameters = -14.9719 12.4497 11.9636 -20.6430 15.0753 12.3127 0.9272 1.0046 0.8628 -0.0323 0.0123 -0.0439
    • cost(#5)=-0.024396
  • – Parameters = -14.2582 -9.5287 22.8284 -13.3167 -31.1844 13.2422 0.9987 1.0081 1.0047 0.0080 -0.0030 0.0049
    • cost(#6)=-0.023482
  • – Parameters = -10.9560 17.9728 -3.7029 -18.2166 30.4516 24.3528 1.0144 1.0088 0.9684 0.0033 -0.0024 0.0096
    • cost(#7)=-0.024989
  • – Parameters = -2.9902 11.1126 -1.3846 3.4951 23.9161 17.5728 0.9903 0.9960 1.0234 0.0058 -0.0026 0.0026
    • cost(#8)=-0.022376
  • – Parameters = -19.5986 0.5165 7.0534 -29.7898 35.0601 -30.5226 1.0057 1.0004 1.0004 -0.0010 -0.0047 -0.0143
    • cost(#9)=-0.018711
  • – Parameters = -3.5477 18.5784 -2.0867 -4.4372 28.1996 24.9459 0.9742 1.0035 0.9941 -0.0076 -0.0092 -0.0290
    • cost(#10)=-0.016973
  • – Parameters = -11.2217 12.3240 -4.3522 -26.9986 33.7929 25.7639 0.9812 0.9869 0.9905 -0.0004 -0.0000 -0.0017
    • cost(#11)=-0.015961
  • – Parameters = 27.5039 46.2583 5.5854 -36.6678 14.0445 -35.9381 1.0093 0.9978 0.9969 0.0007 -0.0005 -0.0014
    • cost(#12)=-0.009028
  • – Parameters = -3.5636 16.6200 -6.7698 11.2696 -7.3720 -7.1708 0.9519 0.9504 0.9833 -0.0168 -0.0511 -0.0239
    • cost(#13)=0.023259
  • – Parameters = -2.4176 15.7199 -8.5441 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
  • -num_rtb 99 ==> refine all 13 cases
    • cost(#1)=-0.024896 *
  • – Parameters = -9.7829 20.0871 -10.7721 -21.2364 32.0925 31.1476 1.0014 0.9984 0.9995 -0.0045 0.0029 0.0070
    • cost(#2)=-0.030977 *
  • – Parameters = -17.7076 -1.4052 19.4125 -13.6137 -14.6140 11.6963 1.0083 1.0206 0.9361 0.0135 0.0675 0.0076
    • cost(#3)=-0.026791
  • – Parameters = 2.1642 19.3772 -15.7187 21.4927 31.1107 -27.5342 1.0991 0.9746 1.0169 -0.0087 0.0085 0.0325
    • cost(#4)=-0.028027
  • – Parameters = -15.7257 12.6563 12.6770 -19.9074 15.5180 13.2991 0.9345 1.0069 0.8630 -0.0325 0.0112 -0.0448
    • cost(#5)=-0.028490
  • – Parameters = -15.1690 -10.4450 22.7957 -14.1746 -31.0491 13.6641 1.0050 1.0107 1.0079 0.0308 -0.0038 0.0054
    • cost(#6)=-0.026533
  • – Parameters = -11.1656 18.4155 -2.7680 -20.0012 30.6984 25.1680 1.0111 1.0062 0.9707 0.0022 -0.0011 0.0106
    • cost(#7)=-0.028392
  • – Parameters = -3.8049 10.6419 -2.6452 3.0703 23.4652 17.5073 0.9908 0.9956 1.0249 0.0054 -0.0029 0.0022
    • cost(#8)=-0.025849
  • – Parameters = -19.3958 0.1670 7.2500 -29.5120 35.6962 -30.7729 1.0270 1.0067 0.9973 0.0028 -0.0075 -0.0136
    • cost(#9)=-0.023990
  • – Parameters = -1.3474 15.6812 -1.7815 -4.2001 28.6886 24.9509 0.9893 1.0032 0.9915 -0.0059 0.0034 -0.0280
    • cost(#10)=-0.020305
  • – Parameters = -11.5921 10.7530 -4.3842 -28.1283 33.3356 27.9673 0.9657 0.9730 0.9894 0.0045 -0.0054 0.0036
    • cost(#11)=-0.026108
  • – Parameters = 31.6014 49.9067 2.1083 -34.4208 13.1960 -36.4570 0.9953 0.9988 0.9756 -0.0087 0.0065 -0.0040
    • cost(#12)=-0.011078
  • – Parameters = -3.1561 16.7127 -5.6458 11.5729 -7.3110 -7.6079 0.9521 0.9517 0.9781 -0.0165 -0.0519 -0.0252
    • cost(#13)=-0.007627
  • – Parameters = -3.9526 19.2341 -6.1913 9.7916 -8.7999 -3.0997 0.9931 1.0095 1.0204 -0.0014 -0.0128 -0.0269
    • case #2 is now the best
    • Initial cost = -0.030977
    • Initial fine Parameters = -17.7076 -1.4052 19.4125 -13.6137 -14.6140 11.6963 1.0083 1.0206 0.9361 0.0135 0.0675 0.0076
    • Finalish cost = -0.032912 ; 820 funcs
    • Final cost = -0.032923 ; 412 funcs
  • Final fine fit Parameters:
    x-shift=-17.4384 y-shift= -0.5699 z-shift= 19.8901 … enorm= 26.4583 mm
    z-angle=-13.5306 x-angle=-14.3576 y-angle= 9.9125 … total= 22.7851 deg
    x-scale= 0.9993 y-scale= 1.0308 z-scale= 0.9282 … vol3D= 0.9562 = base bigger than source
    y/x-shear= 0.0053 z/x-shear= 0.0923 z/y-shear= 0.0146
    • Fine net CPU time = 35.7 s
      ++ Computing output image
      ++ image warp: parameters = -17.4384 -0.5699 19.8901 -13.5306 -14.3576 9.9125 0.9993 1.0308 0.9282 0.0053 0.0923 0.0146
      ++ Output dataset ./__tt_P05_2_t1_al+orig.BRIK
      ++ Wrote -1Dmatrix_save ./P05_2_t1_al_mat.aff12.1D
      ++ 3dAllineate: total CPU time = 157.2 sec Elapsed = 60.8
      ++ ###########################################################
      ++ # Please check results visually for alignment quality #
      ++ ###########################################################
      ++ # ‘-autoweight’ is recommended when using -lpc or -lpa #
      ++ # If your results are not good, please try again. #
      ++ ###########################################################
      #++ Applying alignment for epi to anat
      #++ Inverting anat to epi matrix
      #Script is running (command trimmed):
      cat_matvec -ONELINE ./P05_2_t1_al_mat.aff12.1D -I > ./P05_vwfa_1_al_mat.aff12.1D
      #++ Concatenating volreg and epi to anat transformations
      #Script is running (command trimmed):
      cat_matvec -ONELINE ./P05_2_t1_al_mat.aff12.1D -I ./__tt_P05_vwfa_1_tsh_vr_mat.aff12.1D > ./P05_vwfa_1_al_reg_mat.aff12.1D
      #++ Applying transformation of epi to anat
      #Script is running (command trimmed):
      3dAllineate -base ./P05_2_t1+orig -1Dmatrix_apply ./P05_vwfa_1_al_reg_mat.aff12.1D -prefix ././P05_vwfa_1_al -input ./__tt_P05_vwfa_1_tsh+orig -master BASE -mast_dxyz 1.500000 -weight_frac 1.0 -maxrot 6 -maxshf 10 -VERB -warp aff -source_automask+4 -twobest 11 -twopass -VERB -maxrot 45 -maxshf 40 -fineblur 1 -source_automask+2
      ++ 3dAllineate: AFNI version=AFNI_19.1.19 (Jun 13 2019) [64-bit]
      ++ Authored by: Zhark the Registrator
      ++ Source dataset: ./__tt_P05_vwfa_1_tsh+orig.HEAD
      ++ Base dataset: ./P05_2_t1+orig.HEAD
      ++ Loading datasets
      ++ NOTE: base and source coordinate systems have different handedness
  •   Orientations: base=Left handed (ASR); source=Right handed (RAI)
    
  • - It is nothing to worry about: 3dAllineate aligns based on coordinates.
    
  • - But it is always important to check the alignment visually to be sure.
    
  • Range param#4 [z-angle] = -6.000000 … 6.000000
  • Range param#5 [x-angle] = -6.000000 … 6.000000
  • Range param#6 [y-angle] = -6.000000 … 6.000000
  • Range param#1 [x-shift] = -10.000000 … 10.000000
  • Range param#2 [y-shift] = -10.000000 … 10.000000
  • Range param#3 [z-shift] = -10.000000 … 10.000000
  • Range param#4 [z-angle] = -45.000000 … 45.000000
  • Range param#5 [x-angle] = -45.000000 … 45.000000
  • Range param#6 [y-angle] = -45.000000 … 45.000000
  • Range param#1 [x-shift] = -40.000000 … 40.000000
  • Range param#2 [y-shift] = -40.000000 … 40.000000
  • Range param#3 [z-shift] = -40.000000 … 40.000000
    ++ changing output grid spacing to 1.5000 mm
    ++ OpenMP thread count = 4
    ++ ========== Applying transformation to 113 sub-bricks ==========
    ++ ========== sub-brick #0 ========== [total CPU to here=0.0 s]
    • Enter alignment setup routine
    • copying base image
    • copying source image
    • no weight image
    • using 11 points from base image [use_all=0]
    • Exit alignment setup routine
      ++ using -1Dmatrix_apply
      ++ Computing output image
      ++ image warp: parameters = 0.2164 -0.2419 0.9249 11.3952 0.9107 -0.2125 -0.2966 17.1153 -0.1278 -0.5140 -0.1302 76.0942
      ++ ========== sub-brick #1 ========== [total CPU to here=0.4 s]
    • Enter alignment setup routine
    • copying source image
    • no weight image
    • Exit alignment setup routine
      ++ using -1Dmatrix_apply
      ++ Computing output image
      ++ image warp: parameters = 0.2164 -0.2418 0.9249 11.3890 0.9107 -0.2123 -0.2966 17.0952 -0.1277 -0.5141 -0.1302 76.0968

      ++ ========== sub-brick #112 ========== [total CPU to here=34.9 s]
    • Enter alignment setup routine
    • copying source image
    • no weight image
    • Exit alignment setup routine
      ++ using -1Dmatrix_apply
      ++ Computing output image
      ++ image warp: parameters = 0.2163 -0.2416 0.9250 11.3641 0.9106 -0.2130 -0.2966 17.3162 -0.1280 -0.5140 -0.1300 76.1327
      ++ Output dataset ././P05_vwfa_1_al+orig.BRIK
      ++ 3dAllineate: total CPU time = 36.1 sec Elapsed = 29.1
      ++ ###########################################################
      #++ Creating final output: epi data aligned to anat

copy is not necessary - both paths are same

#++ Saving history
#Script is running (command trimmed):
3dNotes -h “align_epi_anat.py -anat P05_2_t1+orig -epi P05_vwfa_1+orig
-epi_base 0 -giant_move -epi2anat”
./P05_vwfa_1_al+orig

#++ Removing all the temporary files
#Script is running:
\rm -f ./__tt_P05_vwfa_1*
#Script is running:
\rm -f ./__tt_P05_2_t1*

Finished alignment successfully

Do you have any suggestion to fix the problem?
Thank you!

-Joy

Hi, Joy-

Thanks for posting the output. Indeed, alignment always requires visual checking; note that we have the automatic HTML output to help facilitate this process of checking, too; from your afni_proc.py results directory,


afni_open -b QC_*/index.html

should open the APQC (afni_proc.py quality control) HTML; if you have python+matplotlib installed on your computer, you can add “-html_review_style pythonic” to your afni_proc.py command, and get the prettiest/most informative version of QC.

… Now, to address your actual question:

  • could you please post the output of “afni -ver”
  • could you please post your afni_proc.py command, and
  • could you provide an image overlaying any of the EPI volumes on the anatomical before alignment (i.e., the raw volumes)?
    The third part will help us see how “far apart” the volumes are to start, which is typically the root of alignment evils. The second part will help us see any options you have provided about alignment already. And the first part will help us make sure we’re all using a similar/modern AFNI version.

–pt

output of afni -ver:
Precompiled binary macos_10.12_local: Jun 13 2019 (Version AFNI_19.1.19 ‘Caligula’)

my afni_proc.py command:
afni_proc.py
-subj_id P05
-script proc.P05.vwfa
-out_dir P05.VWFA.results
-dsets P05_vwfa_1+orig P05_vwfa_2+orig
-copy_anat P05_2_t1+orig
-blocks despike tshift align volreg blur mask scale regress
-tcat_remove_first_trs 5
-tshift_interp -Fourier
-volreg_align_to MIN_OUTLIER
-align_opts_aea
-giant_move
-volreg_align_e2a
-mask_apply anat
-regress_stim_times word.txt checkerboard.txt
-regress_local_times
-regress_stim_labels word checkerboard
-regress_basis ‘BLOCK(24,1)’
-regress_censor_motion 0.3
-regress_censor_outliers 0.1
-regress_apply_mot_types demean deriv
-regress_opts_3dD
-jobs 4
-gltsym ‘SYM: +word -checkerboard’
-glt_label 1 word_vs_checkerboard
-regress_run_clustsim no
-regress_est_blur_errts
-regress_est_blur_epits

image overlaying any of the EPI volumes on the anatomical before alignment
In the first image I attached in last post, the overlay is pb02.P05.r01.tshift and underlay is anatomical image. In second image the overlay is pb03.P05.r01.volreg. It seems to me that the epi was aligned better before carrying out alignment block.

Thanks a lot for your help!

an image overlaying any of the EPI volumes on the anatomical before alignment

Underlay: P05_2_t1+orig
Overlay: P05_vwfa_1

Hi, Joy-

Thanks for sending that info.

Your AFNI version is a bit old-- nearly a year old now-- so I would recommend updating:


@update.afni.binaries -d

There will have been lots of minor updates, additions, fixes and tweaks in that time. I don’t believe that that would necessary change anything here directly, but it would probably be useful for you.

Your datasets look very well aligned to start, so it is odd that they end up so far apart after. It is a little bit hard to see the tissue contrast clearly because of the color range, but I’ll assume it is mostly normal (if it isn’t standard EPI kind of tissue contrast–bright ventricles, dark WM–then using a different cost function could be useful, but that would be a somewhat rare case in human data). One thing you could do is leave out the giant_move part, because that is mainly for helping cases that start far apart, by removing this line:


-align_opts_aea -giant_move \

(from the align_epi_anat.py help:


-giant_move : even larger movement required - uses cmass, two passes and
                  very large angles and shifts. May miss finding the solution
                  in the vastness of space, so use with caution

)

One issue could be skullstripping; I see that you aren’t aligning your data to standard space, so perhaps you don’t want to use @SSwarper (which combines both skullstripping and nonlinear alignment to standard space), but you could use that program still perhaps with the “-skipwarp” option to save some time, to perform skullstripping—fair warning, it will be fairly slow, but if you are running on a multicore machine, you can use parallel threading to speed it up. Let me/us know if you are interested in that (but you can check how the skullstripping looks at present).

Another note: it looks like you are including the derivatives of motion in your regressors—that is typically a step for resting state processing, and I’m not sure you would want/need to do that for task data, such as you have. So, you might want to leave out:


-regress_apply_mot_types demean deriv \

here.

Also, if you have Python and matplotlib, then I would strongly recommend adding:


-html_review_style pythonic

in order to have the nicer QC HTML file output.

–pt

Thank you! I updated afni and removed the two lines you mentioned.The problem is solved.
I have another question. I applied the same afni_proc.py script for other patients and they all seems very well aligned to start and didn’t give me the alignment problem I have with this one. Do you recommend me to run the new afni_proc.py script for all of the patients?

Hi, Joy-

Great, glad that worked.

Personally, I don’t think adding/subtracting options like “-giant_move” across a dataset analysis matters, if the quality of final alignments are all similar.

However, changing the regression model—not including the derivatives of motion now—would be the kind of change that would require re-running across all subjects. Everyone should have the same model specification run. (Note that this would also give you a chance to generate similar QC HTMLs, to help the systematic review across all subjects, so that would be a silver lining.)

-pt

Hi pt,

I applied the new afni_proc.py to all subjects and now I have alignment problem with another subject. This time it starts pretty far apart so I tried adding the -giant_move option back. But it still didn’t work. Do you have any suggestion?

Thanks,
Joy

Hi, Joy-

Hmm, interesting. I assume this one was probably also misaligned on the first pass through processing (because including “-giant_move” didn’t work, and the other regression model change shouldn’t affect alignment)?

Using “-ginormous_move” instead of “-giant_move” might be one option (yes, that really is an option name…). Otherwise, perhaps you can upload the EPI+anatomical volume, and I can take a look. I will PM you upload instructions.

–pt

Hi, Joy-

Attached is an image of the initial positions/overlaps of the dsets (anat_epi_init_positions.png), and an image of the successfully aligned ones (from the QC HTML: align_epi_anat.png).

So, in this case, allowing the larger parameter space search of alignment values with “-giant_move” ended up leading to badness. I think it might be because both the anatomical and EPI are have pretty inhomogeneous brightness patterns (and in different ways). So, looking at your dsets, I figured that once there was a center-of-mass alignment, there wouldn’t need to be a large amount of other rotation/shift/etc. done. So, I changed the option for align_epi_anat.py to this simpler one:


-align_opts_aea \
            -cmass cmass \

… and that seemed to work (again, see attached alignment).

Note that I might also suggest adding:


-anat_has_skull       yes \

… to your script (I do so followign the “-copy_anat …” opt), to signify that the anatomical needs to be skullstripped; I think this is default behavior anyways, but I find it helpful to myself, because I usually skullstrip the anatomical before running afni_proc.py with @SSwarper, and then I remember to turn off skullstripping. (I generally like to overspecify options, just so I can adapt processing scripts more readily.)

One final note: I think we generally recommend not masking the regression step, so you can see the modeling results everywhere, even outside the brain, for QC and information purposes; we calculate masks at the single subject level, yes, but just use those to be combined at the group level for final results reporting. So, I would recommend not including this opt:


-mask_apply anat \

–pt

Hi Paul,

I edited the afni_proc.py scripts according to your suggestions but my alignment from QC html looks different from your attachment.

The script:
afni_proc.py
-subj_id {$subj}
-script proc.{$subj}.vwfa
-out_dir {$subj}.VWFA.results
-dsets {$subj}_vwfa_1+orig {$subj}_vwfa_2+orig
-copy_anat {$subj}_2_t1+orig
-anat_has_skull yes
-blocks despike tshift align volreg blur mask scale regress
-tcat_remove_first_trs 5
-tshift_interp -Fourier
-volreg_align_to MIN_OUTLIER
-align_opts_aea
-cmass cmass
-volreg_align_e2a
-regress_stim_times word.txt checkerboard.txt
-regress_local_times
-regress_stim_labels word checkerboard
-regress_basis ‘BLOCK(24,1)’
-regress_censor_motion 0.3
-regress_censor_outliers 0.1
-regress_opts_3dD
-jobs 4
-gltsym ‘SYM: +word -checkerboard’
-glt_label 1 word_vs_checkerboard
-regress_run_clustsim no
-regress_est_blur_errts
-regress_est_blur_epits
-html_review_style pythonic

Weird, I get that result, too, when I use all the time series (I had just used one time series and truncated it to the first 21 vols, for speed of checking). Ummm, I will keep checking a bit more. Sigh.

–pt

Hi, Joy-

Oooook, this set of EPI-anat align opts worked well (see attached APQC HTML piece; and I did verify it by running afni_proc.py with both full EPIs entered this time…):


-align_opts_aea \
   -big_move -cmass cmass \

Some other thoughts struck me about regression modeling here: you might want to add these opts:


      -regress_compute_fitts                                   \
      -regress_make_ideal_sum sum_ideal.1D                     \
      -regress_motion_per_run                                  \

… to (in order):

  • output the full time series fit by the model
  • output the “ideal” response curve, based on your input stimuli timings and chosen HRF
  • and, well, I’ll just display part of the afni_proc.py help for this last opt:

-regress_motion_per_run : regress motion parameters from each run

                default: regress motion parameters catenated across runs

            By default, motion parameters from the volreg block are catenated
            across all runs, providing 6 (assuming 3dvolreg) regressors of no
            interest in the regression block.

            With -regress_motion_per_run, the motion parameters from each run
            are used as separate regressors, providing a total of (6 * nruns)
            regressors.

            This allows for the magnitudes of the regressors to vary over each
            run, rather than using a single (best) magnitude over all runs.
            So more motion-correlated variance can be accounted for, at the
            cost of the extra degrees of freedom (6*(nruns-1)).

–pt

This fixed the alignment problem! Thank you!
I have another question regarding to the regression modeling: If I have collected the EPI runs over multiple experimental sessions, is the -regress_motion_per_run option adequate to regress out the effect of session in GLM?

Thanks a lot for your help!
-Joy