Analyze DLM for IDL
The Analyze 7.5 format is a simple data format used by the (f)MRI research community. It's main advantage is its simplicity. Each data-set consists of an image file (.img) and a header file (.hdr). The header file stores, for example, information on the dimensions of the data-set and the voxel size. Since many tools use the Analyze format it would be useful if one could read and write data in Analyze format directly from IDL. Thus, I wrote a Dynamically Loadable Module (DLM) for IDL that provides a function for reading (read_analyze) and a function for writing (write_analyze) data in Analyze format. The DLM is available under conditions of the GNU Public License.
Documentation
The two functions provide only basic functionality, meaning that the only information in the header that is being supported is the dimension of the data-set and the voxel size. For installation instructions (and issues), please, see the PDF Version of the documentation (analyze_dlm.pdf).
read_analyze
Reads an Analyze data-set from disk and returns an IDL array of the same dimensions and data-type as the the data in the Analyze file. The Analyze data can be of following data types: byte, 16-bit signed integer, 32-bit signed integer, float, double and complex (consisting of two float values).
Syntax
The function read_analyze has following syntax:
result = read_analyze(Filename [,VOXEL_SIZE=vector] )
Return Value
Result is an array having the same dimensions and data type as the data stored in the Analyze data-set. There is an exception to this rule: in case the size of the last dimensions is 1, IDL truncates those dimensions.
Arguments
- Filename
- a string containing the name of the Analyze data-set which is to be read. The file-name can either be the name of the header file (having the suffix .hdr) or the image file (having the suffix .img) or the name without any suffix. In the first two cases the name of the missing file is obtained by replacing the suffix with .img or .hdr respectively. In the last case the respective suffices are added to obtain the name of the header and the image file.
Keywords
- VOXEL_SIZE
- This keyword takes a variable into which the voxel geometry is stored. The variable does not have to be set to a value before it is passed to the function. After execution the variable will contain a float array with the voxel geometry.
write_analyze
Writes an IDL array to disk as Analyze data-set. The array can have up to seven dimensions and be of the following data types: BYTE, INTEGER, LONG, FLOAT, DOUBLE or COMPLEX. The Analyze header created by write_analyze only contains information on the image dimensions and data type.
Syntax
The procedure write_analyze has following syntax:
write_analyze, Filename, Data [,VOXEL_SIZE=vector]
Arguments
- Filename
- a string containing the name of the Analyze data-set which is to be read. The file-name can either be the name of the header file (having the suffix .hdr) or the image file (having the suffix .img) or the name without any suffix. In the first two cases the name of the missing file is obtained by replacing the suffix with .img or .hdr respectively. In the last case the respective suffices are added to obtain the name of the header and the image file.
- Data
- an array containing the data which are to be stored. The array can have up to seven dimensions and be of one of the following data types: BYTE, INTEGER, LONG, FLOAT, DOUBLE, COMPLEX If the array is of any other data type the function returns an error message and the data is not saved.
Keywords
- VOXEL_SIZE
- a one-dimensional vector that contains the voxel geometry (in mm). The vector can contain as many elements as the image has dimensions, but has to have at least three elements.
Download
- Source: analyze_dlm.tar.gz
- Binaries: Linux 32bit, Linux 64bit
- Documentation: analyze_dlm.pdf