/* * KRENIKON Datei Header -- Markus Kuhn, IPB * * Der Header einer Siemens Krenikon Datei besteht aus einem groesseren * C struct, das so ausgegeben wird, wie es der SunOS C-Compiler im * Speicher darstellt. Daher kann dieses struct Krehead unter SunOS * einfach mit fread eingelesen und mit fwrite ausgelesen werden. * Unter MS-DOS ist dies nicht moeglich, da folgende Unterschiede * bestehen: * * 1. Sun speichert Werte im Bigendian-Format (Hi-Byte zuerst) * ab, waehrend INTEL Prozessoren das Litteendian-Format verwenden. * 2. Auf einer Sun ist int ein 32-bit Wert. * 3. Die Sun float Werte sind vermutlich im IEEE Format abgelegt, * das von Borland Compilern auch benutzt werden kann. Ob aber * eine Sun 1.00000000 auch eine Borland 1.00000000 ist, kann * ich nicht garantieren. Da Siemens hochintelligenterweise * oft floats fuer Kennzahlen (z.B. co_0) verwendet hat, sollte man * die relevanten Konstanten besser als 32-bit integers einlesen * und vergleichen, das ist wohl die sicherste Methode ... * * Daher muss man wohl oder uebel unter DOS eine etwas aufwendigere * Einleseroutine schreiben, die jeder Variable im struct ihren * Wert einzeln einliest und zuweist. * * $Id: kre2ebs.h,v 1.3 1994/02/11 11:02:32 msprosch Exp $ * */ /* Die Felder version und header_id hatten bei allen bis jetzt getesteten Dateien die folgenden Werte. Ein gutes Programm sollte sie ueberpruefen und bei Differenzen den Benutzer darauf hinweisen, dass er es evtl. mit einem neuen Headerformat zu tun hat. */ #define KREHEAD_VERSION 1 #define KREHEAD_HEADER_ID 0xbadeaffe /* the magic number */ #define KREHEAD_HEADER_BYTES 25600 #define CHANNELS 128 /* Groesse der Arrays fuer alle Kanaele */ /* Ein paar Typen fuer Siemens */ typedef unsigned char byte; typedef unsigned int unsigned_int; /* Und hier das grosse struct: */ struct krehead { float version; /* header version, hoffentlich gleich KREHEAD_VERSION */ int header_bytes; /* die Laenge des Headers, danach gehen die Daten los */ int header_id; /* wenn hier nicht KREHEAD_HEADER_ID steht, dann ist es wohl gar keine KRENIKON Datendatei. */ int start_pos; /* Angaben ueber den Patienten */ char pat_id[40]; char last_name[40]; char first_name[40]; char birth_date[20]; char institute_name[255]; char overflow_filename[255]; char spike_filename[255]; char inset_filename[255]; float inset_version; int chan_group_number[CHANNELS]; byte chan_filt[128]; float multi_channel_freq[CHANNELS]; int mux_bas_freq; int mux_freq_div; int light_barrier_code; /* Angaben ueber die Daten: */ int ring_buf_start_byte; int ring_buf_end_byte; int num_of_bytes; /* data length */ int ring_buf_size; int post_acqu_start; int post_acqu_end; int measure_start_time; /* UNIX date/time */ int measure_end_time; /* UNIX date/time */ int dcp_dummy1; int dcp_dummy2; int nhead; int nnchn_old; int ndat; /* number of samples */ int nchn; /* number of channels */ int chnstart; int chninc; float frequ; /* scanning rate */ float tmess; /* measured time */ char daytime[20]; float notch; float amplification[CHANNELS]; int channels[CHANNELS]; /* physical -> logical channels */ int phychannels[CHANNELS]; /* logical -> physical channels */ int chblocks; float sensi[CHANNELS]; /* channel sensibility */ float freql; /* lower frequency */ float freqh; /* upper frequency */ int resol; /* max. data value */ float volts; /* max. ADC value (volts) */ float area1; /* gradiometer inset 1 */ float baseline1; /* baseline inset 1 */ int form1; /* geometrie inset 1 */ int meastype; /* type of measurement */ int insetcount; /* used insets */ float chara[8]; int postblocks; char pat[384]; /* remarks to measurement */ char electrodes[CHANNELS][7]; /* electrode names */ float co_0[CHANNELS]; /* biological source data type */ float co_1[CHANNELS]; /* sensor type */ float co_2[CHANNELS]; /* x-coordinate of pick-up-coordinate */ float co_3[CHANNELS]; /* y-coordinate of pick-up-coordinate */ float co_4[CHANNELS]; /* z-coordinate of pick-up-coordinate */ float co_5[CHANNELS]; /* THETA between sensor x and ... */ float co_6[CHANNELS]; /* PHI between x axis and sensor ... */ float co_7[CHANNELS]; /* rotation of non-circular ... */ float co_8[CHANNELS]; /* number of turns of pick-up-coil */ float co_9[CHANNELS]; /* area of pick-up-coil in cm... */ float co_10[CHANNELS]; /* x-coordinate of 1. compensation coil*/ float co_11[CHANNELS]; /* y-coordinate of 1. compensation coil*/ float co_12[CHANNELS]; /* z-coordinate of 1. compensation coil*/ float co_13[CHANNELS]; /* number of turns of 1. compens. coil*/ float co_14[CHANNELS]; /* area of compensation coil */ float co_15[CHANNELS]; /* x-coordinate of 2. compensation coil*/ float co_16[CHANNELS]; /* y-coordinate of 2. compensation coil*/ float co_17[CHANNELS]; /* z-coordinate of 2. compensation coil*/ float co_18[CHANNELS]; /* area of 2. pick-up-coil in ... */ float co_19[CHANNELS]; /* area of 2. compensation coil in ...*/ float co_20[CHANNELS]; /* shape of gradiometer */ float filt[10][10]; char filtername[10][255]; int filtchan[10][8]; char filename[255]; char inset[10]; char dewar[10]; char chips[32]; float xa; /* bed system */ float ya; float zcoarse; /* height adjustment */ float zfine1; /* height adjustment */ float beta2; /* x-axis rotation */ float beta1_1; /* y-axis rotation */ float alpha1; /* z-axis rotation */ float zfine2; float beta1_2; float alpha2; char department[40]; int ac_dc_meas; /* 0: DC-measurement */ int dc_offset; float measurement_sw_version; int machine_id; float estim_head_middle_x; float estim_head_middle_y; float estim_head_middle_z; float estim_x_dewar; /* in dewar system */ float estim_y_dewar; float estim_z_dewar; float estim_head_radius; char patient_adjust[255]; float bite_height; float bite_angle; char bite_pillow_num[255]; char units[CHANNELS][10]; byte no_auto_archival; byte archived; float distance_x_x_axis; float distance_y_y_axis; float distance_grad_dewar; float distance_ref_dewar; float height_x_ref; float height_y_ref; float height_bed_ref; float bite_0[3][3][6]; /* default adjustment bite_0 */ /* 6 Werte je: x_start, y_start, z_start, x_end, y_end, z_end */ /* Fuer 3 planes je 3 watermarks, was immer das alles ein mag */ float bite_1[3][3][6]; /* modification adjustment bite_1 */ /* 6 Werte je: x_start, y_start, z_start, x_end, y_end, z_end */ /* Fuer 3 planes je 3 watermarks, was immer das alles ein mag */ byte split_part; /* split segment */ unsigned_int start_cycle; unsigned_int length_in_cycles; char preferred_host[64]; float heart_array[10]; char heart_string1[40]; char heart_string2[40]; }; /* Ueblicherweise definiert sich ein Programm, das aus einer KRENIKON Datei liest die Variable Krehead h. */ typedef struct krehead Krehead;