00001 #include "sadie.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 void
00014 BILTOBSQ (IMAGE * in,
00015 IMAGE ** out
00016
00017 )
00018 {
00019 register short i, j, k;
00020 char msg[SLEN];
00021 double pinc, psum;
00022
00023 if (TIMES)
00024 TIMING (T_BILTOBSQ);
00025 if (NAMES)
00026 {
00027 MESSAGE ('I', "");
00028 MESSAGE ('I', "BILTOBSQ");
00029 MESSAGE ('I', "");
00030 sprintf (msg, " Input image: %s", in->text);
00031 MESSAGE ('I', msg);
00032 MESSAGE ('I', "");
00033 MESSAGE ('I', " ...............");
00034 }
00035
00036
00037 if (!CHECKIMG (in))
00038 {
00039 MESSAGE ('E', " Can't identify image.");
00040 goto the_end;
00041 }
00042 else if (in->nbnd == 1)
00043 {
00044 MESSAGE ('E', " Input image must be multi-band.");
00045 goto the_end;
00046 }
00047
00048
00049 for (i = 0; i < in->nbnd; i++)
00050 {
00051 if (!CHECKIMG (out[i]))
00052 GETMEM (1, in->nlin, in->npix, &out[i]);
00053 if (!out[i])
00054 goto the_end;
00055 }
00056
00057
00058 if (LINES && !PROGRESS (psum = 0.0))
00059 goto the_end;
00060 pinc = 1.0 / (double) in->nbnd / (double) in->nlin;
00061
00062
00063 for (i = 0; i < in->nbnd; i++)
00064 {
00065 for (j = 0; j < in->nlin; j++)
00066 {
00067 for (k = 0; k < in->npix; k++)
00068 {
00069 out[i]->data[0][j][k] = in->data[i][j][k];
00070 }
00071 if (LINES && !PROGRESS (psum += pinc))
00072 goto the_end;
00073 }
00074 }
00075
00076 the_end:
00077 if (TIMES)
00078 TIMING (T_EXIT);
00079 }