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 MAXLIKE (
00013 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 ) { register short i, j, k, m, n;                              
00022     char msg[SLEN];                                                                
00023 
00024     if (TIMES) TIMING(T_MAXLIKE);
00025     if (NAMES) {                                                                    
00026         MESSAGE('I',"");                                                           
00027         MESSAGE('I',"MAXLIKE");                                                   
00028         MESSAGE('I',"");                                                           
00029         sprintf(msg," Input image:          %s",in->text);                          
00030         MESSAGE('I',msg);                                                          
00031         sprintf(msg," Number of classes:    %d",nlev);                              
00032         MESSAGE('I',msg);
00033         for (i=0; i<nlev; i++) {
00034             sprintf(msg," Class%3d:          ",i+1);
00035             MESSAGE('I',msg);
00036             MESSAGE('I',"  Covariance matrix:");
00037             for (j=0; j<in->nbnd; j++) {
00038                     sprintf(msg,"  Band%4d:          ",j+1);
00039                 for (k=0,m=strlen(msg); k<in->nbnd; k++,m=strlen(msg)) {
00040                     sprintf(msg+m,"%12.4e",cov[i*in->nbnd*in->nbnd+j*in->nbnd+k]);
00041                 }
00042                 MESSAGE('I',msg);
00043             }
00044             sprintf(msg,"  Probability:       %12.4e",prob[i]);
00045             MESSAGE('I',msg);
00046         }
00047         MESSAGE('I'," ...............");
00048     }                                                                           
00049 
00050     the_end:
00051     if (TIMES) TIMING(T_EXIT);
00052 }
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 

Generated on Wed Apr 9 08:56:08 2003 for TREES by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002