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