Scanning HOWTO

How-Tos - fMRI Scanning

How do I...

Use the spiral in-out pulse sequence?

The best way to do this is to work off of an existing protocol that uses sprial in/out. When viewing a functional series at the scanner, the "PSD name" field Under the "imaging parameters" heading should show "sprlio". See the section on "How do I set up a scanning protocol at the Lucas Center?" (coming soon) for more info.

Figure out what TR I need to use?

It depends on the number of slices you want (i.e. how much coverage of the brain you'd like). In fMRI, there is a trade-off between number of slices and the TR. This is because the time it takes to acquire a slice is relatively fixed. As of 4/2/04, sprlio (at 22 cm FOV) acquires a slice at 66.2 ms. This means that you can acquire 15 slices in 1 sec (15 slices * 66.2ms/slice), but 15 slices would most likely not cover the entire brain. It's more likely that 23 slices will (1.5 sec TR). See Gary Glover's time/slice specifications for more: info

Send my data files from scanner to the Gabrieli Lab/BIAC servers

When collecting new data, you need to transfer anatomical and functional data to your data directory on the Gablab/BIAC servers. A UNIX program on the Gablab/BIAC servers, called "do_fmri_lite", conveniently accomplishes a number of steps to help you in this process. First, it creates the relevent directories for a new subject in your data directory (i.e. anatomy/ raw/ behave/ functional/ etc/), then it retrieves anatomical files from the Lucas Center (i.e. it runs brain_script automatically and copies over the resulting .tar file). At the moment (June 4, 2004), do_fmri_lite does not have the full functionality to copy over the functional files (the P* and E* files). To transfer these files, you will need to use ftp from the scanner console to the Gablab/BIAC servers and put the files into the subject's raw/ directory. Incidentally, makevols_batch (see below) assumes that you have the functional/ and raw/ directories in place and that your E* and P* files are in raw/.

Copy over the anatomical data

  • If you don't use "do_fmri_lite" to transfer the anatomical files (see above), you'll have to use the following procedure to transfer anatomical files:

1. login to ""

2. type "brain_script" to get info on usage. example: "brain_script -e <exam-number> -d <directory-name> -3"

3. cd /temp/gabrieli

4. you'll find a tar file in this directory called "<directory-name>.tar"

5. copy this file to the gablab/BIAC servers using secure copy, "scp". example

scp <directory-name>.tar user@sperry:/my/data/directory/subject/anatomy/

6. when logged into your gablab/BIAC account,

cd /my/data/directory/subject/anatomy/
tar xvf <directory-name>.tar
mv <directory-name>/anatomy/* .

Reconstruct my functional volumes?

1. What files do I need before reconstrucing raw functional data?
Short answer: P*.mag and E-file.
Long answer: The scanner produces 4 files after each functional run (P-file, P*.mag file, E-file, and P.hdr file). Of these, you only need the P*.mag and E-files for reconstruction. The P*.mag (e.g., P12800.7.mag) is the auto-reconstructed data that is produced automatically at the scanner. It is a single file that contains information about all of the volumes in the functional run. The E-file is a text file containing information about the run (e.g., how many images were collected, the TR, etc.). An example of an E-file is the following: E09797S004P12800.7. Note that the "E" refers to the exam number which follows (E09797), the "S" refers to the series number (S004), and the "P" refers to the P-file number (P12800.7). (The P-file (e.g., P12800.7 is the raw data that comes out of the scanner; The P*.hdr (e.g., P12800.7.hdr) file contains the same info as the E-file, but is not easily readable - you won't do much with this and can easily delete it without regret).

2. What programs do I run to reconstruct the data?
"makevols" will produce individual analyze images (i.e., V001.img plus V001.hdr, etc.) for each run. Typing in "makevols" alone at the unix prompt will give you some instructions on how to use it. You must me in the same directory as your P*.mag files for the program to work. One common usage is: "makevols <E-file> <scan-name>", where <E-file> corresponds the the P*.mag file of interest and <scan-name> is the prefix you'd like to add to your images (i.e., "scan1" would produce images named "scan1.V001.img"). So, one example of a call to "makevols" might be: "makevols E09797S004P12800.7 scan1".

*"I have 10 functional runs (i.e. 10 P.mag files) and running makevols ten times per subject is so tedious! Can I run it en masse in batch form?"*

YES, you can run "makevols_batch" to run makevols for several scans at once. Typing the name at the command line will give you instructions on how to use it. Briefly, the program runs makevols for each scan and moves the resulting volume images to their respective scan directory (within the functionals directory). It also gives an option to move the first specified number of images into a subdirectory in each scan dir (this is useful for when the NEXTRA in the scanning protocol is set to 0, meaning that the scanner has saved the first few images rather than tossing them out). You'll need to make a text file containing two columns, one containing Efiles, the other containing corresponding scan names. If you're using makevols individually for each scan, you'll appreciate the time this saves you.

3. What do I do if I don't have an "E-file" (i.e. I forgot to transfer it from the scanner or I accidentally deleted it)?

No worries, you can use the program writeihdr at the UNIX prompt to generate the E-file.
Simply type: writeihdr <Pfile> and you'll get a text file with the header info.

Reconstruct my anatomical volumes?

The program, "" is a perl script that will fulfill most of your anatomical reconstruction needs. It simply takes a collection of "I-files" (the raw image data in which each I file represents a slice) and converts them to a single ANALYZE format volume (e.g., V001.img and corresponsing V001.hdr).

Typing, "" at the UNIX prompt will give you usage info:

Usage: -f <nframes> -s <nslices>

-i <inplane resolution> -t <thruplane resolution>
-c <condition 1> -c <condition 2> ...

Optional arguments:

-x <byte-swap data>
-nodelete <don't delete I files>
-cuthdr <cut GE headers>
-sag <saggital orientation>
-cor <coronal orientation>
-z <use if slice 1 is inferior (axial), left (saggital), or anterior (coronal)>
-64 <for 64x64 images>
-256 <for 256x256 images>
-d <debug option, no execution>
changes files in directories named after -c from I.x format used
in IDL to volume format used in SPM, and byte-swaps files for use
on Linux machine (e.g., cajal) (if -x option is used).

Here are some examples:

TO MAKE HI-RES ANATOMY IMAGE: (S2_SAG): -f 1 -s 124 -i 0.9375 -t 1.5 -c s2:sag -x -nodelete -cuthdr -256 -z -sag

TO MAKE INPLANE ANATOMY IMAGE: (S3_INPLANE): -f 1 -s 23 -i .9375 -t 5.0 -c s3:inplane -x -nodelete -cuthdr -256 -z

NOTE that the "inplane resolution" (the -i option) is the field of view divided by the image matrix size (i.e. 240/256 in the above examples)

Do perfusion imaging?