Main Page   Data Structures   File List   Data Fields   Globals  

biltobsq.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 
00003 /*-Copyright Information------------------------------------------------------*/
00004 /* Copyright (c) 1988 by the University of Arizona Digital Image Analysis Lab */
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function separates one multi-band image into individual             */
00009 /*   single-band images (for disk or tape I/O).                               */
00010 /*                                                                            */
00011 /*----------------------------------------------------------------------------*/
00012 /*-Interface Information------------------------------------------------------*/
00013 void BILTOBSQ (
00014 IMAGE *in,      /*  I   Pointer to the input image.                           */
00015 IMAGE **out     /*  O   Pointer to an array of pointers to the output images. */
00016 /*----------------------------------------------------------------------------*/
00017 ) { register short i, j, k;
00018     char   msg[SLEN];
00019     double pinc, psum;
00020 
00021     if (TIMES) TIMING(T_BILTOBSQ);
00022     if (NAMES) {
00023         MESSAGE('I',"");
00024         MESSAGE('I',"BILTOBSQ");
00025         MESSAGE('I',"");
00026         sprintf(msg," Input image:  %s",in->text);
00027         MESSAGE('I',msg);
00028         MESSAGE('I',"");
00029         MESSAGE('I'," ...............");
00030     }
00031 
00032     /* check input */
00033     if (!CHECKIMG(in)) {
00034         MESSAGE('E'," Can't identify image.");
00035         goto the_end;
00036     } else if (in->nbnd == 1) {
00037         MESSAGE('E'," Input image must be multi-band.");
00038         goto the_end;
00039     }
00040 
00041     /* create images of appropriate size */
00042     for (i=0; i<in->nbnd; i++) {
00043         if (!CHECKIMG(out[i])) GETMEM(1,in->nlin,in->npix,&out[i]);
00044         if (!out[i]) goto the_end;
00045     }
00046 
00047     /* initialize progress indicator */
00048     if (LINES  &&  !PROGRESS(psum=0.0)) goto the_end;
00049     pinc = 1.0/(double)in->nbnd/(double)in->nlin;
00050 
00051     /* separate images */
00052     for (i=0; i<in->nbnd; i++) {
00053         for (j=0; j<in->nlin; j++) {
00054             for (k=0; k<in->npix; k++) {
00055                 out[i]->data[0][j][k] = in->data[i][j][k];
00056             }
00057             if (LINES  &&  !PROGRESS(psum+=pinc)) goto the_end;
00058         }
00059     }
00060 
00061     the_end:
00062     if (TIMES) TIMING(T_EXIT);
00063 }

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