Beauchamp:CreateAFNIBRIKfromMR: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 40: Line 40:
   to3d -session $session -prefix CDanat  IM_*
   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" directory.
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.
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).
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  
   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.




===Using to3d from the GUI interface ===
===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
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 *
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.
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.

Revision as of 08:09, 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 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.


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.


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