Beauchamp:CreateAFNIBRIK

From OpenWetWare

Jump to: navigation, search

Brain picture
Beauchamp Lab


Previous step is Getting raw data from the scanner

Contents

Using to3d from the command line

If scanner data is obtained in NiFTI format from the UT Philips scanner, then no conversion is necessary (see above). For all other types of scanner data, the program to3d is used to convert the raw data to AFNI BRIK/HEAD files. The preferred way to run to3d is from the command line, so that all parameters are recorded and the process can be automated. To see the to3d options check the help file:

 to3d –help | more

For the BCM Siemens Scanners

On the experiment sheet, you should have written down how many different scan series were collected and what each scan series consisted of. Alternately, you can use the ls command.

 ls *ima

The first three digits show the scan series number. The highest number is the last scan series. e.g.

 002-000114-152629.ima	003-000048-152134.ima	003-000165-154108.ima	004-000099-153921.ima	005-000040-154821.ima	005-000157-154821.ima	006-000082-160430.ima

Means there were six scan series. To see how many images are in each scan series use the following commands (replacing the number "6" with how many scan series you collected):

 foreach s (`count -digits 3 1 6`)
 echo -n $s "  "
 ls {$s}*ima | wc
 end

This will output something like

 001          3       3      66
 002        183     183    4026
 003        183     183    4026
 004        176     176    3872
 005        192     192    4224
 006        192     192    4224

Scan series 001 is a localizer (only 3 images). From the image number it is ambiguous what the other scan series are (anatomical functional). You can use to3d to examine a single file to see if it is an EPI:

 to3d 003-000165-154108.ima

e.g. EPI image with multiple slices, or an anatomy

 to3d 005-000040-154821.ima

One high-resolution anatomical image. Then, to3d can be run accordingly:

 foreach s (004 005 006)
 to3d -prefix series{$s} -session $sess -skip_outliers -anat {$s}*ima
 end

for anatomies and

 foreach s (002 003)
 to3d -prefix series{$s} -session $sess -skip_outliers -epan -time:zt 33 183 2000 alt+z {$s}*ima
 end

for EPIs.

This is the older method for using to3d with Philips data

To process an anatomical dataset, to3d is quite simple because there is only one timepoint.

 set session = /Volumes/data1/UT/CD/afni
 to3d -session $session -prefix CDanat  IM_*

This creates an AFNI BRIK/HEAD named CD anat from the anatomical DICOM images in the current directory and places them in the "session" directory. AFNI reads information about the images from the DICOM header so that the voxel size and image origin is automatically correct in the BRIK/HEAD file.

To process a functional dataset, to3d if more complicated because we must tell it how many timepoints there were (this information is NOT in the DICOM header). Here is the to3d command to create a BRIK/HEAD from a functional run of DICOM images.

 to3d -session {$session} -skip_outliers -epan -prefix CDr1 -time:tz 110 33 2750 alt+z  IM_*  00000001/IM_*  00000002/IM_*  

Alternately, we can run to3d on the PAR/REC file.

to3d -skip_outliers -epan -time:tz 60 33 2750 alt+z  3D:0:0:80:80:1980:tms_10_10_1.REC

Where "1980" is the product of the number of time points and the number of slices (60*33). This requires you to manually enter all of the information about the dataset (voxel dimensions, etc.) in the GUI, as described in the next section. Alternately, a parent dataset can be specified that was collected with the same parameters.

 to3d -overwrite -prefix test -skip_outliers -epan -geomparent ~/fMRI_1.nii -time:tz 120 33 2000 alt+z  3D:0:0:80:80:3960:C.B.study_2404_2404_F.REC

Using to3d from the GUI interface

If all of the necessary arguments to create a BRIK/HEAD file are given from the command line, then to3d will create the BRIK/HEAD file and finish. If some arguments are missing, then to3d will display a GUI. For instance, simply go to the directory containing the raw DICOM files and type to3d * from the correct folder. Below is a picture of the GUI interface with the most commonly edited options highlighted. Note that the bottom right of the window includes buttons to view the images, save the dataset, and quit. Normally to3d reads the variable information from the DICOM headers and nothing needs to be changed. Only the filename prefix needs to be set.

Personal tools