1. Reconstruction of raw functional images (P-files)

 

NOTE: These instructions are for P-files collected before the scanner upgrade in April 2005. For P-files collected after that time, you should use the new instructions here for reconstruction.

 

 

The functional data is saved from the scanner in K-space form. That is, the data is actually the Fourier transform of the image data itself. We use a program called epirecon to Fourier transform the data back to image space. Epirecon also applies a number of corrections for various types of image distortion. Rather than directly call epirecon, however, we use another program called sip, which in turn calls epirecon. Sip also creates some standard directories and log files which aid in later analysis and debugging.

 

To use sip, we first create a *.SIF file for the files we wish to reconstruct. A *.SIF file is nothing more than a text file that contains information about the files to be reconstructed, and how we want them to be reconstructed. To reconstruct the P-files, we simply invoke sip with the name of the *.SIF file as an argument:

 

sip trainingBlockS001.SIF

 

A template for a *.SIF file is shown below – you can copy this text into a new text file and use it as a template.

 

 

# file trainingBlockS001.SIF

 

# specifies the template from which this *.SIF file was created

SIF template = template.SIT

 

# specifies the study name

Study identifier = trainingBlock  

 

# specifies the subject number

Subject identifier = 001

 

# specifies the base directory in which sub-directories corresponding to each scan run will be created

Working directory = /study/training/afni/block/s001

 

# specifies the name of the log file to be created

SIF log filename = /study/training/afni/block/s001/trainingBlockS001.log 

 

 #specifies the P-files for each scan run. The items “run_1” and “run_2” here are the names to be given to the sub-directories for each scan run

run_1 Pfile = /study/training/afni/block/s001/raw/P05120.7  

run_2 Pfile = /study/training/afni/block/s001/raw/P06656.7 

 

# specifies the ref.dat file that was created during the scan session and that is used for calibration during reconstruction

Reference filename = /study/training/afni/block/s001/raw/ref.dat.s001

 

# Spatial reconstruction filter = Fermi, Hamming, or None

Reconstruction filter = Fermi

 

# specifies the type of file to creat = SDT or I, or both 

Reconstructed files to create = SDT  

 

# specifies the scaling factor to be applied during reconstruction

Scaling factor = 157

 

# specifies how many images at the start of each run to discard. These images correspond to the time that it takes for the scanner to stabilize

Pre-images to discard = 5

 

# other reconstruction parameters that generally should be left as shown here

ZX = NA  

ZY = NA  

Apply BP asymm correction = Y

 

 

Apart from the file names specific to the study and subject being analysed, a few other options will vary according to your study’s needs:

 

 

Max Pixel Value for Slice 1 of first image in .sdt file = 1124.167969

Max Pixel Value for Slice 2 of first image in .sdt file = 1052.396851

Max Pixel Value for Slice 3 of first image in .sdt file = 1953.245972

Max Pixel Value for Slice 4 of first image in .sdt file = 2841.400391

Max Pixel Value for Slice 5 of first image in .sdt file = 3026.464844

Max Pixel Value for Slice 6 of first image in .sdt file = 3249.044189

Max Pixel Value for Slice 7 of first image in .sdt file = 3532.112549

Max Pixel Value for Slice 8 of first image in .sdt file = 3573.299805

Max Pixel Value for Slice 9 of first image in .sdt file = 3537.636719

Max Pixel Value for Slice 10 of first image in .sdt file = 3608.463623

Max Pixel Value for Slice 11 of first image in .sdt file = 3593.496338

Max Pixel Value for Slice 12 of first image in .sdt file = 4204.157715

Max Pixel Value for Slice 13 of first image in .sdt file = 4332.647461

Max Pixel Value for Slice 14 of first image in .sdt file = 4075.661133

Max Pixel Value for Slice 15 of first image in .sdt file = 4304.481445

Max Pixel Value for Slice 16 of first image in .sdt file = 4248.625977

Max Pixel Value for Slice 17 of first image in .sdt file = 4353.900879

Max Pixel Value for Slice 18 of first image in .sdt file = 4322.805664

Max Pixel Value for Slice 19 of first image in .sdt file = 4527.509766

Max Pixel Value for Slice 20 of first image in .sdt file = 5767.873535

Max Pixel Value for Slice 21 of first image in .sdt file = 4483.346191

Max Pixel Value for Slice 22 of first image in .sdt file = 4836.296875

Max Pixel Value for Slice 23 of first image in .sdt file = 4444.487305

Max Pixel Value for Slice 24 of first image in .sdt file = 3817.269043

Max Pixel Value for Slice 25 of first image in .sdt file = 3562.699951

Max Pixel Value for Slice 26 of first image in .sdt file = 4258.999512

Max Pixel Value for Slice 27 of first image in .sdt file = 3662.604248

Max Pixel Value for Slice 28 of first image in .sdt file = 3548.229736

Max Pixel Value for Slice 29 of first image in .sdt file = 3352.286865

Max Pixel Value for Slice 30 of first image in .sdt file = 3725.545898

Max Pixel Value for Slice 31 of first image in .sdt file = 3228.355225

Max Pixel Value for Slice 32 of first image in .sdt file = 3303.088379

Max Pixel Value for Slice 33 of first image in .sdt file = 2425.518555

Max Pixel Value for Slice 34 of first image in .sdt file = 1125.828369

Max Pixel Value for Slice 35 of first image in .sdt file = 1056.139526

Max Pixel Value for Slice 36 of first image in .sdt file = 1042.316528

 

 

 

The reconstruction will produce a subdirectory for each scan run. Inside the subdirectory will be a reconstruction log file, called recon.log, which is a plain text file containing a record of the slice by slice reconstruction. Also in the directory will be an *.sdt and an *.spr file. The sdt file contains the reconstructed data. The spr file contains header information.

 

<back to menu>

 

2. Conversion of the reconstructed data to AFNI format using the command to3d:

 

NOTE: These instructions are for scans collected before the scanner upgrade in April 2005. For scans collected after that time, you should use the new instructions here

 

 

The next step is to convert the reconstructed data into AFNI format, which consists of a binary BRIK file that contains the data, and a text HEAD file that contains useful information about the data. The way that AFNI stores fMRI data has some unique features which are not included with other fMRI packages such as SPM. One of the features is that information about the position of the imaged brain volume in relation to the scanner coordinates can be stored in the header. This makes it possible for AFNI to align or overlay fMRI data with completely different acquisition parameters. e.g. a high resolution anatomical image acquired axially can be aligned with a low resolution functional image acquired saggitally. For this to work, AFNI needs to be provided with precise details of the position and type of each acquisition in scanner coordinates.

 

The conversion to AFNI format is done using the AFNI program to3d. An example command line is shown below:

 

to3d -epan –session ./ -prefix run_1 -zSLAB 76.9L-80.6R -yFOV 100S-100I -xFOV 100A-100P -2swap  -time:zt 36 110 3000 alt+z 3D:0:0:64:64:3960:run_1.sdt

 

In this example, the data was acquired saggitally, with the first slice centred at 76.9 mm left of the scanner coordinate origin. There were 36 slices, thus the center of the last slice was at 80.6 mm right of the scanner origin. The in plane field of view (FOV) was 200 mm, with each slice extending from 100 mm superior to 100 mm inferior of the scanner origin, and from 100 mm anterior to 100 mm posterior of the scanner origin. The data consist of 110 functional brain volumes (e.g. 110 TRs), with a TR of 3000 ms, 64x64 in plane resolution. Since there are 36 slices per brain volume, there are 36*110=3960 total images.

 

This will produce two new files, run_2+orig.HEAD and run_2+orig.BRIK in the ./ (i.e. current) directory.

 

To convert anatomical I files to AFNI format the basic principles are the same, but without the options referring to timing, and with I* specified (i.e. all of the I files in the current directory) instead of a single input file:

 

to3d -anat -session . -prefix T1High -xFOV 120R-120L -zSLAB 54.8I-105.1S -yFOV 130A-110P -2swap I*

 

In addition to information about the format and position of data in the BRIK file, the HEAD file also contains a command history of the AFNI commands used to produce the file. For more information about the to3d command, type the command without any options. You can also get more details of to3d here, and instructions on finding the FOV from the scanlog here and an alternative way of finding FOV and other details directly from the raw P-files here. You can also perform this step using either Hillary’s fMRI processing scripts, or using afnigui. A diagram explaining the FOV dimensions can be seen here.

 

<back to menu>