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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 17 10:19:50 PDT 2013


Author: mmetz
Date: 2013-07-17 10:19:47 -0700 (Wed, 17 Jul 2013)
New Revision: 57201

Modified:
   grass/trunk/imagery/i.segment/create_isegs.c
   grass/trunk/imagery/i.segment/open_files.c
Log:
i.segment: fix more special cases

Modified: grass/trunk/imagery/i.segment/create_isegs.c
===================================================================
--- grass/trunk/imagery/i.segment/create_isegs.c	2013-07-17 17:10:15 UTC (rev 57200)
+++ grass/trunk/imagery/i.segment/create_isegs.c	2013-07-17 17:19:47 UTC (rev 57201)
@@ -309,10 +309,9 @@
 		G_debug(4, "Rk is now complete");
 
 		if (Rk.id == 0) {
-		    /* this can only happen if only one segment is left */
+		    /* this can only happen if the segment is surrounded by NULL data */
 		    G_debug(4, "Segment had no valid neighbors");
-		    pathflag = FALSE;
-		    Ri.count = 0;
+		    continue;
 		}
 
 		if (/* !(t & 1) && */ Ri_nn == 1 &&

Modified: grass/trunk/imagery/i.segment/open_files.c
===================================================================
--- grass/trunk/imagery/i.segment/open_files.c	2013-07-17 17:10:15 UTC (rev 57200)
+++ grass/trunk/imagery/i.segment/open_files.c	2013-07-17 17:19:47 UTC (rev 57201)
@@ -294,6 +294,8 @@
 	load_seeds(globals, srows, scols, nseg);
     }
 
+    G_debug(1, "Number of initial regions: %d", globals->n_regions);
+
     G_free(inbuf);
     G_free(in_fd);
     G_free(fp_range);
@@ -368,6 +370,7 @@
 		    if (segment_put(&globals->rid_seg, &sneg, row, col) != 1)
 			G_fatal_error(_("Unable to write to temporary file"));
 		    sneg--;
+		    globals->n_regions--;
 		}
 		else {
 		    Ri.row = row;
@@ -494,6 +497,8 @@
     else {
 	update_band_vals(Ri->row, Ri->col, &(globals->rs), globals);
     }
+    if (globals->rs.count > 1)
+	globals->n_regions -= (globals->rs.count - 1);
 
     return 1;
 }



More information about the grass-commit mailing list