This page explains how to install the S-PLUS library AnalyzeRead5. I assume that you have a basic knowledge of UNIX/LINUX and that you already have S-PLUS 5.x installed on your machine.
AnalyzeRead5 contains functions that allow ANALYZE image format .img and .hdr files to be read into S-PLUS 5.x automatically
I created this package for two reasons.
(1) These functions provide an interface between S-PLUS and ANALYZE files. Many fMRI datasets are stored in this format and S-PLUS provides a very flexible platform upon which to explore and analyze these datasets. I hope this may be useful to other Statisticians/Researchers.
(2) I wanted to practise how to create a S-PLUS library! To do this i used the book `S Programming' by Venables and Ripley.
If you have any problems/suggestions using this package, please email me on firstname.lastname@example.org
1. Download the g-zipped tar archive AnalyzeRead5.tar.gz
2. Unzip the file using gunzip AnalyzeRead5.tar.gz
3. Unpack the archive using tar -xvf AnalyzeRead5.tar
This will create a directory in called AnalyzeRead5
4. Move this
directory (with it's contents) to the default S-PLUS 5.x library tree on
your machine IF you have permission.
If not create your own library directory somewhere i.e. mkdir ~/lib and move the directory AnalyzeRead5 there.
5. Create the library from within the AnalyzeRead5 directory by running the script
6. You can then start an S-PLUS session from where you like and load the library using
- Assuming you put it in ~/lib
library(AnalyzeRead5) - Assuming you put it into the default S-PLUS 5.x library tree
7. Use the EXAMPLES section to see how the functions work.
The library contains just three functions which call C code to access the files
- reads a .hdr file and returns it as a list
f.read.analyze.volume - reads in a .img file into an array
f.analyze.file.summary - summarises the contents of a .img file
The functions come with help files
You can download a g-zipped .img/.hdr image pair from
The file example.img is a 4D fMRI
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 S-PLUS session and unzipped them.
1. Load the library AnalyzeRead5 (as described above).
2. Get a summary of the data stored in the .img file using
 File name: ./example.img
 Data Dimension: 4-D
 X dimension: 64
 Y dimension: 64
 Z dimension: 21
 Time dimension: 1 time points
 Voxel dimensions: 4mmx4mmx6mm
 Data type: signed short (16 bits per voxel)
3. Read in the data from the .img file into an array using
4. Check the dimensions of the array
 64 64 21 1
6. Print out a slice of the dataset using
If you have any problems/suggestions
using this package, please email me on email@example.com