Main Page   Data Structures   File List   Data Fields   Globals  

isolate.c

Go to the documentation of this file.
00001 #include "sadie.h"
00002 #include "proto.h"
00003 
00004 /*----------------------------------------------------------------------------*/
00005 /*-General Information--------------------------------------------------------*/
00006 /*                                                                            */
00007 /*   This function isolates a single pixel value                 */
00008 /*                                                                            */
00009 /*----------------------------------------------------------------------------*/
00010 /*-Interface Information------------------------------------------------------*/
00011 void ISOLATE (
00012 IMAGE  *in,      /*  I   Pointer to the input image.                           */
00013 double  value,
00014 IMAGE  **out     /*  O   Address of a pointer to the output image             */
00015 /*----------------------------------------------------------------------------*/
00016 ) { register int i, j, k;
00017     char msg[SLEN];
00018 
00019 
00020     /* check input */
00021     if (!CHECKIMG(in)) {
00022         MESSAGE('E'," Can't identify image.");
00023         goto the_end;
00024     }
00025 
00026     /* create output image of appropriate size */
00027     if (!CHECKIMG(*out)) GETMEM(in->nbnd,in->nlin,in->npix,out);
00028     if (!*out) goto the_end;
00029 
00030 
00031     for (i=0; i<in->nbnd; i++) {
00032         for (j=0; j<in->nlin; j++) {
00033             for (k=0; k<in->npix; k++) {
00034                 if (in->data[i][j][k] > ((PIXEL)value + (PIXEL)0.01)) {
00035                     (*out)->data[i][j][k] = (PIXEL)0.0;
00036                 } else if (in->data[i][j][k] < ((PIXEL)value - (PIXEL)0.01)) {
00037                     (*out)->data[i][j][k] = (PIXEL)0.0;
00038                 } else {
00039                     (*out)->data[i][j][k] = (PIXEL)value;
00040                 }
00041             }
00042         }
00043     }
00044         
00045     the_end:
00046     /* if (TIMES) TIMING(T_EXIT); */
00047 }

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