Beauchamp:CreateAFNIBRIKfromMR: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 27: Line 27:
OsiriX can often extract images from DICOM or other formats and write them out to a directory in standard DICOM format.
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.
Then, to3d is used to convert the extracted DICOM files to AFNI BRIK/HEAD files.
=== Using to3d from the command line ===
If scanner data is obtained in NiFTI format, 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
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 images in the current directory and places them in the session afni directory.


===Using to3d from the GUI interface ===
===Using to3d from the GUI interface ===
Line 36: Line 54:
[[Image:To3d.jpg| 600px]]
[[Image:To3d.jpg| 600px]]


=== 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 ===
=== Averaging Anatomical Scans Using AFNI ===

Revision as of 08:02, 11 April 2008

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 command line

If scanner data is obtained in NiFTI format, 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

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 images in the current directory and places them in the session afni directory.



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.


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