Ziad Saad has developed a package of *Matlab*
functions to read, write, and process *AFNI* datasets.
This may be useful for the hackers amongst you that want to
do some quick calculations, or otherwise have some fun.

The

*Matlab*functions and associated files can be downloaded in tar+gzip format from file`afni_matlab.tgz`in this directory. The library unpacks into the directory`./afni_matlab`.This library is in a (permanent) testing phase. Please report any errors you find to

and we will do our best to correct them promptly. Any other comments are also appreciated. The library may be re-distributed.`ziad@codon.nih.gov`The

*Matlab*script called`MatAFNI_Demo.m`can be run/viewed to see how the library works. To use this, you will also have to download the tar+gzip archive`afni_matlab_data.tgz`of some sample datasets, available in this directory. The data archive unpacks into the directory`./afni_matlab_data`(about 21 Mbytes). The script should be a useful illustration of how to access and write*AFNI*data. Also see the`Test*`set of scripts for further examples.Writing

*AFNI*bricks assumes you have an understanding of their header structure. Please read and understand the`README.attributes`file that is included in*AFNI*'s distribution before writing bricks with these (or other) functions. There's only so much automatic checking on the header content that can be done and I can imagine quite a bit of room for creative error making! For convenience, I have included a copy of`README.attributes`with the library distribution. However, this file may not be the most current version that is being distributed with*AFNI*.Presently, documentation is only available by using the help function in

*Matlab*.Remember: The data in the

`.BRIK`is stored in the order (orientation) in which the images were loaded into*to3d*. So, in order to know how to slice through a data set you need to look into the Info structure (output of BrikInfo and BrikLoad). I have included the AFNI* functions to help shed some light into this darkness.Brik or Brick about 100 functions later ...: I regret having used brik instead of brick in many of the functions. It just looks wrong, but at the time I thought it mirrored .BRIK a little better. So some functions use Brik some Brick, I am sure you'll get used to this minor inconvenience.

Set the

*Matlab*path appropriately (e.g., add the`afni_matlab`directory to the MATLABPATH environment variable).

SSCC/NIMH/NIH