marccd_header.h

Go to the documentation of this file.
00001 #define UINT32          unsigned int
00002 #define UINT16          unsigned short
00003 #define INT32           signed int
00004 #define INT16           signed short
00005 
00006 #define MAXIMAGES       9
00007 
00008 typedef struct {
00009         /* File/header format parameters (256 bytes) */
00010         UINT32        header_type;      /* flag for header type  (can be used as magic number) */
00011         char header_name[16];           /* header name (MMX) */
00012         UINT32        header_major_version;     /* header_major_version (n.) */
00013         UINT32        header_minor_version;     /* header_minor_version (.n) */
00014         UINT32        header_byte_order;/* BIG_ENDIAN (Motorola,MIPS); LITTLE_ENDIAN (DEC, Intel) */
00015         UINT32        data_byte_order;  /* BIG_ENDIAN (Motorola,MIPS); LITTLE_ENDIAN (DEC, Intel) */
00016         UINT32        header_size;      /* in bytes                     */
00017         UINT32        frame_type;       /* flag for frame type */
00018         UINT32        magic_number;     /* to be used as a flag - usually to indicate new file */
00019         UINT32        compression_type; /* type of image compression    */
00020         UINT32        compression1;     /* compression parameter 1 */
00021         UINT32        compression2;     /* compression parameter 2 */
00022         UINT32        compression3;     /* compression parameter 3 */
00023         UINT32        compression4;     /* compression parameter 4 */
00024         UINT32        compression5;     /* compression parameter 4 */
00025         UINT32        compression6;     /* compression parameter 4 */
00026         UINT32        nheaders;         /* total number of headers      */
00027         UINT32        nfast;            /* number of pixels in one line */
00028         UINT32        nslow;            /* number of lines in image     */
00029         UINT32        depth;            /* number of bytes per pixel    */
00030         UINT32        record_length;    /* number of pixels between succesive rows */
00031         UINT32        signif_bits;      /* true depth of data, in bits  */
00032         UINT32        data_type;        /* (signed,unsigned,float...) */
00033         UINT32        saturated_value;  /* value marks pixel as saturated */
00034         UINT32        sequence;         /* TRUE or FALSE */
00035         UINT32        nimages;          /* total number of images - size of each is nfast*(nslow/nimages) */
00036         UINT32        origin;           /* corner of origin             */
00037         UINT32        orientation;      /* direction of fast axis       */
00038         UINT32        view_direction;   /* direction to view frame      */
00039         UINT32        overflow_location;/* FOLLOWING_HEADER, FOLLOWING_DATA */
00040         UINT32        over_8_bits;      /* # of pixels with counts > 255 */
00041         UINT32        over_16_bits;     /* # of pixels with count > 65535 */
00042         UINT32        multiplexed;      /* multiplex flag */
00043         UINT32        nfastimages;      /* # of images in fast direction */
00044         UINT32        nslowimages;      /* # of images in slow direction */
00045         UINT32        background_applied; /* flags correction has been applied - hold magic number ? */
00046         UINT32        bias_applied;       /* flags correction has been applied - hold magic number ? */
00047         UINT32        flatfield_applied;  /* flags correction has been applied - hold magic number ? */
00048         UINT32        distortion_applied; /* flags correction has been applied - hold magic number ? */
00049         UINT32        original_header_type;     /* Header/frame type from file that frame is read from */
00050 
00051 
00052         char reserve1[(64-39)*sizeof(INT32)-16];
00053 
00054         /* Data statistics (128) */
00055         UINT32        total_counts[2];  /* 64 bit integer range = 1.85E19*/
00056         UINT32        special_counts1[2];
00057         UINT32        special_counts2[2];
00058         UINT32        min;
00059         UINT32        max;
00060         UINT32        mean;
00061         UINT32        rms;
00062         UINT32        p10;
00063         UINT32        p90;
00064         UINT32        stats_uptodate;
00065         UINT32        pixel_noise[MAXIMAGES];           /* 1000*base noise value (ADUs) */
00066         char reserve2[(32-13-MAXIMAGES)*sizeof(INT32)];
00067 
00068         /* More statistics (256) */
00069         UINT16 percentile[128];
00070 
00071 
00072         /* Goniostat parameters (128 bytes) */
00073         INT32 xtal_to_detector;         /* 1000*distance in millimeters */
00074         INT32 beam_x;                   /* 1000*x beam position (pixels) */
00075         INT32 beam_y;                   /* 1000*y beam position (pixels) */
00076         INT32 integration_time;         /* integration time in milliseconds */
00077         INT32 exposure_time;            /* exposure time in milliseconds */
00078         INT32 readout_time;             /* readout time in milliseconds */
00079         INT32 nreads;                   /* number of readouts to get this image */
00080         INT32 start_twotheta;           /* 1000*two_theta angle */
00081         INT32 start_omega;              /* 1000*omega angle */
00082         INT32 start_chi;                        /* 1000*chi angle */
00083         INT32 start_kappa;              /* 1000*kappa angle */
00084         INT32 start_phi;                        /* 1000*phi angle */
00085         INT32 start_delta;              /* 1000*delta angle */
00086         INT32 start_gamma;              /* 1000*gamma angle */
00087         INT32 start_xtal_to_detector;   /* 1000*distance in mm (dist in um)*/
00088         INT32 end_twotheta;             /* 1000*two_theta angle */
00089         INT32 end_omega;                        /* 1000*omega angle */
00090         INT32 end_chi;                  /* 1000*chi angle */
00091         INT32 end_kappa;                        /* 1000*kappa angle */
00092         INT32 end_phi;                  /* 1000*phi angle */
00093         INT32 end_delta;                        /* 1000*delta angle */
00094         INT32 end_gamma;                        /* 1000*gamma angle */
00095         INT32 end_xtal_to_detector;     /* 1000*distance in mm (dist in um)*/
00096         INT32 rotation_axis;            /* active rotation axis */
00097         INT32 rotation_range;           /* 1000*rotation angle */
00098         INT32 detector_rotx;            /* 1000*rotation of detector around X */
00099         INT32 detector_roty;            /* 1000*rotation of detector around Y */
00100         INT32 detector_rotz;            /* 1000*rotation of detector around Z */
00101         char reserve3[(32-28)*sizeof(INT32)];
00102 
00103         /* Detector parameters (128 bytes) */
00104         INT32 detector_type;            /* detector type */
00105         INT32 pixelsize_x;              /* pixel size (nanometers) */
00106         INT32 pixelsize_y;              /* pixel size (nanometers) */
00107         INT32 mean_bias;                        /* 1000*mean bias value */
00108         INT32 photons_per_100adu;       /* photons / 100 ADUs */
00109         INT32 measured_bias[MAXIMAGES]; /* 1000*mean bias value for each image*/
00110         INT32 measured_temperature[MAXIMAGES];  /* Temperature of each detector in milliKelvins */
00111         INT32 measured_pressure[MAXIMAGES];     /* Pressure of each chamber in microTorr */
00112         /* Retired reserve4 when MAXIMAGES set to 9 from 16 and two fields removed, and temp and pressure added
00113         char reserve4[(32-(5+3*MAXIMAGES))*sizeof(INT32)];
00114         */
00115 
00116         /* X-ray source and optics parameters (128 bytes) */
00117         /* X-ray source parameters (8*4 bytes) */
00118         INT32 source_type;              /* (code) - target, synch. etc */
00119         INT32 source_dx;                        /* Optics param. - (size microns) */
00120         INT32 source_dy;                        /* Optics param. - (size microns) */
00121         INT32 source_wavelength;                /* wavelength (femtoMeters) */
00122         INT32 source_power;             /* (Watts) */
00123         INT32 source_voltage;           /* (Volts) */
00124         INT32 source_current;           /* (microAmps) */
00125         INT32 source_bias;              /* (Volts) */
00126         INT32 source_polarization_x;    /* () */
00127         INT32 source_polarization_y;    /* () */
00128         char reserve_source[4*sizeof(INT32)];
00129 
00130         /* X-ray optics_parameters (8*4 bytes) */
00131         INT32 optics_type;              /* Optics type (code)*/
00132         INT32 optics_dx;                        /* Optics param. - (size microns) */
00133         INT32 optics_dy;                        /* Optics param. - (size microns) */
00134         INT32 optics_wavelength;                /* Optics param. - (size microns) */
00135         INT32 optics_dispersion;                /* Optics param. - (*10E6) */
00136         INT32 optics_crossfire_x;       /* Optics param. - (microRadians) */
00137         INT32 optics_crossfire_y;       /* Optics param. - (microRadians) */
00138         INT32 optics_angle;             /* Optics param. - (monoch. 2theta - microradians) */
00139         INT32 optics_polarization_x;    /* () */
00140         INT32 optics_polarization_y;    /* () */
00141 
00142 #ifdef FULL_HEADER 
00143         char reserve_optics[4*sizeof(INT32)];
00144 
00145         char reserve5[((32-28)*sizeof(INT32))];
00146 
00147         /* File parameters (1024 bytes) */
00148         char filetitle[128];            /* Title                                */
00149         char filepath[128];             /* path name for data file              */
00150         char filename[64];              /* name of data file                    */
00151         char acquire_timestamp[32];     /* date and time of acquisition         */
00152         char header_timestamp[32];      /* date and time of header update       */
00153         char save_timestamp[32];        /* date and time file saved             */
00154         char file_comments[512];        /* comments  - can be used as desired   */
00155         char reserve6[1024-(128+128+64+(3*32)+512)];
00156 
00157         /* Dataset parameters (512 bytes) */
00158         char dataset_comments[512];     /* comments  - can be used as desired   */
00159 
00160         char pad[3072-(256+128+256+(3*128)+1024+512)];     /* pad out to 3072 bytes */
00161 
00162 #endif
00163 
00164 } MARCCD_HEADER;
00165 
00166 /* size of frame */
00167 #define NFAST                   1024
00168 #define NSLOW                   1024
00169 
00170 /* possible orientations of frame data */
00171 #define HFAST                   0
00172 #define VFAST                   1
00173 
00174 /* possible origins of frame data */
00175 #define UPPER_LEFT              0
00176 #define LOWER_LEFT              1
00177 #define UPPER_RIGHT             2
00178 #define LOWER_RIGHT             3
00179 
00180 /* possible view directions of frame data for
00181    any given orientation and origin */
00182 /* KLUDGE - These are used as option array indices - must be 0,1... */
00183 #define FROM_SOURCE             0
00184 #define TOWARD_SOURCE           1
00185 
00186 
00187 /* possible locations in file of overflow table */
00188 #define FOLLOWING_DATA          0
00189 #define FOLLOWING_HEADER        1
00190 
00191 /* possible types of file format */
00192 #define LINEAR_8                1001
00193 #define LINEAR_OVERFLOW_8       1002
00194 #define LINEAR_16               1003
00195 #define LINEAR_OVERFLOW_16      1004
00196 #define LOG_8                   1005
00197 #define LOG_OVERFLOW_8          1006
00198 #define LOG_16                  1007
00199 #define LOG_OVERFLOW_16         1008
00200 #define HEX_16                  1009
00201 
00202 /* possible types of compression format */
00203 #define BUDDHA_20_COMPRESSION           1
00204 #define BUDDHA_30_COMPRESSION           2
00205 #define SIEMENS_8BIT_COMPRESSION        3
00206 #define LOG_COMPRESSION                 4
00207 #define BUDDHA_20_PEAKS                 5
00208 
00209 /* possible types of data */
00210 #define DATA_UNSIGNED_INTEGER   0
00211 #define DATA_SIGNED_INTEGER     1
00212 #define DATA_FLOAT              2
00213