VAPET Format

A 3D image (volume) saved in VAPET format consists of an ASCII header followed by the volume data (voxel values) stored as binary data. In addition, multiple volumes can be saved in one VAPET file using the Multiple Volume VAPET Format.


VAPET Header

A VAPET header consists of ASCII keyword/value pairs (except for the first line which holds the VAPET identifier 'vaphdr'). The size of the header is usually 512 bytes but is allowed to be larger if the keyword/value pairs require more space. The actual size is indicated by the 'hdrsz' field. If this field is missing, then the size is assumed to be 512 bytes. The last character in all VAPET volumes is the form feed (^L). The following is a typical header:


hdrsz=512                 ; size of header in bytes
hdrver=1                  ; current version of VAPET header

type=p                    ; modality (p -> PET, m -> MRI)
site=va_mpls              ; where data was collected
study=p01488              ; string identifying scan session
scandate=11/12/1997       ; date of scan
scanstart=10:06:00        ; time of scan
physician=dar             ; physician
description=nl brain      ; description of scan/patient
reconstruction=1          ; integer specifiying type of reconstruction

patid=1111111111          ; patient id number
name=Anderson,Jon         ; name of patient
age=34                    ; age of patient
sex=M                     ; sex of patient
weight=0                  ; weight of patient
height=6                  ; height of patient
hand=R                    ; handedness

rank=3                    ; dimension of data (2D or 3D)
size=128 128 48           ; size of volume
cmpix=0.31293 0.31293 0.33750 ; size of voxels in cm's
orient=lr                 ; left/right orientation
datatype=f                ; type of data (u=unsigned, i=integer, f=float)
data=4                    ; number of bytes needed for each voxel
min=0.0000000             ; minimum value in data
max=0.0172531             ; maximum value in data
mult=0                    ; indicates if single or multiple volume file
vnum=1                    ; number of volumes saved in file
matrix=128 128 48         ; size of data matrix (for multiple volume files)
xdr=1                     ; indicates if data saved in XDR format

(PET specific fields)
(MRI specific fields)

Note, some of the old VAPET volumes may not have all the fields lists above.


Single Volume VAPET Format

A volume in VAPET format consists of a VAPET header followed by binary data. Let the volume size be N x M x P, where N is the number of pixels running from left to right [x axis], M the number of pixels running from anterior (nose) to posterior (back of head) [y axis], and P the number of pixels running from inferior (cerebellum) to superior (top of head) [z axis]. The data elements (voxels) are stored in row-major format:

      (x1,y1,z1)       most left, most anterior, most inferior point in volume
      (x2,y1,z1)
      (x3,y1,z1)
          .
          .
          .
      (N ,y1,z1)       end of first row of first axial image
      (x1,y2,z1)
      (x2,y2,z1)
      (x3,y2,z1)
          .
          .
          .
      (N, y2,z1)       end of second row of first axial image
          .
          .
          .
      (N, M, z1)       end of first axial image
      (x1,y1,z2)       beginning of second axial image
          .
          .
          .
      (N, M, z2)       end of second axial image
          .
          .
          .
      (N, M, P )       most right, most posterior, most superior point in volume
The type of each data element is defined by the 'datatype' and 'data' fields in the VAPET header. Do a 'more' on the volume file and look at these fields. The 'datatype' will have one of 3 values: 'u' (unsigned), 'i' (integer/long), or 'f' (float/double). The 'data' field will be the size, in bytes, of each data element. For example, if datatype=i and data=2, then each data element is a 2 byte integer; if datatype=f and data=4, then each data element is a 4 byte float (single precision).


Multiple Volume VAPET Format

Some VAPET data files hold multiple volumes. For example, CVA creates a spatial pattern for each CVA dimension. These volumes are saved in one disk file. The volumes to be saved in multiple volume VAPET format are first stuff into a 2D matrix, with the first row holding the non-zero voxel values from the first volume, the second row holding the non-zero voxels values from the second volume, etc. Thus, row i, column j holds the data value for volume i, region j. The (x,y,z) voxel location of region j is encoded in a 1D volume locations vector. Say there are Q volumes and R non-zero voxels, then the volume data matrix will be Q x R and the locations vector will have R elements. A point (x,y,z), 0 relative, in a volume is encoded in the locations vector by:

L = x + N*y + (N*M)*z, where N,M,P are the volume dimensions in the x, y, z directions, respectively.

We can also go the other way. Given L we can compute x, y, and z by:

z = L / (N*M)
y = (L - z*N*M)/ N
x = L - z*N*M - y*N.

The VAPET file is then constructed with a VAPET header, followed by the locations vector consisting of R four byte integers, followed by the 2D data matrix consisting of Q rows and R columns. As with the single volume VAPET format, the size and type of each data element is defined by the data and datatype fields in the VAPET header.

In summary, the multiple volume VAPET format is:

[VAPET header]                 usually 512 bytes (see 'hdrsz' field)
[volume locations vector]      R 4 byte elements (long integers)
[volume 1 data]                R data elements (see 'data' and 'datatype' fields)
[volume 2 data]                R data elements
...
[volume Q data]                R data elements
File size = [header size] + 4*R + Q*R*[data size], where Q is number of volumes and R is number of non-zero regions.