AFNI How-To for GE Datasets. (Edited from Lisa T. Eyler original How-To).
1. Converting anatomical into 3D brik:
a. cd to the directory where your image files are located in.
b. to3d -prefix [anatbrikname] i*
2. Converting functional images into 3D brik:
a. Change directory to your first run for example
b. These are time dependent datasets, so we have to feed the
to3d command some parameter, here is an example
to3d -prefix XXX -time:zt #slices #timepts TR sliceorder i*
to3d -prefix run1 -time:zt 35 200 3000 alt+z i*
3. Images Registration:
In the date directory, enter "afni -R" (this
recursively searches for any AFNI datasets in or below the
current directory)
Afni widget window, click on Switch Underlay
- Choose the functional file name that you just created (e.g, 0320run1+orig).
- Under axial (plane that images were collected) - click on graph
- A window with voxels of graphs should appear.
- To look for large movements by the patient during the task, you need to scroll through the graph over time (x-axis on graph), and watch for large changes in the head position on the images.
- to do this, use following keys on the keyboard, while your
arrow for the mouse is placed within the graph.
">" - moves U forward in time (the red dot on the graph line )
"<"- moves U back in time
"+" - increases the amplitude
"-" - decreases the amplitude of the graph
- if large movement in head, note approx. time it occurred, may
need this later.
- In the AFNI widget window, click on Define
Datamode, then Plugins, then
3-D Registration, and whichever base image you
choose (we usually pick one in the middle or use a program by
martin Paulus to help choose the most typical base image). Click
on Dataset and choose your functional dataset.
- Output file name run1_reg (remember use same name as
experiment)
- Now, review graph of registered images to see if head motion
has improved.
- 3dvolreg -base 43 -dfile 0320runbs43.mot -prefix
0320_reg3dbs43 0320+orig
- -base 43 means register to the 43rd image
- the -dfile flag outputs the parameters dx, dy, dz, pitch,
roll, yaw into a file (named 0230runbs43.mot) so can use these
as a quantitative index of the amount of movement
- -prefix tells the output prefix
- run1.* is the input to register
- -base 43 means register to the 43rd image
4. Reference function creation
Options for creating reference functions
Text editor
- (click with Right mouse button on wallpaper, under Programs,
you will find this)
"0" for no stimulus
"1" for stimulus on - All reference functions must be created with a file name that has suffix of ".1D" or ".1Dx" (for sets of multiple reference functions) for AFNI to recognize it.
5. Correlating functionals to reference functions
|
In graph window, click on FIM, then
click on Pick Ideal
Choose reference function from file that you created for this image analysis Click on Set Examine shape of reference function in graph window to make sure it looks like you expected Click on FIM, Compute FIM+, click on FBUC |
![]() |
6. Looking at your functional data
- Switch Underlay – pick the anatomical brik
(e.g., 0230anat+orig)
- Click Define Overlay, and See Overlay
- Switch threshold (Thr) to #3 correlation;
switch OLay to #0 Fit Coefficient
- Slide correlation slider all the way to 0 and look at pixels
to make sure your functional brick is in a logical position
relative to the anatomy
- Move cursor up & down the multi-colored columns – to find a correlation point with minimal artifact.
7. Shifted reference functions
- In AFNI graph window, click on FIM, then
click on Pick Ideal, and choose your unshifted
reference function
- Then click on FIM, Edit Ideal, Shift
Ideal
- Choose the increment (in TR's à e.g., 0.5 with TR = 3 sec
means 1.5 sec increments)
- Choose the number of steps (usually to the right, and [number
of steps X increment (in seconds)] should be less than length of
one half-cycle)
- Click Set
- Save your set of reference functions using FIM, Edit
Ideal, Write Ideal.
- Give the reference function the .1Dx suffix and include info
about the increment and number of steps (e.g.,
run149_lrn-rpt_s6_1.5s.1Dx)
- Do FIM, Compute FIM+, FBUC
- Look at data as above
- Also, look at which shift was picked for each pixel
- For OLay, pick #1 Best Index; for Thr, pick
#3 Correlation
- Change the Intensity color bar so that the values increment at
(1/# of reference functions). E.g., if you used 7 reference
functions (a 0 shift plus 6 shifts), then you would have the
colors change at 0.14, 0.28, 0.42, etc.
- Change the colors by clicking on them to make neighboring
colors very distinct
- Slide correlation down to 0 and then back up slowly to see
which shifts were associated with the highest correlations
8. Renaming functional datasets
- AFNI outputs the results of each FIM+ as a filename like
"run1_reg+orig@1".
- To rename the filename to be more informative:
- Click on Define Datamode, Plugins, Dataset Rename
- Choose input file, and provide new output prefix
9. Saving images to .jpg format
| Step 1 - Make the AFNI window of interest look like you want (e.g., turn off crosshairs, etc). note the button 'Sav1.ppm' is the save button. |
![]() |
| Step 2 - right click on the save button, select Save.jpg for jpeg format and click on the 'set' button. |
![]() |
| Step 3 - left click on the save button and enter in a filename that you want to name the file. note to save the image in your home directory instead of directory where your dataset is located in, type ~[Home]/[image name].jpg where [Home] is your home directory which is usually your user name. |
![]() |
10. For more AFNI program -help
go to the AFNI website
http://afni.nimh.nih.gov/afni/doc
Last after all the subjects are to be analyzed together - you may
Tailarach the images




