[GRASS-SVN] r73524 - grass-addons/grass7/imagery/i.segment.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 12 02:22:17 PDT 2018


Author: mlennert
Date: 2018-10-12 02:22:17 -0700 (Fri, 12 Oct 2018)
New Revision: 73524

Modified:
   grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.html
   grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
Log:
i.segment.stats: add option to use the new mean coordinates from r.object.geometry

Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.html
===================================================================
--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.html	2018-10-12 09:11:39 UTC (rev 73523)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.html	2018-10-12 09:22:17 UTC (rev 73524)
@@ -7,11 +7,11 @@
 <em><a href="r.clump.html">r.clump</a></em>.
 
 <p>
-Available statistics are those related to the shape and size of the areas
-(see the <em><a href="r.object.geometry.html">r.object.geometry</a></em>
-addon man page for more information
-on the statistics) and aggregated statistics of pixel values of other
-raster maps (see <em><a href="v.univar.html">v.univar</a></em> for details).
+Available statistics are those related to the shape, size and position of the
+areas (see the <em><a href="r.object.geometry.html">r.object.geometry</a></em>
+addon man page for more information on the statistics) and aggregated statistics
+of pixel values of other raster maps (see 
+<em><a href="v.univar.html">v.univar</a></em> for details).
 
 <p>
 In addition, for each of the above statistics, the <b>-n</b> flag allows the 

Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py	2018-10-12 09:11:39 UTC (rev 73523)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py	2018-10-12 09:22:17 UTC (rev 73524)
@@ -50,7 +50,7 @@
 #% label: Area measurements to include in the output
 #% required: no
 #% multiple: yes
-#% options: area,perimeter,compact_circle,compact_square,fd
+#% options: area,perimeter,compact_circle,compact_square,fd,xcoords,ycoords
 #% answer: area,perimeter,compact_circle,fd
 #% guisection: Shape statistics
 #%end
@@ -201,7 +201,8 @@
             'mean': 7}
 
     geometry_stat_dict = {'cat': 0, 'area': 1, 'perimeter': 2,
-			'compact_square': 3, 'compact_circle': 4, 'fd' : 5}
+			'compact_square': 3, 'compact_circle': 4, 'fd' : 5,
+                        'xcoords': 6, 'ycoords': 7}
     
     if flags['r']:
         gscript.use_temp_region()
@@ -285,12 +286,12 @@
         # output_dict
         for key, group in groupby(nbr_matrix, lambda x: x[0]):
             d = {}
-            for i in range(len(output_dict[key])):
+            for i in range(original_nb_values):
                 d[i] = (0,0,0)
             nbrlist = [str(x[1]) for x in group]
             if len(nbrlist) > 1:
                 for nbr in nbrlist:
-                    for i in range(len(output_dict[key])):
+                    for i in range(original_nb_values):
                         d[i] = update(d[i], float(output_dict[nbr][i]))
                 output_dict[key] = output_dict[key] + [str(len(nbrlist))]
                 output_dict[key] = output_dict[key] + [str(i) for sub in [finalize(x) for x in d.values()] for i in sub]
@@ -297,7 +298,7 @@
             else:
                 newvalues = ['1']
                 nbr = nbrlist[0]
-                for i in range(len(output_dict[key])):
+                for i in range(original_nb_values):
                     newvalues.append(output_dict[nbr][i])
                     newvalues.append('0')
                 output_dict[key] = output_dict[key] + newvalues



More information about the grass-commit mailing list