fMRI Data Analysis Tutorial: for Afni.
# In this tutorial, the sample E file is E17239, the P file P01024,
# the subject name Pl09. Unix prompts are highlighted in bold.
# Comments are preceded by the # sign.
# =============================================
# Pre-analysis stuff: for Windows.
# =============================================
Open X-server, in my case X-Win32.
Open your telnet program, in my case Tera Term Pro.
Telnet into 128.196.98.34
login: ryanlab
password: *******
# Now you should be in sol4, where I analyze data.
# First thing‟s first. Get out of the dumb C shell and into the friendly TC shell.
# And then set up the X-Forwarding so you can see afni.
sol4% tcsh
/home/ryanlab> display
/home/ryanlab> host
# =============================================
# Pre-analysis stuff: for Linux.
# =============================================
# secure shell to Sol4.
/home/mhsu> ssh –l ryanlab 128.196.98.34
password: *******
# =============================================
# Pre-analysis stuff: On your own computer.
# =============================================
Nothing. You should know what to do. :)
# ============================================
# Section 1: Making directories to store data
# ============================================
/home/ryanlab> cd /data/jacobs
/data/jacobs/> mkdir Pl09
/data/jacobs/> cd Pl09
/data/jacobs/Pl09> mkdir run1
/data/jacobs/Pl09> mkdir Anatomy
# =================================================
# Section 2: Data Transfer
# =================================================
# Now we get the data, which is behind the UMC firewall, so we have to go through a
# proxy, mrisun.
/data/jacobs/Pl09> telnet mrisun.radiology.arizona.edu
login: Guest
Password: anonymous
1
# Make a directory to store your files.
mrisun% cd /data/ryanlab
mrisun% mkdir e17239
mrisun% cd e17239
# Now ftp to Sol3, where the files are stored, and get them.
mrisun% ftp 198.60.162.30
ftp> cd /data/ryanlab
ftp> ls
ftp> cd e17239
ftp> prompt off
ftp> bin
ftp> mget E* P*
ftp> quit
mrisun% ls –trl |more
# When you have all files in mrisun, go to Sol4, put the P file into run1,
# E files into Anatomy, and delete the files from mrisun.
mrisun% ftp 128.196.98.34
login: ryanlab
password: *******
ftp> cd /data/jacobs/Pl09/run1
ftp> prompt off
ftp> bin
ftp> mput P01024
ftp> cd ../Anatomy
ftp> mput E*
ftp> ls –l |more
ftp> quit
mrisun% rm E*
mrisun% rm P*
mrisun% ls
mrisun% exit
#Now you should be back in Sol4 and ready for the next stage.
# ====================================================
# Section 3: Reconstructing the Functional Images
# ====================================================
/data/jacobs/Pl09> cd run1/
/data/jacobs/Pl09> ls
/data/jacobs/Pl09> /usr/bin/recon/spiral/grecons5x P01024; rm B0*
/data/jacobs/Pl09> /usr/bin/spiral_rename P01024
# Now push back the directory stacks.
/data/jacobs/Pl09> pushd /data/jacobs/Pl09/run1
/data/jacobs/Pl09> popd
# ====================================================
# Section 3a: Anatomical bricks (Can be done at same time as reconstruction)
# ====================================================
# Sorry, but you need to do this for each series. Maybe one day it‟ll change.
/data/jacobs/Pl09> /data/jacobs/scripts/rename_anat.scp Anatomy/E17239S3
2
/data/jacobs/Pl09> to3d –anat –prefix brain seqplus „Anatomy/E17239S3*‟
# Now you‟re in the to3d program will open a window on the desktop.
Click “View Images”
# The following may change, as sometimes data will be acquired in a strange way,
# so keep an eye on the alignment.
In “Orientation”, change values to:
Right to Left
Superior to Inferior
Anterior to Posterior
Click “Irregular”
Change value of “z voxel” from 3.75 to 6.
Click “save”
Click “quit”
# ====================================================
# Section 4: Constructing Functional bricks
# ====================================================
# 177 = number of reps; 23 = number of slices; 3000 = TR.
/data/jacobs/Pl09> to3d –epan –prefix run1 –time:tz 177 23 3000 seqplus
„run1/P01024.*‟
# Now you‟re in the to3d program will open a window on the desktop.
Click “View Images”
# The following may change, as sometimes data will be acquired in a strange way,
# so keep an eye on the alignment.
In “Orientation”, change values to:
Right to Left
Superior to Inferior
Anterior to Posterior
Click “Irregular”
Change value of “z voxel” from 3.75 to 6.
Click “save”
Click “quit”
# ====================================================
# Section 5: Reregistering images.
# ====================================================
/data/jacobs/Pl09> 3dvolreg –verbose –Fourier –prefix run1_reg –base 3 –dfile
run1_reg.log run1+orig
# If you are reregistering a run to another run (e.g., run2 to run1), use this:
/data/jacobs/Pl09> 3dvolreg –verbose –Fourier –prefix run2_reg –base „run1_reg –
base „run1_reg+orig[3]‟ –dfile run2_reg.log run2+orig
# ==============================================================
# Section 6: Normalizing images (unnecessary if have only 1 run.
# ==============================================================
/data/jacobs/Pl09> from3d –input run1_reg+orig –prefix ./run1/run1_reg
# Creative bshort files: fgs always = 1; nas = # anat slices; nfs = # func slices.
3
/data/jacobs/Pl09> afnireg3bshort –I ./run1/run1_reg –fgs 1 –nas 23 –nfs 177
# Normalizing images, bshorts -> bfloats: nslices = # anat slices.
/data/jacobs/Pl09> inorm –I ./run1/run1_reg –o ./run1/run1_reg_norm –nslices 23
# Making bfloats into afni bricks: need to change 3Df:0:0:64:64:??? to match # of
# functional images.
/data/jacobs/Pl09> to3d –epan –prefix run1_norm –time:tz 177 23 3000 seqplus
3Df:0:0:64:64:177:run1_reg_norm\*.bfloat
# ===================================================================
# All done with registration and normalization. Ready to analayze!!!
# ===================================================================
4