# Functions for manipulating AVW header files

The LoadVarian program now places 'useful' information into the AVW header files. The AVW header is a C structure, called `dsr` defined in the file dbh.h. The fields filled in by LoadVarian are listed below.

dsr | Description | Common Name
`header.dime.dim[1]``` | Matrix size in X dimension (points) | xdim
`header.dime.dim[2]``` | Matrix size in Y dimension (lines) | ydim
`header.dime.dim[3]``` | Matrix size in Z dimension (slices) | zdim
`header.dime.dim[4]``` | Number of volumes | vdim
`header.dime.pixdim[1]``` | Voxel dimension along X | xvox
`header.dime.pixdim[2]``` | Voxel dimension along Y | yvox
`header.dime.pixdim[3]``` | Voxel dimension along Z (slice thickness) | zvox
`header.dime.pixdim[4]``` | Time between acquisition of volumes (in seconds) | tr
`header.dime.datatype``` | Data type (short,float,complex,etc.) | dt
`header.dime.glmax``` | Maximum value to display | max
`header.dime.glmin``` | Minimum value to display | min
`header.hist.orient``` | Image orientation (Axial,Sagittal,Coronal) | orient
`header.hk.db_name``` | Study ID | study
`header.hist.descrip``` | Experiment description | descrip
`header.hist.scannum``` | Scan number in study | scannum
`header.hist.patient_id``` | Patient name or id number | patient
`header.hist.exp_data``` | Date of scan | date

To maintian this information in the header file, and pass it on from file to file, the following stratagy is recommended. All the helper functions to do this are availiable in the files `new_hfunc.h` and `new_hfunc.c`.

    #include "new_hfunc.h" /* Use functions in new_hfunc.c */

    int main(int argc,char *argv[])
    {
      struct dsr header;  /* Declare a header structure  */

      avw_read(filename,&header);  /* Read data from file to stucture  */

      avw_get_dim(&header,&xdim,&ydim,&zdim,&vdim);  /* Find matrix dimensions */

      avw_set_maxmin(&header,max,min);  /* Set intensity maximum and minimum */

      avw_write(filename,&header);  /* Write data from stucture to file */
    }

A number of functions are availiable in new_hfunc.c change the parameters shown in the table above.

Back to my home page.
Stuart Clare 2.9.99