[GRASS-SVN] r31824 - in grass/branches/develbranch_6/imagery/i.smap: bouman shapiro

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 23 09:03:20 EDT 2008


Author: neteler
Date: 2008-06-23 09:03:20 -0400 (Mon, 23 Jun 2008)
New Revision: 31824

Modified:
   grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h
   grass/branches/develbranch_6/imagery/i.smap/bouman/model.c
   grass/branches/develbranch_6/imagery/i.smap/bouman/read_block.c
   grass/branches/develbranch_6/imagery/i.smap/bouman/region.h
   grass/branches/develbranch_6/imagery/i.smap/bouman/segment.c
   grass/branches/develbranch_6/imagery/i.smap/shapiro/openfiles.c
   grass/branches/develbranch_6/imagery/i.smap/shapiro/write_img.c
Log:
Convert to FP (merge from trunk)

Modified: grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h	2008-06-23 13:03:20 UTC (rev 31824)
@@ -12,7 +12,8 @@
     int *band_fd;
     int nbands;
 
-    CELL *cellbuf;
+    DCELL *cellbuf;
+    CELL *outbuf;
     char *isdata;
 };
 

Modified: grass/branches/develbranch_6/imagery/i.smap/bouman/model.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/model.c	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/model.c	2008-06-23 13:03:20 UTC (rev 31824)
@@ -63,7 +63,7 @@
 
 void 
 extract (
-    CELL ***img,             /* multispectral image, img[band][i][j] */
+    DCELL ***img,             /* multispectral image, img[band][i][j] */
     struct Region *region,    /* region to extract */
     LIKELIHOOD ***ll,        /* log likelihood, ll[i][j][class] */
     struct SigSet *S        /* class signatures */
@@ -104,7 +104,7 @@
       /* Check for no data condition */
       no_data = 1;
       for(b1=0; (b1<nbands)&&no_data; b1++)
-         no_data = no_data&&(G_is_c_null_value(&img[b1][i][j]));
+         no_data = no_data&&(G_is_d_null_value(&img[b1][i][j]));
 
       if(no_data) {
         for(m=0; m<S->nclasses; m++ )

Modified: grass/branches/develbranch_6/imagery/i.smap/bouman/read_block.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/read_block.c	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/read_block.c	2008-06-23 13:03:20 UTC (rev 31824)
@@ -4,7 +4,7 @@
 #include "region.h"
 
 int read_block (
-    CELL ***img,           /* img[band][row[col] */
+    DCELL ***img,           /* img[band][row[col] */
     struct Region *region,
     struct files *files
 )
@@ -15,7 +15,7 @@
     {
 	for (row = region->ymin; row < region->ymax; row++)
 	{
-	    if(G_get_c_raster_row (files->band_fd[band], files->cellbuf, row) < 0)
+	    if(G_get_d_raster_row (files->band_fd[band], files->cellbuf, row) < 0)
 		exit(1);
 	    for (col = region->xmin; col < region->xmax; col++)
 		    img[band][row][col] = files->cellbuf[col];

Modified: grass/branches/develbranch_6/imagery/i.smap/bouman/region.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/region.h	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/region.h	2008-06-23 13:03:20 UTC (rev 31824)
@@ -27,10 +27,10 @@
 void copy_reg(struct Region *, struct Region *);
 void reg_to_wdht(struct Region *, int *, int *);
 /* read_block.c */
-int read_block (CELL ***, struct Region *, struct files *);
+int read_block (DCELL ***, struct Region *, struct files *);
 /* segment.c */
 #ifdef GRASS_IMAGERY_H
 /* model.c */
 void extract_init(struct SigSet *);
-void extract(CELL ***, struct Region *, LIKELIHOOD ***, struct SigSet *);
+void extract(DCELL ***, struct Region *, LIKELIHOOD ***, struct SigSet *);
 #endif

Modified: grass/branches/develbranch_6/imagery/i.smap/bouman/segment.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/segment.c	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/segment.c	2008-06-23 13:03:20 UTC (rev 31824)
@@ -21,7 +21,7 @@
 
 static void init_reg (struct Region *, int,int, int);
 static int increment_reg (struct Region *, int, int, int);
-static int shift_img (CELL ***, int , struct Region *, int);
+static int shift_img (DCELL ***, int , struct Region *, int);
 static int shift_ll (LIKELIHOOD ****, struct Region *, int);
 
 
@@ -35,7 +35,7 @@
   int ml;                     /* max likelihood? */
   int quiet;                  /* be quiet when running? */
 
-  CELL ***img;                /* multispectral image, img[band][i][j] */
+  DCELL ***img;               /* multispectral image, img[band][i][j] */
   int  wd,ht;                 /* image width and height */
   struct Region region;       /* specifies image subregion */
   int nbands;                 /* number of bands */
@@ -74,7 +74,7 @@
   alpha_dec = (double *)G_malloc(D*sizeof(double));
 
   /* allocate image block */
-  img = (CELL ***)multialloc(sizeof(CELL),3,nbands,block_size,block_size);
+  img = (DCELL ***)multialloc(sizeof(DCELL),3,nbands,block_size,block_size);
 
   /* allocate memory for log likelihood pyramid */
   ll_pym = (LIKELIHOOD ****)get_cubic_pyramid(block_size,block_size,nclasses,sizeof(LIKELIHOOD));
@@ -169,7 +169,7 @@
    return(1);
 }
 
-static int shift_img (CELL ***img, int nbands,
+static int shift_img (DCELL ***img, int nbands,
     struct Region *region, int block_size)
 {
     static int xoffset=0;
@@ -247,7 +247,7 @@
 
 
 #ifdef COMMENTED_OUT
-int read_block (CELL ***img, int wd, int ht, int nbands, struct Region *region, char *infn)
+int read_block (DCELL ***img, int wd, int ht, int nbands, struct Region *region, char *infn)
 {
      static first=1;
      static unsigned char ***img_buf;

Modified: grass/branches/develbranch_6/imagery/i.smap/shapiro/openfiles.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/shapiro/openfiles.c	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/shapiro/openfiles.c	2008-06-23 13:03:20 UTC (rev 31824)
@@ -20,7 +20,8 @@
                 parms->subgroup, parms->group);
 
     /* allocate file descriptors, and io buffer */
-    files->cellbuf = G_allocate_cell_buf();
+    files->cellbuf = G_allocate_d_raster_buf();
+    files->outbuf = G_allocate_c_raster_buf();
     files->isdata = G_malloc(G_window_cols());
 
     files->nbands    = Ref.nfiles;

Modified: grass/branches/develbranch_6/imagery/i.smap/shapiro/write_img.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/shapiro/write_img.c	2008-06-23 12:55:30 UTC (rev 31823)
+++ grass/branches/develbranch_6/imagery/i.smap/shapiro/write_img.c	2008-06-23 13:03:20 UTC (rev 31824)
@@ -19,16 +19,16 @@
 	if (!parms->quiet) G_percent (row, nrows, 2);
 	for (col = 0; col < ncols; col++)
 	{
-	   if(G_is_c_null_value((CELL *)&img[row][col]))
-		   G_set_c_null_value(&files->cellbuf[col], 1);
+	   if(0 && img[row][col] == 0)
+		G_set_c_null_value(&files->outbuf[col], 1);
            else
 	   {
 		int class = (int)img[row][col];
 		G_debug(3, "class: [%d] row/col: [%d][%d]", class, row, col);
-		files->cellbuf[col] = (CELL)S->ClassSig[class].classnum;
+		files->outbuf[col] = (CELL)S->ClassSig[class].classnum;
            }
 	}
-	G_put_raster_row (files->output_fd, files->cellbuf, CELL_TYPE);
+	G_put_raster_row (files->output_fd, files->outbuf, CELL_TYPE);
     }
     if (!parms->quiet) G_percent (row, nrows, 2);
 



More information about the grass-commit mailing list