Main Page   Data Structures   File List   Data Fields   Globals  

maxlike.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 
00003 /*-Copyright Information------------------------------------------------------*/
00004 /* Copyright (c) 1994 by the University of Arizona Digital Image Analysis Lab */
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function performs a maximum likelihood classification on an image.  */
00009 /*                                                                            */
00010 /*----------------------------------------------------------------------------*/
00011 /*-Interface Information------------------------------------------------------*/
00012 void
00013 MAXLIKE (IMAGE * in,            /*  I  Pointer to the input image.                             */
00014          short nlev,            /*  I  Number of classes                                       */
00015          /*     (and number of graylevels in the output image).         */
00016          double *cov,           /*  I  Pointer to the array                                    */
00017          /*     of covariance matrices[nlev][nbnd][nbnd].               */
00018          double *prob,          /*  I  Pointer to the array[nlev] of a priori probabilities.   */
00019          IMAGE ** out           /*  O  Address of a pointer to the output image.               */
00020 /*--------------------------------------------------------------------------- */
00021   )
00022 {
00023   register short i, j, k, m, n;
00024   char msg[SLEN];
00025 
00026   if (TIMES)
00027     TIMING (T_MAXLIKE);
00028   if (NAMES)
00029     {
00030       MESSAGE ('I', "");
00031       MESSAGE ('I', "MAXLIKE");
00032       MESSAGE ('I', "");
00033       sprintf (msg, " Input image:          %s", in->text);
00034       MESSAGE ('I', msg);
00035       sprintf (msg, " Number of classes:    %d", nlev);
00036       MESSAGE ('I', msg);
00037       for (i = 0; i < nlev; i++)
00038         {
00039           sprintf (msg, " Class%3d:          ", i + 1);
00040           MESSAGE ('I', msg);
00041           MESSAGE ('I', "  Covariance matrix:");
00042           for (j = 0; j < in->nbnd; j++)
00043             {
00044               sprintf (msg, "  Band%4d:          ", j + 1);
00045               for (k = 0, m = strlen (msg); k < in->nbnd;
00046                    k++, m = strlen (msg))
00047                 {
00048                   sprintf (msg + m, "%12.4e",
00049                            cov[i * in->nbnd * in->nbnd + j * in->nbnd + k]);
00050                 }
00051               MESSAGE ('I', msg);
00052             }
00053           sprintf (msg, "  Probability:       %12.4e", prob[i]);
00054           MESSAGE ('I', msg);
00055         }
00056       MESSAGE ('I', " ...............");
00057     }
00058 
00059 the_end:
00060   if (TIMES)
00061     TIMING (T_EXIT);
00062 }

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