Main Page   Data Structures   File List   Data Fields   Globals  

sinestar.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 
00003 /*-Copyright Information------------------------------------------------------*/
00004 /* Copyright (c) 1993 by the University of Arizona Digital Image Analysis Lab */
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function creates a sine star test pattern.                          */
00009 /*                                                                            */
00010 /*----------------------------------------------------------------------------*/
00011 /*-Interface Information------------------------------------------------------*/
00012 void
00013 SINESTAR (short nlin,           /*  I   Number of lines in the output image.                  */
00014           short npix,           /*  I   Number of pixels/line in the output image.            */
00015           double period,        /*  I   Number of sine periods.                               */
00016           IMAGE ** out          /*  O   Address of a pointer to the output image.             */
00017 /*----------------------------------------------------------------------------*/
00018   )
00019 {
00020   register short j, k;
00021   char msg[SLEN];
00022   double x, y, angle;
00023 
00024   if (TIMES)
00025     TIMING (T_SINESTAR);
00026   if (NAMES)
00027     {
00028       MESSAGE ('I', "");
00029       MESSAGE ('I', "SINESTAR");
00030       MESSAGE ('I', "");
00031       sprintf (msg, " Image size: lines:           %d", nlin);
00032       MESSAGE ('I', msg);
00033       sprintf (msg, "             pixels:          %d", npix);
00034       MESSAGE ('I', msg);
00035       sprintf (msg, " Period(s):                 %12.4e", period);
00036       MESSAGE ('I', msg);
00037       MESSAGE ('I', " ...............");
00038     }
00039 
00040   /* create image of appropriate size */
00041   if (!CHECKIMG (*out))
00042     GETMEM (1, nlin, npix, out);
00043 
00044   /* create sine star test pattern */
00045   for (j = 0; j < nlin; j++)
00046     {
00047       y = (double) (j - nlin / 2);
00048       for (k = 0; k < npix; k++)
00049         {
00050           x = (double) (k - npix / 2);
00051           if (x == 0.0)
00052             {
00053               if (y > 0.0)
00054                 {
00055                   angle = PI / 2.0;
00056                 }
00057               else if (y < 0.0)
00058                 {
00059                   angle = -PI / 2.0;
00060                 }
00061               else
00062                 {
00063                   angle = 0.0;
00064                 }
00065             }
00066           else
00067             {
00068               angle = atan2 (y, x);
00069             }
00070           (*out)->data[0][j][k] = (PIXEL) cos (angle * period);
00071         }
00072     }
00073 
00074 the_end:
00075   if (TIMES)
00076     TIMING (T_EXIT);
00077 }

Generated on Sun May 18 15:36:18 2003 for tclSadie by doxygen1.3