[GRASS-SVN] r53164 - grass-addons/grass7/imagery/i.segment.xl

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 11 02:00:59 PDT 2012


Author: mmetz
Date: 2012-09-11 02:00:59 -0700 (Tue, 11 Sep 2012)
New Revision: 53164

Modified:
   grass-addons/grass7/imagery/i.segment.xl/create_isegs.c
   grass-addons/grass7/imagery/i.segment.xl/parse_args.c
Log:
i.segment.xl code cleanup

Modified: grass-addons/grass7/imagery/i.segment.xl/create_isegs.c
===================================================================
--- grass-addons/grass7/imagery/i.segment.xl/create_isegs.c	2012-09-11 08:36:22 UTC (rev 53163)
+++ grass-addons/grass7/imagery/i.segment.xl/create_isegs.c	2012-09-11 09:00:59 UTC (rev 53164)
@@ -16,8 +16,6 @@
 
 #define EPSILON 1.0e-16
 
-int debug_level;
-
 /* internal functions */
 static int merge_regions(struct ngbr_stats *,    /* Ri */
                          struct reg_stats *,
@@ -175,12 +173,10 @@
     alpha2 = globals->alpha * globals->alpha;
     /* make the divisor a constant ? */
     divisor = globals->nrows + globals->ncols;
-    
-    debug_level = 5;
-    
+
     while (t < globals->end_t && n_merges > 0) {
 
-	/* optional threshold as a function of t. */
+	/* optional threshold as a function of t. does not make sense */
 	threshold = alpha2 * globals->threshold;
 
 	t++;
@@ -190,9 +186,6 @@
 	else
 	    G_percent(t, globals->end_t, 1);
 
-	if (t >= 50)
-	    debug_level = 5;
-
 	n_merges = 0;
 	globals->candidate_count = 0;
 	flag_clear_all(globals->candidate_flag);
@@ -292,8 +285,11 @@
 		    pathflag = FALSE;
 		}
 		/* this is slow ??? */
-		if (0 && (t & 1) && Rk.count <= globals->nn)
+		if (t & 1) {
+		    if ((globals->nn < 8 && Rk.count <= 8) || 
+		        (globals->nn >= 8 && Rk.count <= globals->nn))
 		    candidates_only = FALSE;
+		}
 		
 		while (pathflag) {
 		    pathflag = FALSE;
@@ -547,6 +543,7 @@
 		}
 	    }
 	}
+	G_percent(1, 1, 1);
     }
     
     G_free(Ri.mean);

Modified: grass-addons/grass7/imagery/i.segment.xl/parse_args.c
===================================================================
--- grass-addons/grass7/imagery/i.segment.xl/parse_args.c	2012-09-11 08:36:22 UTC (rev 53163)
+++ grass-addons/grass7/imagery/i.segment.xl/parse_args.c	2012-09-11 09:00:59 UTC (rev 53164)
@@ -87,7 +87,7 @@
     endt->key = "iterations";
     endt->type = TYPE_INTEGER;
     endt->required = NO;
-    endt->answer = "1000";
+    endt->answer = "100";
     endt->description = _("Maximum number of iterations.");
 
     outband = G_define_standard_option(G_OPT_R_OUTPUT);
@@ -185,8 +185,8 @@
 	if (atoi(endt->answer) > 0)
 	    globals->end_t = atoi(endt->answer);
 	else {
-	    globals->end_t = 1000;
-	    G_warning(_("Invalid number of iterations, 1000 will be used."));
+	    globals->end_t = 100;
+	    G_warning(_("Invalid number of iterations, 100 will be used."));
 	}
     }
     else



More information about the grass-commit mailing list