Beauchamp:CreateAFNIBRIKfromMR
Getting Data From the UT Philips Scanner
MR data can be sent directly from the Philips scanner to the RAID. The data will end up in
/Volumes/data2/raw
in a directory name that is made by Vips, the scanner technologist. Depending on how it is exported from the scanner, the data will be one of three formats:
NiFTI Format
tms_10_10_1.nii
This is the preferred format because it can be read by AFNI directly.
PAR/REC Format
tms_10_10_1.PAR tms_10_10_1.REC
This is the native Philips format. The PAR file contains the data PARameters. The REC file contains the raw REConstructed data for the entire run.
DICOM format
IM_2048
Each file contains one image, so that one run has thousands of images in it.
Getting Data from other Scanners
Data from other scanners will often be stored in DICOM or other formats. DICOM is the standard file format for storing medical data. Typically each scan is saved in a unique folder and each file represents a single slice. OsiriX is a free DICOM viewer for Macs and can be downloaded from the following URL:
http://homepage.mac.com/rossetantoine/osirix/
OsiriX can often extract images from DICOM or other formats and write them out to a directory in standard DICOM format. Then, to3d is used to convert the extracted DICOM files to AFNI BRIK/HEAD files.
Using to3d from the GUI interface
To load the GUI component of to3d just specify all the files from a single scan. Since each scan typically has its own folder this can be as simple as running 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.
Using to3d from the command line (Faster)
to3d can also write files from the command line, which is particularly helpful when writing scripts to automate the task for several subjects. There are also more options from the command line. To see them all check the help file: to3d –help | more After the files have been created you should use 3dcopy to save a copy in the subject’s surfaces directory.
mkdir /surfaces/subject_name mkdir /surfaces/subject_name/afni 3dcopy subjIDanatr /surfaces/subject_name/afni/subjIDanatr
Note that 3dcopy automatically moves the BRIK and HEAD files that share the prefix subjIDanatr, and the program also appends the header file’s history.
Averaging Anatomical Scans Using AFNI
To register all the anatomicals to the space of the anatomical closest in time to the functional data (generally anatr1), this is with just two anatomical's:
3dAllineate -base ${subj}anatr1+orig -source ${subj}anatr2+orig -prefix ${subj}anatr2_2RegTo1 -verb -warp shift_rotate -cost mi -automask -1Dfile ${subj}anatr2toanatr1
Average anatomicals into one dataset:
3dmerge -gnzmean -nscale -prefix ${subj}anatavg ${subj}anatr1+orig ${subj}anatr2_2RegTo1+orig