Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

mayo_analyze.h

Go to the documentation of this file.
00001 #ifndef _RWC_ANALYZE_HEADER_
00002 /***************************************************************************
00003 From http://www.mayo.edu/bir/Analyze_Pages/AnalyzeFileInfo.html
00004 Describes the ANALYZE 7.5 file format (.img/.hdr pairs).
00005 ----------------------------------------------------------------
00006 The image database is the system of files that the ANALYZE package uses to
00007 organize and access image data on the disk. Facilities are provided for
00008 converting data from a number of sources for use with the package. A
00009 description of the database format is provided to aid developers in porting
00010 images from other sources for use with the ANALYZE TM system. An ANALYZE
00011 image database consists of at least two files:
00012 
00013    * an image file
00014    * a header file
00015 
00016 The files have the same name being distinguished by the extensions .img for
00017 the image file and .hdr for the header file. Thus, for the image database
00018 heart, there are the UNIX files heart.img and heart.hdr. The ANALYZE
00019 programs all refer to this pair of files as a single entity named heart.
00020 
00021 Image File
00022 
00023 The format of the image file is very simple containing usually uncompressed
00024 pixel data for the images in one of several possible pixel formats:
00025 
00026    * 1 bit            packed binary (slices must begin on byte boundaries)
00027    * 8 bit            8 bits per pixel (unsigned char)
00028    * 16 bit           16 bits per pixel (signed short)
00029    * 32 bit           32 bits per pixel signed integers, or floating point
00030    * 64 bit           64 bits per pixel; double precision, floating point,
00031                        or complex.
00032    * 24 bit           RGB , 8-bits per channel Red, Green, Blue.
00033 
00034 Header File
00035 
00036 The header file is represented here as a `C' structure which describes the
00037 dimensions and history of the pixel data. The header structure consists of
00038 three substructures:
00039 
00040      header_key         describes the header
00041      image_dimension    describes image sizes
00042      data_history       optional
00043 ****************************************************************************/
00044 
00045 struct header_key                       /* header key   */
00046        {                                /* off + size      */
00047        int sizeof_hdr;                  /* 0 + 4           */
00048        char data_type[10];              /* 4 + 10          */
00049        char db_name[18];                /* 14 + 18         */
00050        int extents;                     /* 32 + 4          */
00051        short int session_error;         /* 36 + 2          */
00052        char regular;                    /* 38 + 1          */
00053        char hkey_un0;                   /* 39 + 1          */
00054        };                               /* total=40 bytes  */
00055 struct image_dimension
00056        {                                /* off + size      */
00057        short int dim[8];                /* 0 + 16          */
00058        short int unused8;               /* 16 + 2          */
00059        short int unused9;               /* 18 + 2          */
00060        short int unused10;              /* 20 + 2          */
00061        short int unused11;              /* 22 + 2          */
00062        short int unused12;              /* 24 + 2          */
00063        short int unused13;              /* 26 + 2          */
00064        short int unused14;              /* 28 + 2          */
00065        short int datatype;              /* 30 + 2          */
00066        short int bitpix;                /* 32 + 2          */
00067        short int dim_un0;               /* 34 + 2          */
00068        float pixdim[8];                 /* 36 + 32         */
00069                        /*
00070                             pixdim[] specifies the voxel dimensitons:
00071                             pixdim[1] - voxel width
00072                             pixdim[2] - voxel height
00073                             pixdim[3] - interslice distance
00074                                 ...etc
00075                        */
00076        float vox_offset;                /* 68 + 4          */
00077        float funused1;                  /* 72 + 4          */
00078        float funused2;                  /* 76 + 4          */
00079        float funused3;                  /* 80 + 4          */
00080        float cal_max;                   /* 84 + 4          */
00081        float cal_min;                   /* 88 + 4          */
00082        float compressed;                /* 92 + 4          */
00083        float verified;                  /* 96 + 4          */
00084        int glmax,glmin;                 /* 100 + 8         */
00085        };                               /* total=108 bytes */
00086 struct data_history
00087        {                                /* off + size      */
00088        char descrip[80];                /* 0 + 80          */
00089        char aux_file[24];               /* 80 + 24         */
00090        char orient;                     /* 104 + 1         */
00091        char originator[10];             /* 105 + 10        */
00092        char generated[10];              /* 115 + 10        */
00093        char scannum[10];                /* 125 + 10        */
00094        char patient_id[10];             /* 135 + 10        */
00095        char exp_date[10];               /* 145 + 10        */
00096        char exp_time[10];               /* 155 + 10        */
00097        char hist_un0[3];                /* 165 + 3         */
00098        int views;                       /* 168 + 4         */
00099        int vols_added;                  /* 172 + 4         */
00100        int start_field;                 /* 176 + 4         */
00101        int field_skip;                  /* 180 + 4         */
00102        int omax, omin;                  /* 184 + 8         */
00103        int smax, smin;                  /* 192 + 8         */
00104        };
00105 struct dsr
00106        {
00107        struct header_key hk;            /* 0 + 40          */
00108        struct image_dimension dime;     /* 40 + 108        */
00109        struct data_history hist;        /* 148 + 200       */
00110        };                               /* total= 348 bytes*/
00111 
00112 /* Acceptable values for datatype */
00113 
00114 #define ANDT_NONE             0
00115 #define ANDT_UNKNOWN          0  /* what it says, dude           */
00116 #define ANDT_BINARY           1  /* binary (1 bit/voxel)         */
00117 #define ANDT_UNSIGNED_CHAR    2  /* unsigned char (8 bits/voxel) */
00118 #define ANDT_SIGNED_SHORT     4  /* signed short (16 bits/voxel) */
00119 #define ANDT_SIGNED_INT       8  /* signed int (32 bits/voxel)   */
00120 #define ANDT_FLOAT           16  /* float (32 bits/voxel)        */
00121 #define ANDT_COMPLEX         32  /* complex (64 bits/voxel)      */
00122 #define ANDT_DOUBLE          64  /* double (64 bits/voxel)       */
00123 #define ANDT_RGB            128  /* RGB triple (24 bits/voxel)   */
00124 #define ANDT_ALL            255
00125 
00126 #define ANDT_string(aa)                     \
00127  ((aa)==ANDT_BINARY        ? "binary"       \
00128  :(aa)==ANDT_UNSIGNED_CHAR ? "byte"         \
00129  :(aa)==ANDT_SIGNED_SHORT  ? "short"        \
00130  :(aa)==ANDT_SIGNED_INT    ? "int"          \
00131  :(aa)==ANDT_FLOAT         ? "float"        \
00132  :(aa)==ANDT_COMPLEX       ? "complex"      \
00133  :(aa)==ANDT_DOUBLE        ? "double"       \
00134  :(aa)==ANDT_RGB           ? "RGB"          \
00135  :                           "unknown" )
00136 
00137 /***************************************************************************
00138 The header format is flexible and can be extended for new user-defined data
00139 types. The essential structures of the header are the header_key and the
00140 image_dimension.
00141 
00142 The required elements in the header_key substructure are:
00143 
00144      int sizeof_header      Must indicate the byte size of the header file.
00145      int extents            Should be 16384, the image file is created as
00146                               contiguous with a minimum extent size.
00147      char regular           Must be `r' to indicate that all images and
00148                             volumes are the same size.
00149 
00150 The image_dimension substructure describes the organization and size of the
00151 images. These elements enable the database to reference images by volume and
00152 slice number. Explanation of each element follows:
00153 
00154      short int dim[]; = array of the image dimensions
00155           dim[0]      = Number of dimensions in database; usually 4
00156           dim[1]      = Image X dimension; number of pixels in an image row
00157           dim[2]      = Image Y dimension; number of pixel rows in slice
00158           dim[3]      = Volume Z dimension; number of slices in a volume
00159           dim[4]      = Time points, number of volumes in database.
00160 
00161           char vox_units[4] = specifies the spatial units of measure for a
00162                                voxel
00163           char cal_units[4] = specifies the name of the calibration unit
00164 
00165          short int datatype = datatype for this image set
00166                                Acceptable values for datatype are one of
00167                                the ANDT_* defines above
00168 
00169          short int bitpix   = number of bits per pixel; 1, 8, 16, 32, 64
00170          short int dim_un0  = unused
00171 
00172          float pixdim[]     = Parallel array to dim[], giving real world
00173                                measurements in mm and ms.
00174           pixdim[1]         = voxel width in mm
00175           pixdim[2]         = voxel height in mm
00176           pixdim[3]         = slice thickness in mm
00177          float vox_offset   = byte offset in the .img file at which voxels
00178                                start. This value can be negative to specify
00179                                that the absolute value is applied for every image
00180                                in the file
00181          float cal_max,     = specify the range of calibration values
00182                cal_min
00183          int glmax, glmin   = The maximum and minimum pixel values for the
00184                                entire database
00185 
00186 The data_history substructure is not required, but the orient field is used
00187 to indicate individual slice orientation and determines whether the Movie
00188 program will attempt to flip the images before displaying a movie sequence.
00189 
00190      orient = slice orientation for this dataset.
00191                 0 = transverse unflipped
00192                 1 = coronal unflipped
00193                 2 = sagittal unflipped
00194                 3 = transverse flipped
00195                 4 = coronal flipped
00196                 5 = sagittal flipped
00197 ****************************************************************************/
00198 #endif /* _RWC_ANALYZE_HEADER_ */
 

Powered by Plone

This site conforms to the following standards: