Beauchamp:Retinotopy: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 65: Line 65:
Convert to fbuc:
Convert to fbuc:
   3dbucket -prefix {$ec}rallvrdtblFFTMAGSTAT  -fbuc junkMAGSTAT+orig
   3dbucket -prefix {$ec}rallvrdtblFFTMAGSTAT  -fbuc junkMAGSTAT+orig
Give it correct stats--numerator degrees of freedom is 2*number of runs, denominator degrees of freedom is 4*number of runs
Give it correct stats--numerator degrees of freedom is 2*number of runs, denominator degrees of freedom is 8*number of runs:
   3drefit  -sublabel 0 Significance -substatpar 0 fift 16 64 -subrepkey 0 Significance {$ec}rallvrdtblFFTMAGSTAT+orig
   3drefit  -sublabel 0 Significance -substatpar 0 fift 16 64 -subrepkey 0 Significance  
Calculate appropriate phases
  {$ec}rallvrdtblFFTMAGSTAT+orig
flip CW and CON runs
Calculate appropriate phases by first flipping clockwise (CW) and contracting (CON) runs.
   foreach r (3 4 7 8)
   foreach r (3 4 7 8)
  3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTf5flip -a {$ec}r{$r}vrdtblFFTf5+orig  -expr "-a"
    3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTf5flip -a {$ec}r{$r}vrdtblFFTf5+orig  -expr "-a"
  3drefit -sublabel 0 FFTr{$r}f5flip -subrepkey 0 FFTr{$r}f5flip {$ec}r{$r}vrdtblFFTf5flip+orig
    3drefit -sublabel 0 FFTr{$r}f5flip -subrepkey 0 FFTr{$r}f5flip {$ec}r{$r}vrdtblFFTf5flip+orig
  end
  end
Average together
Average together the flipping CW and CON runs with the counterclockwise (CCW) and expanding (EXP) runs respectively:
   rm junk*
   rm junk*
   3dcalc -prefix junkeccavg -datum short -a {$ec}r2vrdtblFFTf5+orig -b {$ec}r4vrdtblFFTf5flip+orig \
   3dcalc -prefix junkeccavg -datum short -a {$ec}r2vrdtblFFTf5+orig -b {$ec}r4vrdtblFFTf5flip+orig \
Line 79: Line 79:
   3dcalc -prefix junkpolavg -datum short -a {$ec}r1vrdtblFFTf5+orig -b {$ec}r3vrdtblFFTf5flip+orig \
   3dcalc -prefix junkpolavg -datum short -a {$ec}r1vrdtblFFTf5+orig -b {$ec}r3vrdtblFFTf5flip+orig \
   -c {$ec}r5vrdtblFFTf5+orig -d {$ec}r7vrdtblFFTf5flip+orig -expr "mean(a,b,c,d)"
   -c {$ec}r5vrdtblFFTf5+orig -d {$ec}r7vrdtblFFTf5flip+orig -expr "mean(a,b,c,d)"
 
Combine stats, individual runs, and averages in one file for ease of viewing:
Combine stats, individual runs, and averages in one file for ease of viewing
   3dbucket -prefix {$ec}Ret -fbuc  {$ec}rallvrdtblFFTMAGSTAT+orig junkeccavg+orig junkpolavg+orig  
   3dbucket -prefix {$ec}Ret -fbuc  {$ec}rallvrdtblFFTMAGSTAT+orig junkeccavg+orig junkpolavg+orig  
   {$ec}r?vrdtblFFTf5+orig.HEAD {$ec}r?vrdtblFFTf5flip+orig.HEAD
   {$ec}r?vrdtblFFTf5+orig.HEAD {$ec}r?vrdtblFFTf5flip+orig.HEAD

Revision as of 12:57, 5 December 2007

Brain picture
Beauchamp Lab




Phase-Mapped Retinotopy

Visual areas are retinotopic. An efficient way to map visual areas is to present stimuli that traverse the visual field. Here are three snapshots of an eccentricity mapping stimulus:

Over the course of a 5-minute scan series, the ring expands from central to peripheral five times.

Here are three snapshots of a polar angle mapping stimulus:

Over the course of a 5-minute scan series, the wedge rotates around the fixation point five times.

Processing Phase-Mapped Retinotopy Data in AFNI

Here are some processing steps to analyse this data in AFNI:

First step: measure motion in each run separately, perform the registration, save motion parameters create average EPI image to register to

 3dTcat -prefix {$ec}rall {$ec}r1+orig.HEAD {$ec}r2+orig.HEAD {$ec}r3+orig.HEAD {$ec}r4+orig.HEAD {$ec}r5+orig.HEAD \
 {$ec}r6+orig.HEAD {$ec}r7+orig.HEAD {$ec}r8+orig.HEAD
 3dTstat -mean -prefix {$ec}EPImean {$ec}rall+orig.HEAD


Motion Correction

Before analyzing the retinotopy data, motion correct by aligning all EPIs to the mean EPI and registering that to the high-res anatomy, both in a single step to reduce noise. For more info, see Motion and Distortion Correction

Remove the quadratic trend from each run separately:

 foreach r (1 2 3 4 5 6 7 8)
    3dDetrend -prefix {$ec}r{$r}vrdt -polort 2  {$ec}r{$r}vr+orig
 end

Blur each run slightly:

 foreach r (1 2 3 4 5 6 7 8)
    3dmerge -doall -1blur_rms 3 -prefix {$ec}r{$r}vrdtbl {$ec}r{$r}vrdt+orig 
 end
 rm junk*

Convert to float as required by DFT, and then perform FFT on each run separately:

 foreach r (1 2 3 4 5 6 7 8)
    3dcalc -prefix junkr{$r} -datum float -a  {$ec}r{$r}vrdtbl+orig -expr "a" 
    3dDFT -prefix {$ec}r{$r}vrdtblFFT -detrend junkr{$r}+orig
 end

The retinotopic stimulus has a periodicity at frequency 5, so calculate phase at only that frequency for all runs and label the subbrick. Then, calculate amplitude squared (power) at all frequencies for all runs.

 foreach r (1 2 3 4 5 6 7 8)
    3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTf5 -cx2r PHASE -a {$ec}r{$r}vrdtblFFT+orig'[5]'  -expr "a"
    3drefit -sublabel 0 FFTr{$r}f5 -subrepkey 0 FFTr{$r}f5 {$ec}r{$r}vrdtblFFTf5+orig
    3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTMAG -cx2r ABS -a {$ec}r{$r}vrdtblFFT+orig  -expr "a*a"
 end

Average amplitude squared across runs:

 3dMean -prefix {$ec}rallvrdtblFFTMAG {$ec}r?vrdtblFFTMAG+orig.HEAD

Calculate the Fratio between the frequency of interest and neighboring frequencies

 rm junk*
 3dcalc -prefix junkMAGSTAT -a3 {$ec}rallvrdtblFFTMAG+orig -b4 {$ec}rallvrdtblFFTMAG+orig -c5 
 {$ec}rallvrdtblFFTMAG+orig -d6 {$ec}rallvrdtblFFTMAG+orig -e7 {$ec}rallvrdtblFFTMAG+orig -expr "c^2 / ( (a^2  
 + b^2 + d^2 + e^2)/4 )"

Convert to fbuc:

 3dbucket -prefix {$ec}rallvrdtblFFTMAGSTAT  -fbuc junkMAGSTAT+orig

Give it correct stats--numerator degrees of freedom is 2*number of runs, denominator degrees of freedom is 8*number of runs:

 3drefit  -sublabel 0 Significance -substatpar 0 fift 16 64 -subrepkey 0 Significance   
 {$ec}rallvrdtblFFTMAGSTAT+orig

Calculate appropriate phases by first flipping clockwise (CW) and contracting (CON) runs.

 foreach r (3 4 7 8)
    3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTf5flip -a {$ec}r{$r}vrdtblFFTf5+orig  -expr "-a"
    3drefit -sublabel 0 FFTr{$r}f5flip -subrepkey 0 FFTr{$r}f5flip {$ec}r{$r}vrdtblFFTf5flip+orig
 end

Average together the flipping CW and CON runs with the counterclockwise (CCW) and expanding (EXP) runs respectively:

  rm junk*
  3dcalc -prefix junkeccavg -datum short -a {$ec}r2vrdtblFFTf5+orig -b {$ec}r4vrdtblFFTf5flip+orig \
  -c {$ec}r6vrdtblFFTf5+orig -d {$ec}r8vrdtblFFTf5flip+orig -expr "mean(a,b,c,d)"
  3dcalc -prefix junkpolavg -datum short -a {$ec}r1vrdtblFFTf5+orig -b {$ec}r3vrdtblFFTf5flip+orig \
  -c {$ec}r5vrdtblFFTf5+orig -d {$ec}r7vrdtblFFTf5flip+orig -expr "mean(a,b,c,d)"

Combine stats, individual runs, and averages in one file for ease of viewing:

  3dbucket -prefix {$ec}Ret -fbuc  {$ec}rallvrdtblFFTMAGSTAT+orig junkeccavg+orig junkpolavg+orig 
  {$ec}r?vrdtblFFTf5+orig.HEAD {$ec}r?vrdtblFFTf5flip+orig.HEAD
  3drefit -sublabel 1 AvgEcc -subrepkey 1 AvgEcc -sublabel 2 AvgPolar -subrepkey 2 AvgPolar {$ec}Ret+orig

Here are flat maps showing the thresholded eccentricity and polar angle maps produced by this analysis: