[GRASS-SVN] r73512 - grass/trunk/imagery/i.segment

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 9 11:03:41 PDT 2018


Author: mmetz
Date: 2018-10-09 11:03:41 -0700 (Tue, 09 Oct 2018)
New Revision: 73512

Modified:
   grass/trunk/imagery/i.segment/create_isegs.c
   grass/trunk/imagery/i.segment/iseg.h
   grass/trunk/imagery/i.segment/write_output.c
Log:
i.segment: fix writing out goodness of fit

Modified: grass/trunk/imagery/i.segment/create_isegs.c
===================================================================
--- grass/trunk/imagery/i.segment/create_isegs.c	2018-10-09 13:31:07 UTC (rev 73511)
+++ grass/trunk/imagery/i.segment/create_isegs.c	2018-10-09 18:03:41 UTC (rev 73512)
@@ -113,17 +113,7 @@
 	globals->max_rid = max_id;
 	G_debug(1, "Largest renumbered ID: %d", globals->max_rid);
 	
-	for (row = 0; row < globals->nrows; row++) {
-	    for (col = 0; col < globals->ncols; col++) {
-		Segment_get(&globals->rid_seg, &rid, row, col);
-		if (!Rast_is_c_null_value(&rid)) {
-		    rid = new_id[rid];
-		    Segment_put(&globals->rid_seg, &rid, row, col);
-		}
-	    }
-	}
-
-	G_free(new_id);
+	globals->new_id = new_id;
     }
 
     return successflag;

Modified: grass/trunk/imagery/i.segment/iseg.h
===================================================================
--- grass/trunk/imagery/i.segment/iseg.h	2018-10-09 13:31:07 UTC (rev 73511)
+++ grass/trunk/imagery/i.segment/iseg.h	2018-10-09 18:03:41 UTC (rev 73512)
@@ -80,6 +80,7 @@
 
     /* region growing */
     int min_segment_size;	/* smallest number of pixels/cells allowed in a final segment */
+    int *new_id;
 
     /* inactive options for region growing */
     double radio_weight;	/* weighing factor radiometric - shape */

Modified: grass/trunk/imagery/i.segment/write_output.c
===================================================================
--- grass/trunk/imagery/i.segment/write_output.c	2018-10-09 13:31:07 UTC (rev 73511)
+++ grass/trunk/imagery/i.segment/write_output.c	2018-10-09 18:03:41 UTC (rev 73512)
@@ -34,7 +34,8 @@
 		Segment_get(&globals->rid_seg, (void *) &rid, row, col);
 
 		if (rid > 0) {
-		    outbuf[col] = rid;
+		    if (globals->method == ORM_RG)
+			rid = globals->new_id[rid];
 		    if (maxid < rid)
 			maxid = rid;
 		}



More information about the grass-commit mailing list