00001 #include "sadie.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 void CHECKER (
00016 short nlin,
00017 short npix,
00018 short jsize,
00019 short ksize,
00020 IMAGE **out
00021
00022 ) { register short j, k;
00023 char msg[SLEN];
00024
00025 if (TIMES) TIMING(T_CHECKER);
00026 if (NAMES) {
00027 MESSAGE('I',"");
00028 MESSAGE('I',"CHECKER");
00029 MESSAGE('I',"");
00030 sprintf(msg," Image size: lines: %d",nlin);
00031 MESSAGE('I',msg);
00032 sprintf(msg," pixels: %d",npix);
00033 MESSAGE('I',msg);
00034 sprintf(msg," Check size: lines: %d",jsize);
00035 MESSAGE('I',msg);
00036 sprintf(msg," pixels: %d",ksize);
00037 MESSAGE('I',msg);
00038 MESSAGE('I'," ...............");
00039 }
00040
00041
00042 if (nlin <= 0) {
00043 MESSAGE('E'," Number of lines must be greater than zero.");
00044 goto the_end;
00045 } else if (npix <= 0) {
00046 MESSAGE('E'," Number of pixels/line must be greater than zero.");
00047 goto the_end;
00048 } else if (jsize <= 0) {
00049 MESSAGE('E'," Size of square in lines must be greater than zero.");
00050 goto the_end;
00051 } else if (jsize > nlin) {
00052 MESSAGE('E'," Size of square in lines must be less than or equal to the number of lines.");
00053 goto the_end;
00054 } else if (ksize <= 0) {
00055 MESSAGE('E'," Size of square in pixels/line must be greater than zero.");
00056 goto the_end;
00057 } else if (ksize > npix) {
00058 MESSAGE('E'," Size of square in pixels/line must be less than or equal to the number of pixels/line.");
00059 goto the_end;
00060 }
00061
00062
00063 if (!CHECKIMG(*out)) GETMEM(1,nlin,npix,out);
00064 if (!*out) goto the_end;
00065
00066
00067 for (j=0; j<nlin; j++) {
00068 for (k=0; k<npix; k++) {
00069 (*out)->data[0][j][k] = (PIXEL)((j/jsize+k/ksize)%2 == 0 ? SMIN : SMAX);
00070 }
00071 }
00072 (*out)->gmin = (PIXEL)SMIN;
00073 (*out)->gmax = (PIXEL)SMAX;
00074
00075 the_end:
00076 if (TIMES) TIMING(T_EXIT);
00077 }