General Description
ANALYZE 7.5 File Format
The image database is the system of files that the ANALYZE package uses to organize and access image data on the disk. A description of the database format is provided here to aid developers in porting images from other sources for use with the ANALYZE system.
An ANALYZE image database consists of at least two files:
• an image file
• a header file
The files have the same name being distinguished by the extensions .img for the image file and .hdr for the header file. Thus, for the image database heart, there are the UNIX files heart.img and heart.hdr. The ANALYZE programs all refer to this pair of files as a single entity named heart.
Image File
The format of the image file is very simple containing usually uncompressed pixel data for the images in one of several possible pixel formats.
Header File
The header file is represented here as a `Visual Basic .Net' structure which describes the dimensions and history of the pixel data. The header structure consists of three substructures:
• header_key describes the header
• image_dimension describes image sizes
• data_history optional
Public Structure ANALYZEHeader
‘header_key
Dim SizeOfHeader As Int32
Dim Data_Type As String
Dim DatabaseName As String
Dim Extents As Int32
Dim SessionError As Int16
Dim Regular As Char
Dim HKeyUn As Char
‘image_dimension
Dim Ddim0 As Int16
Dim X As Int16
Dim Y As Int16
Dim Z As Int16
Dim Ddim4 As Int16
Dim Ddim5 As Int16
Dim Ddim6 As Int16
Dim Ddim7 As Int16
Dim VoxUnits As String
Dim CalUnits As String
Dim Unused1 As Int16
Dim DataType As Int16
Dim BitPix As Int16
Dim DimUn0 As Int16
Dim PixDim0 As Single
Dim PixDim1 As Single
Dim PixDim2 As Single
Dim PixDim3 As Single
Dim PixDim4 As Single
Dim PixDim5 As Single
Dim PixDim6 As Single
Dim PixDim7 As Single
Dim VoxOffset As Single
Dim ScaleFactor As Single
Dim FUnused2 As Single
Dim FUnused3 As Single
Dim CalMax As Single
Dim CalMin As Single
Dim Compressed As Single
Dim Verified As Single
Dim GLMax As Int32
Dim GLMin As Int32
‘data_history
Dim Descrip As String
Dim AuxFile As String
Dim Orient As String
Dim Originator As String
Dim Generated As String
Dim ScanNum As String
Dim PatientID As String
Dim ExpDate As String
Dim ExpTime As String
Dim HistUn0 As String
Dim Views As Int32
Dim VolsAdded As Int32
Dim StartField As Int32
Dim FieldsSkip As Int32
Dim Omax As Int32
Dim Omin As Int32
Dim Smax As Int32
Dim Smin As Int32
End Structure
Comments
The header format is flexible and can be extended for new user-defined data types. The essential structures of the header are the header_key and the image_dimension. The required elements in the header_key substructure are:
. • int sizeof_header Must indicate the byte size of the header file.
. • int extents Should be 16384, the image file is created as contiguous with a minimum extent size.
. • char regular Must be `r' to indicate that all images and volumes are the same size.
The image_dimension substructure describes the organization and size of the images. These elements enable the database to reference images by volume and slice number. Explanation of each element follows:
. • short int dim[]; array of the image dimensions
. • dim[0] Number of dimensions in database; usually 4
. • dim[1] Image X dimension; number of pixels in an image row
. • dim[2] Image Y dimension; number of pixel rows in slice
. • dim[3] Volume Z dimension; number of slices in a volume
. • dim[4] Time points, number of volumes in database.
. • char vox_units[4] specifies the spatial units of measure for a voxel
. • char cal_units[4] specifies the name of the calibration unit
. • short int datatype datatype for this image set
Acceptable values for datatype are
#define DT_NONE 0
#define DT_UNKNOWN 0 Unknown data type
#define DT_BINARY 1 Binary (1 bit per voxel)
#define DT_UNSIGNED_CHAR 2 Unsigned character (8 bits per voxel)
#define DT_SIGNED_SHORT 4 Signed short (16 bits per voxel)
#define DT_SIGNED_INT 8 Signed integer (32 bits per voxel)
#define DT_FLOAT 16 Floating point (32 bits per voxel)
#define DT_COMPLEX 32 Complex (64 bits per voxel)
#define DT_DOUBLE 64 Double precision (64 bits per voxel)
#define DT_RGB 128
#define DT_ALL 255
. • short int bitpix; number of bits per pixel; 1, 8, 16, 32, or 64.
. • short int dim_un0; unused
. • float pixdim[]; Parallel array to dim[], giving real world measurements in mm. and ms.
. • pixdim[1]; voxel width in mm.
. • pixdim[2]; voxel height in mm.
. • pixdim[3]; slice thickness in mm.
. • float vox_offset; byte offset in the .img file at which voxels start. This value can negative to specify that the absolute value is applied for every image in the file.
. • float calibrated Max, Min specify the range of calibration values
. • int glmax, glmin; The maximum and minimum pixel values for the entire database.
The data_history substructure is not required, but the orient field is used to indicate individual slice orientation and determines whether the Movie program will attempt to flip the images before displaying a movie sequence.
• orient: slice orientation for this dataset.
0 transverse unflipped
1 coronal unflipped
2 sagittal unflipped
3 transverse flipped
4 coronal flipped
5 sagittal flipped