Main Page   Data Structures   File List   Data Fields   Globals  

mosaic_byte_insert.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 #include        "sadie_byte.h"
00003 #include        "mosaic.h"
00004 
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function inserts edge data into a byte mosaic image.                */
00009 /*                                                                            */
00010 /*----------------------------------------------------------------------------*/
00011 /*-Interface Information------------------------------------------------------*/
00012 void MOSAIC_BYTE_INSERT (
00013 IMAGE *in,           /*  I   Pointer to the input image.                      */
00014 MOSAIC_INDEX *index, /*  I   Pointer to the input mosaic index.               */
00015 int joff,            /*  I   Vertical offset of input image edge map data.    */
00016 int koff,            /*  I   Horizontal offset of image data.                 */
00017 IMAGE_BYTE **out     /*  O   Address of a pointer to the mosaic image.        */
00018 /*----------------------------------------------------------------------------*/
00019 ) { register int j, k, m, n;
00020     char   msg[SLEN];
00021 
00022     /* check input */
00023     if (!CHECKIMG(in)) {
00024         MESSAGE('E'," Can't identify input image.");
00025         goto the_end;
00026     } else if (!CHECKIMG_MOSAIC_INDEX(index)) {
00027         MESSAGE('E'," Can't identify input mosaic index.");
00028         goto the_end;
00029     } else if (in->nbnd > 1) {
00030         MESSAGE('E'," Input image must be single-band.");
00031         goto the_end;
00032     } else if (joff < 0 || koff < 0) {
00033         MESSAGE('E'," Offsets must be positive.");
00034         goto the_end;
00035     } else if (!CHECKIMG_BYTE(*out)) {
00036         MESSAGE('E'," Can't identify mosaic image.");
00037         goto the_end;
00038     } else if (index->npix != (*out)->npix) {
00039         printf("Mosaic index size (%d) does not match mosaic size (%d).",index->npix,(*out)->npix);
00040         MESSAGE('E'," Mosaic index size does not match mosaic size.");
00041         goto the_end;
00042     }
00043 
00044     /* if (TIMES) TIMING(T_SCONVL); */
00045     if (NAMES) {
00046         MESSAGE('I',"");
00047         MESSAGE('I',"MOSAIC_BYTE_INSERT");
00048         MESSAGE('I',"");
00049         sprintf(msg," Input image:           %s",in->text);
00050         MESSAGE('I',msg);
00051         sprintf(msg,"  Horizontal Offset:    %d",koff);
00052         MESSAGE('I',msg);
00053         sprintf(msg,"    Vertical Offset:    %d",joff);
00054         MESSAGE('I',msg);
00055         sprintf(msg," Mosaic image:           %s",(*out)->text);
00056         MESSAGE('I',msg);
00057         MESSAGE('I'," ...............");
00058     }
00059 
00060 
00061     for (j=0; j<in->nlin; j++) {
00062         for (k=0; k<in->npix; k++) {
00063             n = k+koff;
00064             m = (j+joff)-index->voffset[n];
00065             
00066             if (n>0 && n<(*out)->npix && m>0 && m<(*out)->nlin) {
00067                 (*out)->data[0][m][n] = (PIXEL_BYTE)rnd(in->data[0][j][k]);
00068             }
00069         }
00070     }
00071     
00072     the_end:
00073     return;
00074     /* if (TIMES) TIMING(T_EXIT); */
00075 }

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