annotate saitools/saicut.c @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
rev   line source
tomwalters@0 1 /*
tomwalters@0 2 Copyright (c) Applied Psychology Unit, Medical Research Council. 1993
tomwalters@0 3 ===========================================================================
tomwalters@0 4
tomwalters@0 5 Permission to use, copy, modify, and distribute this software without fee
tomwalters@0 6 is hereby granted for research purposes, provided that this copyright
tomwalters@0 7 notice appears in all copies and in all supporting documentation, and that
tomwalters@0 8 the software is not redistributed for any fee (except for a nominal
tomwalters@0 9 shipping charge). Anyone wanting to incorporate all or part of this
tomwalters@0 10 software in a commercial product must obtain a license from the Medical
tomwalters@0 11 Research Council.
tomwalters@0 12
tomwalters@0 13 The MRC makes no representations about the suitability of this
tomwalters@0 14 software for any purpose. It is provided "as is" without express or
tomwalters@0 15 implied warranty.
tomwalters@0 16
tomwalters@0 17 THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
tomwalters@0 18 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
tomwalters@0 19 THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
tomwalters@0 20 OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
tomwalters@0 21 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
tomwalters@0 22 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
tomwalters@0 23 SOFTWARE.
tomwalters@0 24 */
tomwalters@0 25 /* saicut.c
tomwalters@0 26 * ------------
tomwalters@0 27 *
tomwalters@0 28 * Cuts out frames or channels (or both) from a .sai
tomwalters@0 29 * output= .sai
tomwalters@0 30 *
tomwalters@0 31 * options: -frame <start> <end> (units=frame numbers; INCLUSIVE).
tomwalters@0 32 * -channel <low> <high> (units=channel nos; INCLUSIVE).
tomwalters@0 33 * (both arguments are needed).
tomwalters@0 34 *
tomwalters@0 35 * When using verbose, those frame numbers that are NOT kept are put in
tomwalters@0 36 * round brackets ().
tomwalters@0 37 *
tomwalters@0 38 *
tomwalters@0 39 * M Akeroyd. June 1993. v1.00 Revised Spring 1994.
tomwalters@0 40 * Lots of extra options Winter 1995.
tomwalters@0 41 */
tomwalters@0 42
tomwalters@0 43
tomwalters@0 44
tomwalters@0 45 #include <stdio.h>
tomwalters@0 46 #include <string.h>
tomwalters@0 47 #include <stdlib.h>
tomwalters@0 48 #include "tip.h"
tomwalters@0 49
tomwalters@0 50
tomwalters@0 51
tomwalters@0 52
tomwalters@0 53 /* Function declarations */
tomwalters@0 54 /*-------------------------------------------------------------------------*/
tomwalters@0 55
tomwalters@0 56 void parsecommandline (int argc, char *argv[], char inputfn[], char outputfn[]);
tomwalters@0 57 int readheader(FILE *inputfp);
tomwalters@0 58 void checkheader();
tomwalters@0 59 void writeheader(FILE *outputfp);
tomwalters@0 60 void changeheader(int no_frames, int new_pwidth, int new_nwidth, int framewidthsamples_output);
tomwalters@0 61 void changeheader_B(int new_mincf, int new_maxcf, int new_channels);
tomwalters@0 62
tomwalters@0 63 void writedata_output (FILE *outputfp, int samples_to_write);
tomwalters@0 64 FILE *open_file (char filefn[], FILE *dir_default, int streamtype);
tomwalters@0 65
tomwalters@0 66
tomwalters@0 67 /* Data Arrays */
tomwalters@0 68 /* ------------------------------------------------------------------------*/
tomwalters@0 69 short inputdata[MAX_DATA];
tomwalters@0 70 short inputbychannel[MAX_CHANNELS][MAX_DATA];
tomwalters@0 71 short outputfiguredata[MAX_DATA];
tomwalters@0 72 short outputgrounddata[MAX_DATA];
tomwalters@0 73
tomwalters@0 74 #define MAX_STROBES 2000
tomwalters@0 75 int strobelocation[MAX_STROBES];
tomwalters@0 76
tomwalters@0 77 /* variables read from header */
tomwalters@0 78 /*-------------------------------------------------------------------------*/
tomwalters@0 79 char header[MAX_LINES_HEADER][MAX_LINE_LENGTH];
tomwalters@0 80 int header_lines;
tomwalters@0 81
tomwalters@0 82 /* .sai parameters */
tomwalters@0 83 int no_frames;
tomwalters@0 84 int frameheight; /* number of channels */
tomwalters@0 85 int framewidth_samples; /* pwidth + nwidth * samplerate */
tomwalters@0 86 int frameshift_samples; /* frstep_aid * samplerate */
tomwalters@0 87 int pwidth; /* in msecs */
tomwalters@0 88 int nwidth; /* in msecs: NEGATIVE */
tomwalters@0 89 int width_win; /* pixels */
tomwalters@0 90 int height_win; /* pixels */
tomwalters@0 91 long samplerate; /* samples per sec */
tomwalters@0 92 int mincf; /* Hz */
tomwalters@0 93 int maxcf; /* Hz */
tomwalters@0 94
tomwalters@0 95 /* parameters read from command line*/
tomwalters@0 96 int framestart;
tomwalters@0 97 int frameend;
tomwalters@0 98 int minchannel;
tomwalters@0 99 int maxchannel;
tomwalters@0 100
tomwalters@0 101 int cut_timestart;
tomwalters@0 102 int cut_timeend;
tomwalters@0 103 int counter;
tomwalters@0 104 float sum;
tomwalters@0 105 float tempf;
tomwalters@0 106 float timestart, timeend;
tomwalters@0 107
tomwalters@0 108 /* misc */
tomwalters@0 109 /*-----------------------------------------------------------------------*/
tomwalters@0 110
tomwalters@0 111 char progname[MAX_STRING_LENGTH];
tomwalters@0 112 char outputfigurefn[MAX_STRING_LENGTH];
tomwalters@0 113 char strobefn[MAX_STRING_LENGTH];
tomwalters@0 114
tomwalters@0 115
tomwalters@0 116 int verboseflag = OFF; /* -v */
tomwalters@0 117 int frameflag = OFF; /* -f */
tomwalters@0 118 int channelflag = OFF; /* -c */
tomwalters@0 119 int greyscaleflag = OFF; /* Not used: required for compilation */
tomwalters@0 120 int oppositearchflag = OFF; /* -oparch : see saigraph.c for info */
tomwalters@0 121 int sumflag = OFF;
tomwalters@0 122 int averageflag = OFF;
tomwalters@0 123 int timeflag = OFF;
tomwalters@0 124 int headerflag = ON;
tomwalters@0 125 int strobeflag = OFF;
tomwalters@0 126 int strobevalue = 1; /* the value used to mark a strobe event in
tomwalters@0 127 the .trigger file */
tomwalters@0 128 int cutthisframe = OFF;
tomwalters@0 129 int infoflag = OFF;
tomwalters@0 130 int forceframeflag = OFF;
tomwalters@0 131 int forceframe = 0;
tomwalters@0 132 int successforceflag = OFF;
tomwalters@0 133
tomwalters@0 134 /* ................... Main ................................*/
tomwalters@0 135 /* .........................................................................*/
tomwalters@0 136 /* .........................................................................*/
tomwalters@0 137
tomwalters@0 138
tomwalters@0 139
tomwalters@0 140 void main (int argc, char *argv[])
tomwalters@0 141 {
tomwalters@0 142 int n, sample;
tomwalters@0 143 int frame, channel;
tomwalters@0 144 int trigger_peak = 0;
tomwalters@0 145 int header_bytes = 0;
tomwalters@0 146 int cut_framestart, cut_frameend, cut_no_frames;
tomwalters@0 147 int cut_minchannel, cut_maxchannel, cut_frameheight;
tomwalters@0 148 char inputfn[MAX_STRING_LENGTH], outputbasefn[MAX_STRING_LENGTH];
tomwalters@0 149 FILE *inputfp, *outputfigurefp;
tomwalters@0 150 FILE *strobefp;
tomwalters@0 151 int x, counter, previousx;
tomwalters@0 152 int nstrobes;
tomwalters@0 153 short sampledata[2];
tomwalters@0 154
tomwalters@0 155 /*-------------------------------------*/
tomwalters@0 156 strcpy(progname, argv[0]);
tomwalters@0 157 strcpy(inputfn, "");
tomwalters@0 158 strcpy(outputbasefn, "");
tomwalters@0 159 strcpy(outputfigurefn, "");
tomwalters@0 160
tomwalters@0 161 parsecommandline(argc, argv, inputfn, outputbasefn);
tomwalters@0 162
tomwalters@0 163 if (strcmp(outputbasefn, "") == 0)
tomwalters@0 164 strcpy(outputfigurefn, "");
tomwalters@0 165 else {
tomwalters@0 166 strcpy(outputfigurefn, outputbasefn);
tomwalters@0 167 /* strcat(outputfigurefn, OUTPUT_EXT);*/
tomwalters@0 168 }
tomwalters@0 169
tomwalters@0 170 /*--------------------------------------*/
tomwalters@0 171 /* open files, read and check header */
tomwalters@0 172 inputfp = open_file(inputfn, stdin, READ);
tomwalters@0 173 outputfigurefp = open_file(outputfigurefn, stdout, WRITE);
tomwalters@0 174 header_bytes = readheader(inputfp);
tomwalters@0 175 checkheader();
tomwalters@0 176
tomwalters@0 177 /*-------------------------------------*/
tomwalters@0 178 /* strobe code */
tomwalters@0 179 if (strobeflag == ON){
tomwalters@0 180 strobefp = open_file(strobefn, stderr, READ);
tomwalters@0 181 /* note
tomwalters@0 182 * add (nwidth * samplerate) to the index
tomwalters@0 183 * the frame number is the floor of that + 1 (because it seems to give the correct answer)
tomwalters@0 184 * some versions of gensai return a triggerpoint 3 samples across; take the first.
tomwalters@0 185 */
tomwalters@0 186 for (x=0; x<MAX_STROBES; x++)
tomwalters@0 187 strobelocation[x] = 0;
tomwalters@0 188 x=0; counter=1;
tomwalters@0 189 previousx=0;
tomwalters@0 190 while( feof(strobefp) ==0) {
tomwalters@0 191 fread(sampledata, 2, 1, strobefp);
tomwalters@0 192 if (sampledata[0] >= strobevalue){
tomwalters@0 193 if (((x-previousx) <= 2) && (previousx != 0))
tomwalters@0 194 /* don't need this trigger */
tomwalters@0 195 continue;
tomwalters@0 196 strobelocation[counter] = x;
tomwalters@0 197 tempf = (float) strobelocation[counter] + (-1.0 * nwidth * samplerate / 1000.0);
tomwalters@0 198 tempf = tempf * 1.0 / frameshift_samples;
tomwalters@0 199 /* tempf = floor(tempf);*/
tomwalters@0 200 strobelocation[counter] = (int) tempf + 1.0;
tomwalters@0 201 /* if (verboseflag == ON)
tomwalters@0 202 fprintf(stderr, "strobe %i: %i samples %f (%i frames)\n", counter, x, tempf, (int)strobelocation[counter]);*/
tomwalters@0 203 previousx=x;
tomwalters@0 204 counter++;}
tomwalters@0 205 x++;
tomwalters@0 206 if (counter >= MAX_STROBES){
tomwalters@0 207 fprintf(stderr, " %s : too many strobes in .trigger file.\n", progname);
tomwalters@0 208 exit(-1);}
tomwalters@0 209 }
tomwalters@0 210 nstrobes=counter-1;
tomwalters@0 211 if (infoflag == ON){
tomwalters@0 212 fprintf(stderr, "using %i frames ", nstrobes);
tomwalters@0 213 for (counter=1; counter <=nstrobes; counter ++)
tomwalters@0 214 fprintf(stderr, " %i", strobelocation[counter]);
tomwalters@0 215 fprintf(stderr, "\n");}
tomwalters@0 216 fclose(strobefp);
tomwalters@0 217 }
tomwalters@0 218
tomwalters@0 219 /*--------------------------------------*/
tomwalters@0 220
tomwalters@0 221 /* reset the frame/channel counters */
tomwalters@0 222 if (frameflag == ON) {
tomwalters@0 223 cut_frameend = frameend;
tomwalters@0 224 cut_framestart = framestart; }
tomwalters@0 225 else {
tomwalters@0 226 cut_frameend = no_frames;
tomwalters@0 227 cut_framestart = 1; }
tomwalters@0 228
tomwalters@0 229 if (channelflag == ON) {
tomwalters@0 230 cut_maxchannel = maxchannel;
tomwalters@0 231 cut_minchannel = minchannel; }
tomwalters@0 232 else {
tomwalters@0 233 cut_maxchannel = frameheight;
tomwalters@0 234 cut_minchannel = 1; }
tomwalters@0 235
tomwalters@0 236 if (timeflag == ON) {
tomwalters@0 237 cut_timestart = samplerate * timestart/1000;
tomwalters@0 238 cut_timeend = samplerate * timeend/1000;}
tomwalters@0 239 else{
tomwalters@0 240 cut_timestart = 0;
tomwalters@0 241 cut_timeend = framewidth_samples;}
tomwalters@0 242
tomwalters@0 243 /* fprintf(stderr, "%d \n", cut_timestart);*/
tomwalters@0 244 /* fprintf(stderr, "%d \n", cut_timeend);*/
tomwalters@0 245
tomwalters@0 246 cut_no_frames = cut_frameend - cut_framestart + 1; /* inclusive, so +1 */
tomwalters@0 247 cut_frameheight = cut_maxchannel - cut_minchannel + 1; /* inclusive, so +1 */
tomwalters@0 248 if (strobeflag == ON)
tomwalters@0 249 cut_no_frames = nstrobes;
tomwalters@0 250
tomwalters@0 251 /*--------------------------------------*/
tomwalters@0 252 /* WARNING: 'time' options are NOT built into the headers yet */
tomwalters@0 253
tomwalters@0 254 changeheader(cut_no_frames, pwidth, nwidth, framewidth_samples);
tomwalters@0 255 changeheader_B(mincf, maxcf, cut_frameheight);
tomwalters@0 256 if (headerflag == ON)
tomwalters@0 257 writeheader(outputfigurefp);
tomwalters@0 258
tomwalters@0 259 /*--------------------------------------*/
tomwalters@0 260
tomwalters@0 261 if (verboseflag==ON) {
tomwalters@0 262 fprintf(stderr, " frames ");
tomwalters@0 263 fflush(stderr);}
tomwalters@0 264
tomwalters@0 265 /*------------------------------------------------------------------------*/
tomwalters@0 266
tomwalters@0 267 for (frame=1; frame<=no_frames; frame++) {
tomwalters@0 268
tomwalters@0 269 if (strobeflag == OFF) {
tomwalters@0 270 if ((frame < cut_framestart) || (frame > cut_frameend ))
tomwalters@0 271 cutthisframe = OFF;
tomwalters@0 272 else
tomwalters@0 273 cutthisframe = ON;}
tomwalters@0 274 else {
tomwalters@0 275 cutthisframe = OFF;
tomwalters@0 276 for (counter=1; counter <= nstrobes; counter ++){
tomwalters@0 277 if (frame == strobelocation[counter])
tomwalters@0 278 cutthisframe = ON;}}
tomwalters@0 279
tomwalters@0 280 if (forceframeflag == ON){
tomwalters@0 281 if (frame < forceframe){
tomwalters@0 282 cutthisframe = OFF;}
tomwalters@0 283 else {
tomwalters@0 284 if (successforceflag == OFF){
tomwalters@0 285 if (cutthisframe == ON){
tomwalters@0 286 successforceflag = ON;
tomwalters@0 287 fprintf(stdout, "%d\n", frame);}}
tomwalters@0 288 else
tomwalters@0 289 cutthisframe = OFF;}}
tomwalters@0 290
tomwalters@0 291 if (verboseflag == ON) {
tomwalters@0 292 if (cutthisframe == ON){
tomwalters@0 293 fprintf(stderr, " %i ", frame); fflush(stderr);}
tomwalters@0 294 else {
tomwalters@0 295 fprintf(stderr, " (%i) ", frame); fflush(stderr);}}
tomwalters@0 296
tomwalters@0 297 /*--------------------------------------*/
tomwalters@0 298
tomwalters@0 299 for (channel=1; channel <=frameheight; channel ++) {
tomwalters@0 300
tomwalters@0 301 for(sample=0; sample<framewidth_samples; sample++)
tomwalters@0 302 inputdata[sample] = 0;
tomwalters@0 303
tomwalters@0 304 fread (inputdata, 2, framewidth_samples, inputfp);
tomwalters@0 305
tomwalters@0 306 /* input check */
tomwalters@0 307 for(sample=0; sample<framewidth_samples; sample++)
tomwalters@0 308 if (inputdata[sample] < 0 ) {
tomwalters@0 309 fprintf(stderr, "%s: something's gone wrong: the data is negative.\n", progname);
tomwalters@0 310 exit(-1); }
tomwalters@0 311
tomwalters@0 312 for(sample=0; sample<framewidth_samples; sample++)
tomwalters@0 313 inputbychannel[channel][sample] = inputdata[sample];
tomwalters@0 314
tomwalters@0 315 } /* (loading of) channel */
tomwalters@0 316
tomwalters@0 317 /*--------------------------------------*/
tomwalters@0 318
tomwalters@0 319 /* Is this frame to be output? If not, next frame. */
tomwalters@0 320 if (strobeflag == OFF){
tomwalters@0 321 if ((frame < cut_framestart) || (frame > cut_frameend ))
tomwalters@0 322 continue;}
tomwalters@0 323 else {
tomwalters@0 324 if (cutthisframe == OFF)
tomwalters@0 325 continue;}
tomwalters@0 326
tomwalters@0 327 /* output all required channels */
tomwalters@0 328 for (channel = cut_minchannel; channel <= cut_maxchannel; channel++) {
tomwalters@0 329 sum = 0.0;
tomwalters@0 330 counter=0;
tomwalters@0 331 for(sample=cut_timestart; sample<cut_timeend; sample++) {
tomwalters@0 332 outputfiguredata[counter] = inputbychannel[channel][sample];
tomwalters@0 333 if ((sumflag == ON) || (averageflag == ON))
tomwalters@0 334 sum += inputbychannel[channel][sample];
tomwalters@0 335 counter++;}
tomwalters@0 336
tomwalters@0 337 if (sumflag == ON){
tomwalters@0 338 outputfiguredata[0] = (short) sum;
tomwalters@0 339 counter=1;}
tomwalters@0 340 if (averageflag == ON){
tomwalters@0 341 tempf = (float) sum/counter;
tomwalters@0 342 outputfiguredata[0] = (short) tempf;
tomwalters@0 343 counter=1;}
tomwalters@0 344 /* fprintf(stderr, "%f %d \n", sum, outputfiguredata[0]);*/
tomwalters@0 345
tomwalters@0 346 writedata_output(outputfigurefp, counter); }
tomwalters@0 347
tomwalters@0 348 /*--------------------------------------*/
tomwalters@0 349
tomwalters@0 350 } /* frame */
tomwalters@0 351
tomwalters@0 352 /*----------------------------------------------------------------------*/
tomwalters@0 353
tomwalters@0 354 /* Tidy up and exit */
tomwalters@0 355 if (verboseflag == ON)
tomwalters@0 356 fprintf(stderr, "\n");
tomwalters@0 357 fclose(inputfp); fclose(outputfigurefp);
tomwalters@0 358
tomwalters@0 359 if ( ferror(inputfp) != 0) {
tomwalters@0 360 fprintf(stderr, " %s : error closing input file.\n", progname);
tomwalters@0 361 exit(-1);}
tomwalters@0 362
tomwalters@0 363 if ( ferror(outputfigurefp) != 0) {
tomwalters@0 364 fprintf(stderr, " %s : error closing figure file.\n", progname);
tomwalters@0 365 exit(-1);}
tomwalters@0 366
tomwalters@0 367 exit(0);
tomwalters@0 368
tomwalters@0 369 } /* Main */
tomwalters@0 370
tomwalters@0 371
tomwalters@0 372
tomwalters@0 373
tomwalters@0 374 /*......................................................................*/
tomwalters@0 375 /*......................................................................*/
tomwalters@0 376
tomwalters@0 377
tomwalters@0 378
tomwalters@0 379
tomwalters@0 380
tomwalters@0 381 void parsecommandline(int argc, char *argv[], char inputfn[], char outputbasefn[])
tomwalters@0 382 {
tomwalters@0 383 int x=1, helpflag = OFF;
tomwalters@0 384
tomwalters@0 385 while (x < argc){
tomwalters@0 386 if (!strcmp(argv[x], "-o")) {strcpy(outputbasefn, argv[x+1]); x+=2;}
tomwalters@0 387 else if (!strcmp(argv[x], "-output")) {strcpy(outputbasefn, argv[x+1]); x+=2;}
tomwalters@0 388 else if (!strcmp(argv[x], "-i")) {strcpy(inputfn, argv[x+1]); x+=2;}
tomwalters@0 389 else if (!strcmp(argv[x], "-t")) {strobeflag=ON; frameflag=OFF;strcpy(strobefn, argv[x+1]); x+=2;}
tomwalters@0 390 else if (!strcmp(argv[x], "-input")) {strcpy(inputfn, argv[x+1]); x+=2;}
tomwalters@0 391 else if (!strcmp(argv[x], "-help")) {helpflag = ON; x+=1;}
tomwalters@0 392 else if (!strcmp(argv[x], "-h")) {helpflag = ON; x+=1;}
tomwalters@0 393 else if (!strcmp(argv[x], "-triggerinfo")) {infoflag = ON; x+=1;}
tomwalters@0 394 else if (!strcmp(argv[x], "-sum")) {sumflag = ON; averageflag=OFF; x+=1;}
tomwalters@0 395 else if (!strcmp(argv[x], "-average")) {sumflag = OFF; averageflag=ON; x+=1;}
tomwalters@0 396 else if (!strcmp(argv[x], "-header")) {headerflag = ON; x+=1;}
tomwalters@0 397 else if (!strcmp(argv[x], "-noheader")) {headerflag = OFF; x+=1;}
tomwalters@0 398 else if (!strcmp(argv[x], "-verbose")) {verboseflag = ON; x+=1;}
tomwalters@0 399 else if (!strcmp(argv[x], "-v")) {verboseflag = ON; x+=1;}
tomwalters@0 400 else if (!strcmp(argv[x], "-n")) {forceframeflag=ON; forceframe=atoi(argv[x+1]); x+=2;}
tomwalters@0 401 else if (!strcmp(argv[x], "-f")) {frameflag=ON; framestart=atoi(argv[x+1]); frameend=atoi(argv[x+2]); x+=3;}
tomwalters@0 402 else if (!strcmp(argv[x], "-frames")) {frameflag=ON; framestart=atoi(argv[x+1]); frameend=atoi(argv[x+2]); x+=3;}
tomwalters@0 403 else if (!strcmp(argv[x], "-c")) {channelflag=ON; minchannel=atoi(argv[x+1]); maxchannel=atoi(argv[x+2]); x+=3;}
tomwalters@0 404 else if (!strcmp(argv[x], "-channel")) {channelflag=ON; minchannel=atoi(argv[x+1]); maxchannel=atoi(argv[x+2]); x+=3;}
tomwalters@0 405 else if (!strcmp(argv[x], "-time")) {timeflag=ON; timestart=atof(argv[x+1]); timeend=atof(argv[x+2]); x+=3;}
tomwalters@0 406 else if (!strcmp(argv[x], "-oparch")) {oppositearchflag = ON; x+=1;}
tomwalters@0 407 else {fprintf(stderr, "%s: unknown option %s\n", progname, argv[x]);
tomwalters@0 408 exit(-1);}
tomwalters@0 409 }
tomwalters@0 410
tomwalters@0 411 if (helpflag == ON)
tomwalters@0 412 {
tomwalters@0 413 fprintf(stderr, "\n");
tomwalters@0 414 fprintf(stderr, " %s\n", progname);
tomwalters@0 415 fprintf(stderr, " -----------------------------------------------------------\n");
tomwalters@0 416 fprintf(stderr, " Cuts a .sai by frame or channel, and (if necessary) just some\n");
tomwalters@0 417 fprintf(stderr, " of the input image\n");
tomwalters@0 418 fprintf(stderr, " The -oparch option is REQUIRED if reading a Sun .sai files \n");
tomwalters@0 419 fprintf(stderr, " on a DEC cpu or vice-versa.\n");
tomwalters@0 420 fprintf(stderr, " Add .sai to both input and output filenames.\n");
tomwalters@0 421 fprintf(stderr, " WARNING: the header is not rebuilt properly for the\n");
tomwalters@0 422 fprintf(stderr, " '-time' options.\n");
tomwalters@0 423 fprintf(stderr, " -----------------------------------------------------------\n");
tomwalters@0 424 fprintf(stderr, " -i <.sai file> input file default = stdin\n");
tomwalters@0 425 fprintf(stderr, " -o <.sai file> output file default = stdout\n");
tomwalters@0 426 fprintf(stderr, " -t <.trigger file> trigger location file\n");
tomwalters@0 427 fprintf(stderr, " -oparch assume input was generated on an opposing architecture cpu\n");
tomwalters@0 428 fprintf(stderr, "\n");
tomwalters@0 429 fprintf(stderr, " -n <frame> take first frame after <frame>\n");
tomwalters@0 430 fprintf(stderr, " -frames <start> <end> (inclusive) (default=all)\n");
tomwalters@0 431 fprintf(stderr, " -time <start> <end> (inclusive; ms from leftedge)\n");
tomwalters@0 432 fprintf(stderr, " -channel <low> <high> (inclusive) (default=all)\n");
tomwalters@0 433 fprintf(stderr, " -sum sum and output 1 value per frame\n");
tomwalters@0 434 fprintf(stderr, " -average sum, average & output 1 value per frame\n");
tomwalters@0 435 fprintf(stderr, " -noheader don't output a .sai header\n");
tomwalters@0 436 fprintf(stderr, " -header do output a .sai header (default)\n");
tomwalters@0 437 fprintf(stderr, "\n");
tomwalters@0 438 fprintf(stderr, " -v verbose output (to stderr)\n");
tomwalters@0 439 fprintf(stderr, " -triggerinfo report the 'trigger' frames (to stderr)");
tomwalters@0 440 fprintf(stderr, "\n\n");
tomwalters@0 441 exit(-1);}
tomwalters@0 442
tomwalters@0 443 }
tomwalters@0 444
tomwalters@0 445
tomwalters@0 446
tomwalters@0 447
tomwalters@0 448
tomwalters@0 449
tomwalters@0 450