Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » AFNI » Matlab Library

AFNI Matlab Library

Document Actions
Using Matlab to read, write, and process AFNI datasets.

Types of Sums of Squares

Ziad Saad and Gang Chen have developed a package of Matlab functions to read, write, and process AFNI datasets. This may be useful for those who want to carry out matlab-based computations such as Dr. Worsley's FMRISTAT or Gang Chen's 5-way ANOVA or user cuddly 3dDeconvolve.

  • The Matlab functions and associated files can be downloaded in tar+gzip format from file afni_matlab.tgz. The library unpacks into the directory ./afni_matlab/matlab. The library is also included in the archive for afni_src.tgz and would unpack into afni_src/matlab.
  • This library is in a (permanent) testing phase. Please report any errors you find to saadz@mail.nih.gov or gangchen@mail.nih.gov and we will do our best to correct them promptly. Any other comments are also appreciated. The library may be re-distributed.
  • 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. 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!
  • 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/matlab or afni_src/matlab directory to the MATLABPATH environment variable).

A few comments on the AFNI Matlab Library

  • 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 afni 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.
  • The Test* scripts are included to illustrate how some functions can be used. You have to modify the data filenames in the Test* scripts to run them on your own data.
  • Remember: The data in the .BRIK are 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 the darkness.
  • Functions to read/write AFNI data: BrikInfo BrikLoad WriteBrik Functions that deal with voxel coordinates: AFNI_XYZcontinuous2Index AFNI_Index2XYZcontinuous AFNI_CoordChange Functions that deal with extracting and selecting slices a la AFNI: GetAfniSlice GetAfniSliceTriplet
  • 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.
  • Please report any errors you find and I will do my best to correct them promptly. This library may be distributed in whole.
Created by Ziad Saad
Last modified 2007-02-13 16:47
 

Powered by Plone

This site conforms to the following standards: