Center for Functional MRI In the Department of Radiology

How to convert dicoms to AFNI

Converting to AFNI

Images are in DICOM format, so that AFNI can grab the geometry information from the DICOM header. This makes conversion into BRIKS relatively painless.

Note: DICOM files generated by the upgraded 3T scanners (HDx, 14x) are not saved in sequential order. For the AFNI to3d program to create a AFNI BRIK with the correct slice order, these dicom files need to be reordered. We have developed a Perl script 'imseq' for this purpose. For more information and downloading the script use the following link.

Anatomical Images:
scp the images and run to3d
to3d -prefix [anatbrikname] i*

Warning: At present, there is a problem with processed images (such as surface coil intensity corrected (SCIC) images). An interim fix is as follows.

  1. Read the FOV values and actual BRIK orientation from the header of a BRIK of non-processed images.
  2. Rename files so that they are listed in the order indicated by the suffix. For example, rename processed fspgr image series i2136970.MRDC.1-i2138170.MRDC.120 to MRDC.001- MRDC.120. Renaming can be done from the matlab command window or by using the UNIX renfunc command.
  3. Use a to3d command that ignores the headers: e.g.

to3d -prefix brikname \
-zFOV eR-fL -xFOV aA-bP -ySALB cS-dI \

The FOV/SLAB values (a,b,c,d,e,f) can be determined from the header of a brik created from raw images.

Functional Images:

to3d -prefix XXX -time:zt #slices #timepts TR sliceorder i*

example for BIRN protocol interleaved slices:

to3d -prefix birn2 -time:zt 35 200 3000 alt+z i*

NOTE: The default fMRI scan uses interleaved slices and bottom to top slice ordering, so alt+z is usually the correct choice for sliceorder.

WARNING: If you are using an old version of AFNI, the slice order may not come out correctly. There are problems with AFNI 2.51d that disappear when we use AFNI 2.55g. So if you run into problems, make sure you are using the latest version of AFNI.

Note: If you get an argument list being too long error message, enclose the reference to the files by a back-quote `

Example: to3d -prefix birn2 -time:zt 35 200 3000 alt+z `i*`