Index of /~marchini/software/AnalyzeFMRI

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[   ]fmri.null.dataset.tar.gz2001-08-30 16:20 23M 
[   ]AnalyzeFMRI_1.1-0.zip2004-06-10 10:55 432K 
[   ]AnalyzeFMRI_1.1-2.tar.gz2005-04-11 20:38 303K 
[   ]AnalyzeFMRI_1.1-4.tar.gz2005-10-04 21:20 301K 
[   ]AnalyzeFMRI_1.1-3.tar.gz2005-06-17 21:42 300K 
[   ]AnalyzeFMRI_1.1-1.tar.gz2004-12-23 17:44 300K 
[   ]AnalyzeFMRI_1.1-0.tar.gz2004-06-11 09:43 297K 
[   ]AnalyzeFMRI_1.0-8.tar.gz2002-09-09 08:53 262K 
[   ]AnalyzeFMRI_1.0-7.tar.gz2002-04-26 11:48 259K 
[   ]AnalyzeFMRI_1.0-6.tar.gz2002-03-28 14:39 259K 
[TXT]README.html2001-08-15 10:31 9.6K 
[TXT]ica.screenshots.html2002-09-16 08:52 822  

R Package - AnalyzeFMRI


This file explains how to install the R package AnalyzeFMRI. I assume that you have a basic knowledge of UNIX/LINUX and that you already
have R installed on your machine.

AnalyzeFMRI contains functions that allow ANALYZE image format .img and .hdr files to be read into R and written from R automatically

If you have any problems/suggestions using this package, please email me on


1. Download the g-zipped tar archive  AnalyzeFMRI_1.0-0.tar.gz   (or a newer version if available from the web-site)

2. Unzip the file using        gunzip AnalyzeFMRI_1.0-0.tar.gz

3. Unpack the archive using    tar -xvf AnalyzeFMRI_1.0-0.tar

This will create a directory called AnalyzeFMRI and the files example.img and example.hdr (see EXAMPLES)

4.  Install the package using     R CMD INSTALL -l /path/to/LIB AnalyzeFMRI

/path/to/LIB should be the library directory where you wish to put the package.

If you have root access to your machine then use


and the package will be put into the default R library tree.

5. You can then start an R session and load the package using




(if you installed the package into the default R library tree)

6. Use the EXAMPLES section to see how the functions work.


The package contains the following functions
The functions come with help files

f.analyze.file.summary                                   prints summary of .img file contents
f.analyzeFMRI.gui                                           starts AnalyzeFMRI GUI
f.basic.hdr.list.create                                       creates basic .hdr list
f.ica.fmri                                                           Applies Spatial ICA (Independent Component Analysis) to fMRI datasets
f.ica.fmri.gui                                                     tcltk GUI to apply ICA to fMRI datasets
f.plot.ica.fmri                                                   Plots a specified component from the output of f.ica.fmri                                      read Analyze header file                                          read one slice from a .img file           reads a slice at all time points from a .img file                                               read in one voxel time series                                     read whole .img file
f.spectral.summary                                         plots graphical summary of spectral properties of an fMRI dataset
f.write.analyze                                                 writes an array to a .img/.hdr pair                            write array of 2 byte integers                               write array of 4 byte floats                                             writes a .hdr file


During the installation the two file example.img and example.hdr will have been unpacked. These are required for the following examples.

The file example.img is a 4D fMRI dataset. There are 21 axial slices each consisting of a 64x64 grid of 4mmx4mmx6mm voxels. There is only
one time point.

For the purpose of this example I assume you have put them in the same directory in which you started an R session.

1.  Load the package AnalyzeFMRI (as described above).

3. Get a summary of the data stored in the .img file using

[1]        File name:./example.img
[1]   Data Dimension: 4-D
[1]      X dimension: 64
[1]      Y dimension: 64
[1]      Z dimension: 21
[1]   Time dimension: 1 time points
[1] Voxel dimensions: 4mmx4mmx6mm
[1]        Data type: signed short (16 bits per voxel)

4. Read in the data from the .img file into an array using


5. Check the dimensions of the array

 >dim(A) [1] 64 64 21 1

6. Print out a slice of the dataset using


7. Read in a specific slice


and plot it using


8. Read in a time series from a given location


NB. Because example.img consists of only one time point this will only return one value

9. Create an array and save it in a file of 4 byte floats


10. The GUI can be started using

 >f.analyzeFMRI.gui()     NB. This depends on tcltk package

 (a) Navigate to a .img file using the Select File button.

 (b) Select on of the options

  (i) File Summary - prints a summary of the files contents
  (ii) Plot Time Series - plots a time series at a given location (x,y,z)
  (iii) Plot Periodogram - plots the periodogram of a time series at a given location (x,y,z)
  (iv) Image Slice - plots a slice (z,t)
  (v) Image Volume - plots an entire volume (t)
  (vi) Movie - iteratively plots a movie through time of a given slice (z)
  (vii) Spectral Summary - provides a graphical view of the spectral properties of an fMRI dataset (see R function f.spectral.summary for details)

 (c) Enter the required arguements for your option selection (see in brackets above)

 (d) Press OK.

 (e) You will be able to repeat if you want or press quit to stop the GUI.


If you have any problems/suggestions using this package, please email me on