00001 #include "sadie.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 void BILTOBSQ (
00014 IMAGE *in,
00015 IMAGE **out
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
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
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
00048 if (LINES && !PROGRESS(psum=0.0)) goto the_end;
00049 pinc = 1.0/(double)in->nbnd/(double)in->nlin;
00050
00051
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 }