#include #include #include #include "globals.h" /***************************************************************************/ int transform (int datafds[MX], int outfds[MX], int rows, int cols, double eigmat[MX][MX], int bands, CELL mins[MX], CELL maxs[MX]) { int i,j,k,l; double sum[MX]; CELL *rowbufs[MX]; /* allocate row buffers for each band */ for (i=1; i<=bands; i++) if((rowbufs[i] = G_allocate_cell_buf()) == NULL) G_fatal_error(_("Unable to allocate cell buffers.")); for(i=0 ; i maxs[j]) maxs[j] = rowbufs[j][l]; if (rowbufs[j][l] < mins[j]) mins[j] = rowbufs[j][l]; } } /* output the row of data */ for (j=1; j<=bands; j++) if (G_put_raster_row(outfds[j], rowbufs[j], CELL_TYPE) < 0) G_fatal_error(_("Error writing cell map during transform.")); } for (i=1; i<=bands; i++) G_free(rowbufs[i]); G_message(_("Transform completed.\n")); return 0; } /***************************************************************************/