Beauchamp:Retinotopy: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 35: Line 35:
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 [[Beauchamp:MotionCorrection|Motion and Distortion 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 [[Beauchamp:MotionCorrection|Motion and Distortion Correction]]  
   
   
Remove quadratic trend from each run separately:
Remove the quadratic trend from each run separately:
   foreach r (1 2 3 4 5 6 7 8)
   foreach r (1 2 3 4 5 6 7 8)
     3dDetrend -prefix {$ec}r{$r}vrdt -polort 2  {$ec}r{$r}vr+orig
     3dDetrend -prefix {$ec}r{$r}vrdt -polort 2  {$ec}r{$r}vr+orig
   end
   end


Blur slightly:
Blur each run slightly:
   foreach r (1 2 3 4 5 6 7 8)
   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  
     3dmerge -doall -1blur_rms 3 -prefix {$ec}r{$r}vrdtbl {$ec}r{$r}vrdt+orig  
   end
   end
   rm junk*
   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)
   foreach r (1 2 3 4 5 6 7 8)
Convert to float as required by DFT
    3dcalc -prefix junkr{$r} -datum float -a  {$ec}r{$r}vrdtbl+orig -expr "a"  
  3dcalc -prefix junkr{$r} -datum float -a  {$ec}r{$r}vrdtbl+orig -expr "a"
    3dDFT -prefix {$ec}r{$r}vrdtblFFT -detrend junkr{$r}+orig
perform FFT on each run separately
    3dDFT -prefix {$ec}r{$r}vrdtblFFT -detrend junkr{$r}+orig
   end
   end



Revision as of 10:43, 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
 foreach r (1 2 3 4 5 6 7 8)
 # Retinotopic stimulus has periodicity at frequency 5, calculate phase at only that frequency
  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
 # Calculate magnitude squared at all frequencies
  3dcalc -datum short -prefix {$ec}r{$r}vrdtblFFTMAG -cx2r ABS -a {$ec}r{$r}vrdtblFFT+orig  -expr "a*a"
 end

Average magnitude squared across runs

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

Calculate Fratio between 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 4*number of runs

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

Calculate appropriate phases flip CW and 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

  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{$r}vrdtblFFTf5+orig.HEAD   {$ec}r?vrdtblFFTf5flip+orig.HEAD

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